提交 a787e255 编写于 作者: L liuqi

Add input size validation for Eltwise Op.

上级 cd7cabb5
...@@ -902,6 +902,9 @@ class EltwiseOp : public Operation { ...@@ -902,6 +902,9 @@ class EltwiseOp : public Operation {
MaceStatus Run(OpContext *context) override { MaceStatus Run(OpContext *context) override {
MACE_UNUSED(context); MACE_UNUSED(context);
MACE_CHECK(this->InputSize() < 3,
"Element-Wise does not support 3 or higher inputs,"
" you could change your model to multiple Element-Wise");
const Tensor *input0 = this->Input(0); const Tensor *input0 = this->Input(0);
const Tensor *input1 = this->InputSize() == 2 ? this->Input(1) : nullptr; const Tensor *input1 = this->InputSize() == 2 ? this->Input(1) : nullptr;
Tensor *output = this->Output(0); Tensor *output = this->Output(0);
...@@ -1192,6 +1195,9 @@ class EltwiseOp<DeviceType::GPU, T> : public Operation { ...@@ -1192,6 +1195,9 @@ class EltwiseOp<DeviceType::GPU, T> : public Operation {
} }
} }
MaceStatus Run(OpContext *context) override { MaceStatus Run(OpContext *context) override {
MACE_CHECK(this->InputSize() < 3,
"Element-Wise does not support 3 or higher inputs,"
" you could change your model to multiple Element-Wise");
const Tensor *input0 = this->Input(0); const Tensor *input0 = this->Input(0);
const Tensor *input1 = this->InputSize() == 2 ? this->Input(1) : nullptr; const Tensor *input1 = this->InputSize() == 2 ? this->Input(1) : nullptr;
Tensor *output = this->Output(0); Tensor *output = this->Output(0);
......
...@@ -787,7 +787,7 @@ def validate_model(abi, ...@@ -787,7 +787,7 @@ def validate_model(abi,
"--output_data_format=%s" % ",".join(output_data_formats), "--output_data_format=%s" % ",".join(output_data_formats),
"--validation_threshold=%f" % validation_threshold, "--validation_threshold=%f" % validation_threshold,
"--input_data_type=%s" % ",".join(input_data_types), "--input_data_type=%s" % ",".join(input_data_types),
"--backend=%s" % ",".join(backend), "--backend=%s" % backend,
"--validation_outputs_data=%s" % ",".join( "--validation_outputs_data=%s" % ",".join(
validation_outputs_data), validation_outputs_data),
"--log_file=%s" % log_file, "--log_file=%s" % log_file,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册