Skip to content

Commit

Permalink
[luci] Add validation to CircleTransposeConv (Samsung#3415)
Browse files Browse the repository at this point in the history
* [luci] Add validation to CircleTransposeConv

This commit adds validation to CircleTransposeConv

ONE-DCO-1.0-Signed-off-by: seongwoo <[email protected]>

* add comments and rank validation
  • Loading branch information
mhs4670go authored Jul 23, 2020
1 parent 304b78a commit e0a4011
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions compiler/luci/import/src/Nodes/CircleTransposeConv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,24 @@ bool CircleTransposeConvGraphBuilder::validate(const ValidateArgs &args) const
if (args.op.inputs.size() != 3)
return false;

const auto &inputs = args.op.inputs;
const auto &tensors = args.reader.tensors();
const auto &filter_tensor = tensors.at(inputs[1]);
const auto &filter_shape = filter_tensor.get()->shape;
const auto &ifm_tensor = tensors.at(inputs[2]);
const auto &ifm_shape = ifm_tensor.get()->shape;

// ifm and filters must be 4-D tensor
if (ifm_shape.size() != 4)
return false;
if (filter_shape.size() != 4)
return false;

// input shape : [batch, height, width, in_channels]
// filters shape : [output_channels, height, weight, in_channels]
if (ifm_tensor.get()->shape.at(3) != filter_tensor.get()->shape.at(3))
return false;

return true;
}

Expand Down

0 comments on commit e0a4011

Please sign in to comment.