29 if (args.op.inputs.size() != 3 && args.op.inputs.size() != 2)
32 if (args.op.outputs.size() != 1)
35 const auto tensors = args.reader.tensors();
38 const auto input = tensors.at(args.op.inputs.at(0));
39 assert(input !=
nullptr);
40 const auto input_shape =
wrap(input->shape());
43 if (input_shape.size() != 4)
47 const auto filter = tensors.at(args.op.inputs.at(1));
48 assert(filter !=
nullptr);
49 const auto filter_shape =
wrap(filter->shape());
52 if (filter_shape.size() != 4)
56 const auto *options = args.op.builtin_options.AsDepthwiseConv2DOptions();
57 const auto &multiplier = options->depth_multiplier;
60 if (filter_shape.at(3) != input_shape.at(3) * multiplier)
66CircleNode *CircleDepthwiseConv2DGraphBuilder::build_node(
const circle::OperatorT &op,
67 const std::vector<CircleNode *> &inputs,
71 node->
input(inputs.at(0));
72 node->filter(inputs.at(1));
73 if (inputs.size() != 3)
74 throw oops::UserExn(
"DepthwiseConv2d without bias is unsupported");
75 node->bias(inputs.at(2));
77 const auto *options = op.builtin_options.AsDepthwiseConv2DOptions();
79 node->stride()->w(options->stride_w);
80 node->stride()->h(options->stride_h);
81 node->depthMultiplier(options->depth_multiplier);
82 node->fusedActivationFunction(
luci_actfunc(options->fused_activation_function));
83 node->dilation()->w(options->dilation_w_factor);
84 node->dilation()->h(options->dilation_h_factor);
bool validate(const ValidateArgs &args) const final
DEPTHWISE_CONV_2D in Circle.
loco::Node * input(void) const
VectorWrapper< T > wrap(const flatbuffers::Vector< T > *vec)
Padding luci_padding(const circle::Padding padding)
FusedActFunc luci_actfunc(const circle::ActivationFunctionType type)