30 assert(cur_op->inputs()->size() == 1);
32 const circle::Tensor *input = kernel.
input();
33 const circle::Tensor *output = kernel.
output();
35 assert(Tensor::num_elements(input) == Tensor::num_elements(output));
43 const circle::SqueezeOptions *op_params = cur_op->builtin_options_as_SqueezeOptions();
46 int num_squeeze_dims = op_params->squeeze_dims()->size();
47 assert(input_num_dims <= 8);
48 bool should_squeeze[8] = {
false};
49 int num_squeezed_dims = 0;
50 if (num_squeeze_dims == 0)
52 for (
int idx = 0; idx < input_num_dims; ++idx)
57 should_squeeze[idx] =
true;
64 for (
int idx = 0; idx < num_squeeze_dims; ++idx)
66 int current = (*op_params->squeeze_dims())[idx] < 0
67 ? (*op_params->squeeze_dims())[idx] + input_num_dims
68 : (*op_params->squeeze_dims())[idx];
69 assert(current >= 0 && current < input_num_dims &&
71 if (!should_squeeze[current])
73 should_squeeze[current] =
true;
82 assert(cur_op->inputs()->size() == 1);
84 const circle::Tensor *input = kernel.
input();
85 const circle::Tensor *output = kernel.
output();
90 assert(input_data !=
nullptr);
91 assert(output_data !=
nullptr);
93 assert(Tensor::num_elements(input) == Tensor::num_elements(output));
95 std::memcpy(output_data, input_data,
96 getDataTypeSize(Tensor::element_type(input)) * Tensor::num_elements(input));