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

Function TEST

tensorflow/lite/kernels/optional_tensor_test.cc:230–309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228};
229
230TEST(LSTMOpTest, BlackBoxTestWithCifgWithPeepholeNoProjectionNoClipping) {
231 const int n_batch = 1;
232 const int n_input = 2;
233 // n_cell and n_output have the same size when there is no projection.
234 const int n_cell = 4;
235 const int n_output = 4;
236
237 LSTMOpModel lstm(n_batch, n_input, n_cell, n_output,
238 /*use_cifg=*/true, /*use_peephole=*/true,
239 /*use_projection_weights=*/false,
240 /*use_projection_bias=*/false,
241 /*cell_clip=*/0.0, /*proj_clip=*/0.0,
242 {
243 {n_batch, n_input}, // input tensor
244
245 {0, 0}, // input_to_input_weight tensor
246 {n_cell, n_input}, // input_to_forget_weight tensor
247 {n_cell, n_input}, // input_to_cell_weight tensor
248 {n_cell, n_input}, // input_to_output_weight tensor
249
250 {0, 0}, // recurrent_to_input_weight tensor
251 {n_cell, n_output}, // recurrent_to_forget_weight tensor
252 {n_cell, n_output}, // recurrent_to_cell_weight tensor
253 {n_cell, n_output}, // recurrent_to_output_weight tensor
254
255 {0}, // cell_to_input_weight tensor
256 {n_cell}, // cell_to_forget_weight tensor
257 {n_cell}, // cell_to_output_weight tensor
258
259 {0}, // input_gate_bias tensor
260 {n_cell}, // forget_gate_bias tensor
261 {n_cell}, // cell_bias tensor
262 {n_cell}, // output_gate_bias tensor
263
264 {0, 0}, // projection_weight tensor
265 {0}, // projection_bias tensor
266 });
267
268 lstm.SetInputToCellWeights({-0.49770179, -0.27711356, -0.09624726, 0.05100781,
269 0.04717243, 0.48944736, -0.38535351,
270 -0.17212132});
271
272 lstm.SetInputToForgetWeights({-0.55291498, -0.42866567, 0.13056988,
273 -0.3633365, -0.22755712, 0.28253698, 0.24407166,
274 0.33826375});
275
276 lstm.SetInputToOutputWeights({0.10725588, -0.02335852, -0.55932593,
277 -0.09426838, -0.44257352, 0.54939759,
278 0.01533556, 0.42751634});
279
280 lstm.SetCellBias({0., 0., 0., 0.});
281
282 lstm.SetForgetGateBias({1., 1., 1., 1.});
283
284 lstm.SetOutputGateBias({0., 0., 0., 0.});
285
286 lstm.SetRecurrentToCellWeights(
287 {0.54066205, -0.32668582, -0.43562764, -0.56094903, 0.42957711,

Callers

nothing calls this directly

Calls 12

SetInputToCellWeightsMethod · 0.45
SetCellBiasMethod · 0.45
SetForgetGateBiasMethod · 0.45
SetOutputGateBiasMethod · 0.45
VerifyMethod · 0.45

Tested by

no test coverage detected