Skip to content

Commit

Permalink
fix switch warning
Browse files Browse the repository at this point in the history
  • Loading branch information
BowenBao committed Jun 13, 2019
1 parent de0b66a commit 9f53df3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions torch/csrc/jit/script/init.cpp
Expand Up @@ -181,14 +181,17 @@ static Self moduleSelf(
static TypePtr getTensorType(
const at::Tensor& t,
const TypeKind type_kind) {
AT_ASSERT(type_kind == TypeKind::DimensionedTensorType || type_kind == TypeKind::CompleteTensorType);
switch (type_kind) {
case TypeKind::DimensionedTensorType:
return DimensionedTensorType::create(t);
case TypeKind::CompleteTensorType:
case TypeKind::CompleteTensorType: {
auto scalar_type = t.scalar_type();
auto sizes = t.sizes();
return CompleteTensorType::create(scalar_type, at::kCPU, sizes);
}
default:
throw std::runtime_error(
"Attempted to call getTensorType for type kind other than DimensionedTensorType or CompleteTensorType.");
}
}

Expand Down

0 comments on commit 9f53df3

Please sign in to comment.