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);
45 if (options->axis < -1 || options->axis >
static_cast<int32_t
>(
wrap(indices->shape()).size()))
47 if (
wrap(depth->shape()).size() != 0)
49 if (
wrap(on_value->shape()).size() != 0)
51 if (
wrap(off_value->shape()).size() != 0)
53 if (on_value->type() != off_value->type())