Skip to content

Commit

Permalink
Remove now obsolete checks for 0 shaped tensors.
Browse files Browse the repository at this point in the history
  • Loading branch information
jwfromm committed Oct 19, 2020
1 parent 24b350e commit 08068c5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 10 deletions.
7 changes: 0 additions & 7 deletions src/relay/backend/vm/compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,6 @@ class VMFunctionCompiler : ExprFunctor<void(const Expr& expr)> {
void VisitExpr_(const ConstantNode* const_node) {
// Check the shape is valid
NDArray data = const_node->data;
const DLTensor* tensor = data.operator->();
if (tensor->ndim > 0) {
int64_t* shapes = reinterpret_cast<int64_t*>(tensor->shape);
for (auto i = 0; i < tensor->ndim; i++) {
CHECK_GT(shapes[i], 0U);
}
}
size_t konst_idx = context_->constants.size();
if (expr_device_map_.empty()) {
context_->const_device_type.push_back(targets_.begin()->first);
Expand Down
3 changes: 0 additions & 3 deletions src/relay/transforms/fold_constant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,6 @@ class ConstantFolder : public MixedModeMutator {
Expr ObjectToExpr(const ObjectRef& value) {
if (value->IsInstance<runtime::NDArray::ContainerType>()) {
auto nd_array = Downcast<runtime::NDArray>(value);
for (auto dim : nd_array.Shape()) {
CHECK_GT(dim, 0) << "invalid dimension after constant eval";
}
return Constant(nd_array);
} else if (const auto* val = value.as<runtime::ADTObj>()) {
runtime::ADT adt = GetRef<runtime::ADT>(val);
Expand Down

0 comments on commit 08068c5

Please sign in to comment.