61 runtime_kernel.
readKernel(op_index, runtime_context);
63 const circle::Tensor *input = runtime_kernel.
inputs[inputTensorIdx];
64 const circle::Tensor *weights_feature = runtime_kernel.
inputs[weightsFeatureTensorIdx];
65 const circle::Tensor *weights_time = runtime_kernel.
inputs[weightsTimeTensorIdx];
66 const circle::Tensor *bias = runtime_kernel.
inputs[biasTensorIdx];
67 const circle::Tensor *activation_state = runtime_kernel.
inputs[inputActivationStateTensorIdx];
69 const circle::Tensor *output = runtime_kernel.
outputs[outputTensorIdx];
71 assert(input !=
nullptr);
72 assert(weights_feature !=
nullptr);
73 assert(weights_time !=
nullptr);
75 assert(activation_state !=
nullptr);
76 assert(output !=
nullptr);
80 const auto *options = runtime_kernel.
first_operator->builtin_options_as_SVDFOptions();
81 status = utils::checkCondition(options !=
nullptr);
92 const int rank = options->rank();
93 const int input_size = input_shape.
dims(1);
94 const int batch_size = input_shape.
dims(0);
95 const int num_filters = weights_feature_shape.
dims(0);
96 status = utils::checkCondition(num_filters % rank == 0);
100 const int num_units = num_filters / rank;
101 const int memory_size = weights_time_shape.
dims(1);
115 status = utils::checkCondition(weights_feature_shape.
dimensionsCount() == 2 and
116 weights_feature_shape.
dims(1) == input_size);
121 status = utils::checkCondition(weights_time_shape.
dimensionsCount() == 2 and
122 weights_time_shape.
dims(0) == num_filters and
123 weights_time_shape.
dims(1) == memory_size);
130 status = utils::checkCondition(
OMRuntimeShape(bias).dims(0) == num_units);
136 status = utils::checkCondition(activation_state_shape.
dimensionsCount() == 2 and
137 activation_state_shape.
dims(0) == batch_size and
138 activation_state_shape.
dims(1) == memory_size * num_filters);
142 if (input->type() == circle::TensorType_FLOAT32)
144 status = utils::checkCondition(weights_feature->type() == circle::TensorType_FLOAT32 and
145 weights_time->type() == circle::TensorType_FLOAT32 and
146 activation_state->type() == circle::TensorType_FLOAT32 and
147 output->type() == circle::TensorType_FLOAT32);
152 status = utils::checkCondition(bias->type() == circle::TensorType_FLOAT32);