Fix for mainz model (#4744)

* fix for mainz model

* fix build

* on comments

* revert the extra check

* on comments

Co-authored-by: Ethan Tao <ettao@microsoft.com>
This commit is contained in:
ytaous 2020-08-18 11:47:19 -07:00 committed by GitHub
parent f3b0c93a45
commit 2605af9a0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 1 deletions

View file

@ -323,7 +323,7 @@ class PlannerImpl {
// Find if freelist contains a buffer of the same size as output_arg
bool FindReusableTensor(const onnxruntime::NodeArg& output_arg, OrtValueIndex* reusable_tensor) {
auto p_required_buffer_shape = context_.GetShape(output_arg);
if (nullptr == p_required_buffer_shape) return false;
if (nullptr == p_required_buffer_shape || p_required_buffer_shape->dim_size() == 0) return false;
auto& required_memory_info = AllocPlan(output_arg.Name()).location;
if (HasFence(&output_arg)) return false;

View file

@ -41,6 +41,7 @@ static std::unordered_map<std::string, std::unordered_set<size_t>>
{"OneHot", {0, 1, 2}},
{"Where", {0}},
{"Range", {0, 1, 2}},
{"Tile", {1}},
{"BroadcastGradientArgs", {0, 1}}};
class GradientGraphBuilder {

View file

@ -91,6 +91,8 @@ Status GetShape(const ArgDef& arg_def, std::vector<Dimension>& shape) {
"During GetShape, ", arg_def.name, "'s shape is null.");
const auto& dims = arg_def.type_proto->tensor_type().shape().dim();
for (auto dim = dims.begin(); dim < dims.end(); dim++) {
ORT_RETURN_IF_NOT(dim->dim_value() > 0 || dim->has_dim_param(),
"During GetShape, ", arg_def.name, "'s dim value is invalid ", dim->dim_value());
shape.push_back(*dim);
}
return Status::OK();