38 const auto &inputs = args.op.inputs;
39 const auto &outputs = args.op.outputs;
42 const auto *options = args.op.builtin_options.AsCastOptions();
43 if (options !=
nullptr)
45 const auto tensors = args.reader.tensors();
46 const auto output_tensor = tensors[outputs[0]];
47 assert(output_tensor !=
nullptr);
50 const auto tensor_in = tensors.at(inputs.at(0));
51 assert(tensor_in !=
nullptr);
52 if (tensor_in->type() != options->in_data_type)
56 WARN(l) <<
"Warning: import Cast(" << name <<
") dtype mismatch";
61 const auto &tensor_out = tensors.at(outputs[0]);
62 if (tensor_out->type() != options->out_data_type)
66 WARN(l) <<
"Warning: import Cast(" << name <<
") dtype mismatch";
76CircleNode *CircleCastGraphBuilder::build_node(
const circle::OperatorT &op,
77 const std::vector<CircleNode *> &inputs,
80 auto *node = graph->nodes()->create<
CircleCast>();
81 node->
x(inputs.at(0));
83 const auto *options = op.builtin_options.AsCastOptions();
84 if (options !=
nullptr)
91 node->in_data_type(inputs.at(0)->dtype());
92 node->out_data_type(loco::DataType::Unknown);
bool validate(const ValidateArgs &args) const final
loco::Node * x(void) const
bool validate(const ValidateArgs &args, size_t input_cnt) const
loco::DataType luci_datatype(circle::TensorType type)
const char * tensor_name(const circle::Tensor *tensor)
static UserSettings * settings()