From 08068c507872076bf415210bf6cb7efe4aa57080 Mon Sep 17 00:00:00 2001 From: Josh Fromm Date: Mon, 19 Oct 2020 20:06:55 +0000 Subject: [PATCH] Remove now obsolete checks for 0 shaped tensors. --- src/relay/backend/vm/compiler.cc | 7 ------- src/relay/transforms/fold_constant.cc | 3 --- 2 files changed, 10 deletions(-) diff --git a/src/relay/backend/vm/compiler.cc b/src/relay/backend/vm/compiler.cc index c7ceca3604c8..c3bf80571638 100644 --- a/src/relay/backend/vm/compiler.cc +++ b/src/relay/backend/vm/compiler.cc @@ -343,13 +343,6 @@ class VMFunctionCompiler : ExprFunctor { 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(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); diff --git a/src/relay/transforms/fold_constant.cc b/src/relay/transforms/fold_constant.cc index 8d2cba05be49..1de690d91036 100644 --- a/src/relay/transforms/fold_constant.cc +++ b/src/relay/transforms/fold_constant.cc @@ -199,9 +199,6 @@ class ConstantFolder : public MixedModeMutator { Expr ObjectToExpr(const ObjectRef& value) { if (value->IsInstance()) { auto nd_array = Downcast(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::ADT adt = GetRef(val);