The current implementation assumes that operand is either scalar or
tensor and validates it through assert.
This commit explicitly validates dynamic casted pointer, which allows us
to detect such an abnormal case even for release build.
Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
{
res->ctor() << ScalarOperandDecl{mname, scalar->dtype()};
}
- else
+ else if (auto tensor = dynamic_cast<const ann::TensorOperand *>(info))
{
- auto tensor = dynamic_cast<const ann::TensorOperand *>(info);
- assert(tensor != nullptr);
res->ctor() << TensorOperandDecl{mname, tensor->dtype(), tensor->shape()};
}
+ else
+ {
+ throw std::runtime_error{"Unsupported"};
+ }
if (info->weight())
{