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

#include <CircleSquaredDifference.h>

Collaboration diagram for luci::CircleSquaredDifferenceGraphBuilder:

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

Member Function Documentation

◆ validate()

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

Implements luci::GraphBuilderBase.

Definition at line 26 of file CircleSquaredDifference.cpp.

27{
28 if (!GraphBuilder::validate(args, 2))
29 return false;
30
31 const auto &inputs = args.op.inputs;
32 const auto &outputs = args.op.outputs;
33 // Inputs must be one of the following types
34 // bfloat16, half(float16), float32, float64, int32, int64, complex64, complex128
35 const auto tensors = args.reader.tensors();
36 const auto tensor = tensors.at(inputs.at(0));
37 assert(tensor != nullptr);
38 switch (tensor->type())
39 {
40 case circle::TensorType_FLOAT16:
41 case circle::TensorType_FLOAT32:
42 case circle::TensorType_FLOAT64:
43 case circle::TensorType_INT32:
44 case circle::TensorType_INT64:
45 case circle::TensorType_COMPLEX64:
46 break;
47 // TODO support bfloat16, complex128
48 // Additional support for quantized tensors
49 case circle::TensorType_UINT8:
50 case circle::TensorType_INT16:
51 break;
52 default:
53 return false;
54 }
55
56 // Input types must match
57 assert(tensors.at(inputs.at(0)) != nullptr && tensors.at(inputs.at(1)) != nullptr);
58 if (tensors.at(inputs.at(0))->type() != tensors.at(inputs.at(1))->type())
59 return false;
60
61 // Input and output types must match
62 assert(tensors.at(outputs[0]) != nullptr);
63 if (tensors.at(inputs.at(0))->type() != tensors.at(outputs[0])->type())
64 return false;
65
66 return true;
67}
bool validate(const ValidateArgs &args, size_t input_cnt) const
args
Definition infer.py:21

References luci::GraphBuilder::validate().


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