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

#include <CircleOneHot.h>

Collaboration diagram for luci::CircleOneHotGraphBuilder:

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 CircleOneHot.h.

Member Function Documentation

◆ validate()

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

Implements luci::GraphBuilderBase.

Definition at line 27 of file CircleOneHot.cpp.

28{
29 // Only 4 Input come refered from
30 if (!GraphBuilder::validate(args, 4))
31 return false;
32
33 const auto &inputs = args.op.inputs;
34 const auto *options = args.op.builtin_options.AsOneHotOptions();
35 const auto tensors = args.reader.tensors();
36 const auto indices = tensors.at(inputs.at(0));
37 const auto depth = tensors.at(inputs.at(1));
38 const auto on_value = tensors.at(inputs.at(2));
39 const auto off_value = tensors.at(inputs.at(3));
40 assert(indices != nullptr);
41 assert(depth != nullptr);
42 assert(on_value != nullptr);
43 assert(off_value != nullptr);
44
45 if (options->axis < -1 || options->axis > static_cast<int32_t>(wrap(indices->shape()).size()))
46 return false;
47 if (wrap(depth->shape()).size() != 0)
48 return false;
49 if (wrap(on_value->shape()).size() != 0)
50 return false;
51 if (wrap(off_value->shape()).size() != 0)
52 return false;
53 if (on_value->type() != off_value->type())
54 return false;
55
56 return true;
57}
bool validate(const ValidateArgs &args, size_t input_cnt) const
args
Definition infer.py:21
VectorWrapper< T > wrap(const flatbuffers::Vector< T > *vec)

References luci::GraphBuilder::validate(), and luci::wrap().


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