MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / RNNOpModel

Method RNNOpModel

tensorflow/lite/kernels/basic_rnn_test.cc:176–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174class RNNOpModel : public SingleOpModel {
175 public:
176 RNNOpModel(int batches, int units, int size,
177 const TensorType& weights = TensorType_FLOAT32,
178 const TensorType& recurrent_weights = TensorType_FLOAT32)
179 : batches_(batches), units_(units), input_size_(size) {
180 input_ = AddInput(TensorType_FLOAT32);
181 weights_ = AddInput(weights);
182 recurrent_weights_ = AddInput(recurrent_weights);
183 bias_ = AddInput(TensorType_FLOAT32);
184 hidden_state_ = AddInput(TensorType_FLOAT32, true);
185 output_ = AddOutput(TensorType_FLOAT32);
186 SetBuiltinOp(
187 BuiltinOperator_RNN, BuiltinOptions_RNNOptions,
188 CreateRNNOptions(builder_, ActivationFunctionType_RELU).Union());
189 BuildInterpreter({{batches_, input_size_}, // input tensor
190 {units_, input_size_}, // weights tensor
191 {units_, units_}, // recurrent weights tensor
192 {units_}, // bias tensor
193 {batches_, units_}}); // hidden state tensor
194 }
195
196 void SetBias(std::initializer_list<float> f) { PopulateTensor(bias_, f); }
197

Callers

nothing calls this directly

Calls 4

AddOutputFunction · 0.85
CreateRNNOptionsFunction · 0.85
AddInputFunction · 0.50
UnionMethod · 0.45

Tested by

no test coverage detected