ONE - On-device Neural Engine
Loading...
Searching...
No Matches
luci::CircleDepthwiseConv2DGraphBuilder Class Reference

#include <CircleDepthwiseConv2D.h>

Collaboration diagram for luci::CircleDepthwiseConv2DGraphBuilder:

Public Member Functions

bool validate (const ValidateArgs &args) const final
 
- Public Member Functions inherited from luci::GraphBuilder
virtual ~GraphBuilder ()=default
 
bool validate (const ValidateArgs &args, size_t input_cnt) const
 
CircleNodebuild (const circle::OperatorT &op, GraphBuilderContext *context) const final
 
- Public Member Functions inherited from luci::GraphBuilderBase
virtual ~GraphBuilderBase ()=default
 

Detailed Description

Definition at line 25 of file CircleDepthwiseConv2D.h.

Member Function Documentation

◆ validate()

bool luci::CircleDepthwiseConv2DGraphBuilder::validate ( const ValidateArgs args) const
finalvirtual

Implements luci::GraphBuilderBase.

Definition at line 26 of file CircleDepthwiseConv2D.cpp.

27{
28 // Circle DepthwiseConv2D may not have a bias but we won't support this
29 if (args.op.inputs.size() != 3 && args.op.inputs.size() != 2)
30 return false;
31
32 if (args.op.outputs.size() != 1)
33 return false;
34
35 const auto tensors = args.reader.tensors();
36
37 // input shape
38 const auto input = tensors.at(args.op.inputs.at(0));
39 assert(input != nullptr);
40 const auto input_shape = wrap(input->shape());
41
42 // input shape must be rank 4
43 if (input_shape.size() != 4)
44 return false;
45
46 // filter shape
47 const auto filter = tensors.at(args.op.inputs.at(1));
48 assert(filter != nullptr);
49 const auto filter_shape = wrap(filter->shape());
50
51 // filter shape must be rank 4
52 if (filter_shape.size() != 4)
53 return false;
54
55 // multiplier
56 const auto *options = args.op.builtin_options.AsDepthwiseConv2DOptions();
57 const auto &multiplier = options->depth_multiplier;
58
59 // filter represents as [1, H, W, C*M] where M is multiplier.
60 if (filter_shape.at(3) != input_shape.at(3) * multiplier)
61 return false;
62
63 return true;
64}
args
Definition infer.py:21
VectorWrapper< T > wrap(const flatbuffers::Vector< T > *vec)

References luci::wrap().


The documentation for this class was generated from the following files: