/aosp_15_r20/external/tensorflow/tensorflow/lite/kernels/ |
H A D | unidirectional_sequence_lstm_test.cc | 15 // Unit test for TFLite Sequential LSTM op. 111 // Weights of the LSTM model. Some are optional. 130 // LSTM input is stored as num_batch x num_inputs vector. 132 // LSTM output is stored as num_batch x num_outputs vector. 135 // Compares output up to tolerance to the result of the lstm given the input. 138 UnidirectionalLSTMOpModel* lstm, float tolerance = 1e-5, in VerifyGoldens() argument 142 const int num_inputs = lstm->num_inputs(); in VerifyGoldens() 153 lstm->SetInput(((i * num_batches) + b) * num_inputs, batch_start, in VerifyGoldens() 162 lstm->SetInput(b * input_sequence_size * num_inputs, batch_start, in VerifyGoldens() 167 ASSERT_EQ(lstm->Invoke(), kTfLiteOk); in VerifyGoldens() [all …]
|
H A D | bidirectional_sequence_lstm_test.cc | 15 // Unit test for TFLite Bidirectional LSTM op. 440 BidirectionalLSTMOpModel lstm( in TEST_P() local 513 lstm.SetInputToInputWeights({-0.45018822, -0.02338299, -0.0870589, in TEST_P() 517 lstm.SetInputToCellWeights({-0.50013041, 0.1370284, 0.11810488, 0.2013163, in TEST_P() 521 lstm.SetInputToForgetWeights({0.09701663, 0.20334584, -0.50592935, in TEST_P() 525 lstm.SetInputToOutputWeights({-0.25065863, -0.28290087, 0.04613829, in TEST_P() 529 lstm.SetInputGateBias({0., 0., 0., 0.}); in TEST_P() 531 lstm.SetCellBias({0., 0., 0., 0.}); in TEST_P() 533 lstm.SetForgetGateBias({1., 1., 1., 1.}); in TEST_P() 535 lstm.SetOutputGateBias({0., 0., 0., 0.}); in TEST_P() [all …]
|
H A D | unidirectional_sequence_lstm.cc | 40 // If the lstm is layer norm. 59 GetVariableInput(context, node, lstm::full::kCellStateTensor); in PopulateQuantizedLstmParams8x8_16() 64 GetOutputSafe(context, node, lstm::full::kOutputTensor, &output_tensor)); in PopulateQuantizedLstmParams8x8_16() 94 context, GetInputSafe(context, node, lstm::full::kInputTensor, &input)); in PopulateQuantizedLstmParams8x8_16() 97 context, node, lstm::full::kInputToInputWeightsTensor); in PopulateQuantizedLstmParams8x8_16() 101 GetInputSafe(context, node, lstm::full::kInputToForgetWeightsTensor, in PopulateQuantizedLstmParams8x8_16() 105 lstm::full::kInputToCellWeightsTensor, in PopulateQuantizedLstmParams8x8_16() 110 GetInputSafe(context, node, lstm::full::kInputToOutputWeightsTensor, in PopulateQuantizedLstmParams8x8_16() 114 context, node, lstm::full::kRecurrentToInputWeightsTensor); in PopulateQuantizedLstmParams8x8_16() 118 GetInputSafe(context, node, lstm::full::kRecurrentToForgetWeightsTensor, in PopulateQuantizedLstmParams8x8_16() [all …]
|
H A D | lstm_test.cc | 15 // Unit test for TFLite LSTM op. 313 // Weights of the LSTM model. Some are optional. 335 // LSTM input is stored as num_steps * num_batch * num_inputs vector. 337 // LSTM output is stored as num_steps * num_batch * num_outputs vector. 340 // Compares output up to tolerance to the result of the lstm given the input. 341 void VerifyGoldens(LSTMOpModel* lstm, float tolerance) { in VerifyGoldens() argument 345 SetAllWeightsAndBiases(lstm); in VerifyGoldens() 346 lstm->ApplyDelegate(); in VerifyGoldens() 348 const int num_inputs = lstm->num_inputs(); in VerifyGoldens() 349 const int num_outputs = lstm->num_outputs(); in VerifyGoldens() [all …]
|
/aosp_15_r20/packages/modules/NeuralNetworks/common/cpu_operations/ |
D | LSTMTest.cpp | 22 #include "LSTM.h" 279 LSTMOpModel lstm(n_batch, n_input, n_cell, n_output, in TEST() local 310 lstm.SetInputToInputWeights({-0.45018822, -0.02338299, -0.0870589, -0.34550029, 0.04266912, in TEST() 313 lstm.SetInputToCellWeights({-0.50013041, 0.1370284, 0.11810488, 0.2013163, -0.20583314, in TEST() 316 lstm.SetInputToForgetWeights({0.09701663, 0.20334584, -0.50592935, -0.31343272, -0.40032279, in TEST() 319 lstm.SetInputToOutputWeights({-0.25065863, -0.28290087, 0.04613829, 0.40525138, 0.44272184, in TEST() 322 lstm.SetInputGateBias({0., 0., 0., 0.}); in TEST() 324 lstm.SetCellGateBias({0., 0., 0., 0.}); in TEST() 326 lstm.SetForgetGateBias({1., 1., 1., 1.}); in TEST() 328 lstm.SetOutputGateBias({0., 0., 0., 0.}); in TEST() [all …]
|
D | LayerNormLSTMTest.cpp | 25 #include "LSTM.h" 293 LayerNormLSTMOpModel lstm(n_batch, n_input, n_cell, n_output, in TEST() local 332 lstm.SetInputToInputWeights({0.5, 0.6, 0.7, -0.8, -0.9, 0.1, 0.2, 0.3, -0.4, 0.5, in TEST() 335 lstm.SetInputToForgetWeights({-0.6, -0.1, 0.3, 0.2, 0.9, -0.5, -0.2, -0.4, 0.3, -0.8, in TEST() 338 lstm.SetInputToCellWeights({-0.4, -0.3, -0.2, -0.1, -0.5, 0.5, -0.2, -0.3, -0.2, -0.6, in TEST() 341 lstm.SetInputToOutputWeights({-0.8, -0.4, -0.2, -0.9, -0.1, -0.7, 0.3, -0.3, -0.8, -0.2, in TEST() 344 lstm.SetInputGateBias({0.03, 0.15, 0.22, 0.38}); in TEST() 346 lstm.SetForgetGateBias({0.1, -0.3, -0.2, 0.1}); in TEST() 348 lstm.SetCellGateBias({-0.05, 0.72, 0.25, 0.08}); in TEST() 350 lstm.SetOutputGateBias({0.05, -0.01, 0.2, 0.1}); in TEST() [all …]
|
/aosp_15_r20/external/tensorflow/tensorflow/lite/g3doc/examples/convert/ |
H A D | rnn.md | 6 fused LSTM operations. Fused operations exist to maximize the performance of 13 1. Provide **native support for standard TensorFlow RNN APIs** like Keras LSTM. 39 # Keras LSTM layers. 62 Keras LSTM to TensorFlow Lite 70 ### Keras LSTM conversion (recommended) 72 We support out-of-the-box conversion of Keras LSTM to TensorFlow Lite. For 74 [Keras LSTM interface](https://github.com/tensorflow/tensorflow/blob/35a3ab91b42503776f428bda574b74… 78 Also important is to highlight the TensorFlow Lite’s LSTM contract with respect 90 #### Keras LSTM Variants 94 Users may choose time-major or no time-major. Keras LSTM adds a time-major [all …]
|
/aosp_15_r20/external/pytorch/torch/ao/pruning/_experimental/pruner/ |
H A D | prune_functions.py | 365 lstm: nn.LSTM, getitem: Callable, linear: nn.Linear argument 367 prune_lstm_output_layernorm_linear(lstm, getitem, None, linear) 371 lstm: nn.LSTM, argument 376 for i in range(lstm.num_layers): 377 if parametrize.is_parametrized(lstm, f"weight_ih_l{i}"): 378 parametrization_dict = cast(nn.ModuleDict, lstm.parametrizations) 386 lstm, f"weight_ih_l{i}", leave_parametrized=True 389 lstm, 391 nn.Parameter(getattr(lstm, f"weight_ih_l{i}")[mask]), 394 lstm, [all …]
|
/aosp_15_r20/external/tensorflow/tensorflow/lite/delegates/gpu/common/ |
H A D | lstm_parser.cc | 108 node, tflite::ops::builtin::lstm::full::kInputToInputWeightsTensor); in HasCifg() 115 node, tflite::ops::builtin::lstm::full::kCellToForgetWeightsTensor); in HasPeephole() 121 tflite::ops::builtin::lstm::full::kForgetLayerNormCoefficientsTensor); in HasNormalization() 126 tflite::ops::builtin::lstm::full::kProjectionWeightsTensor); in HasProjection() 129 // Builds subgraph for a single LSTM gate. 164 reader->AddInput(node, tflite::ops::builtin::lstm::full::kInputTensor)); in BuildLstmGate() 264 // Builds subgraph for LSTM cell state update. 280 tflite::ops::builtin::lstm::full::kCellStateTensor, &cell_state)); in BuildCellStateUpdate() 341 // Build subgraph for LSTM output state update. 406 tflite::ops::builtin::lstm::full::kProjectionWeightsTensor, in BuildOutputStateUpdate() [all …]
|
/aosp_15_r20/external/pytorch/torch/ao/quantization/fx/ |
H A D | lstm_utils.py | 18 # TODO: move all LSTM util functions from fx/utils.py to this file 20 float_lstm: torch.nn.LSTM, argument 28 ) -> torch.ao.nn.quantizable.LSTM: 30 Return an observed `torch.ao.nn.quantizable.LSTM` created from a `torch.nn.LSTM` 33 In both eager and FX graph mode quantization, `torch.ao.nn.quantizable.LSTM` is 36 Users who wish to override this behavior may extend `torch.ao.nn.quantizable.LSTM` 43 `float_lstm`: The float LSTM module 44 `example_inputs`: example inputs for the forward function of the LSTM module 45 `backend_config`: BackendConfig to use to observe the LSTM module 56 A `torch.ao.nn.quantizable.LSTM` with the specified observers or fake quantizes [all …]
|
H A D | utils.py | 494 Return whether this refers to the custom module LSTM flow. 500 isinstance(mod, torch.nn.LSTM) 505 return isinstance(mod, torch.ao.nn.quantizable.LSTM) 569 Insert DeQuantStubs after each internal output node of custom module LSTM. 571 Custom module LSTM outputs are nested tuples of the structure (output, (hidden0, hidden1)), 575 (1) Split the LSTM node into (output, (hidden0, hidden1)) 578 (4) Reroute all consumers of the original LSTM node and its sub-nodes 579 (e.g. lstm[0]) 616 For step (4), reroute all users of the original LSTM node(s) as follows: 625 # (1) Split the LSTM node into (output, (hidden0, hidden1)) [all …]
|
/aosp_15_r20/external/tensorflow/tensorflow/lite/tools/optimize/calibration/builtin_logging_ops/ |
H A D | lstm.cc | 15 #include "tensorflow/lite/tools/optimize/calibration/builtin_logging_ops/lstm.h" 55 // Initialize scratch buffers with bias for regular lstm or initialize with in CalculateLstmGateFloat() 56 // zero for layer norm lstm. in CalculateLstmGateFloat() 78 // For each batch and cell: compute cell_weight .* cell_state (peephole LSTM) in CalculateLstmGateFloat() 83 // Do layer normalization (if layer norm LSTM) in CalculateLstmGateFloat() 455 // If the lstm is layer norm. 471 ops::builtin::lstm::full::kInputTensor, &input)); in lstm_eval() 474 context, node, ops::builtin::lstm::full::kInputToInputWeightsTensor); in lstm_eval() 479 ops::builtin::lstm::full::kInputToForgetWeightsTensor, in lstm_eval() 484 ops::builtin::lstm::full::kInputToCellWeightsTensor, in lstm_eval() [all …]
|
/aosp_15_r20/external/tensorflow/tensorflow/compiler/tests/ |
H A D | lstm_test.py | 15 """Tests for the LSTM cell and layer.""" 23 from tensorflow.compiler.tests import lstm 55 # The tests for a single LSTM cell and LSTM layer use these values as 62 """Returns the next c states of an LSTM cell.""" 67 """Returns the next m states of an LSTM cell.""" 77 weights = init_weights(lstm.LSTMCellWeightsShape(num_inputs, num_nodes)) 83 m, c = lstm.LSTMCell(weights, m_prev, c_prev, x, pad) 87 # Initialize variables and run the unrolled LSTM step. 143 weights = array_ops.zeros(lstm.LSTMCellWeightsShape(num_inputs, num_nodes)) 150 lstm.LSTMLayer('lstm', weights, m, c, x_seq, [pad]) [all …]
|
/aosp_15_r20/external/tensorflow/tensorflow/lite/tools/optimize/calibration/custom_logging_ops/ |
H A D | lstm.cc | 15 #include "tensorflow/lite/tools/optimize/calibration/custom_logging_ops/lstm.h" 76 // Initialize scratch buffers with bias for regular lstm or initialize with in LstmStepWithAuxInput() 77 // zero for layer norm lstm. in LstmStepWithAuxInput() 533 // If the lstm is layer norm. 549 GetInput(context, node, ops::builtin::lstm::full::kInputTensor); in lstm_eval() 552 context, node, ops::builtin::lstm::full::kInputToInputWeightsTensor); in lstm_eval() 554 context, node, ops::builtin::lstm::full::kInputToForgetWeightsTensor); in lstm_eval() 556 context, node, ops::builtin::lstm::full::kInputToCellWeightsTensor); in lstm_eval() 558 context, node, ops::builtin::lstm::full::kInputToOutputWeightsTensor); in lstm_eval() 561 context, node, ops::builtin::lstm::full::kRecurrentToInputWeightsTensor); in lstm_eval() [all …]
|
/aosp_15_r20/device/google/caimito/thermal/ |
D | thermal_info_config_tokay.json | 270 "Name": "VIRTUAL-SKIN-LSTM-MODEL", 286 "Name": "LSTM-VT-PREDICTION-7SEC-BACK", 290 "Combination": ["VIRTUAL-SKIN-LSTM-MODEL"], 295 "Name": "LSTM-VT-PREDICTION-14SEC-BACK", 299 "Combination": ["VIRTUAL-SKIN-LSTM-MODEL"], 304 "Name": "LSTM-VT-PREDICTION-21SEC-BACK", 308 "Combination": ["VIRTUAL-SKIN-LSTM-MODEL"], 313 "Name": "LSTM-VT-PREDICTION-28SEC-BACK", 317 "Combination": ["VIRTUAL-SKIN-LSTM-MODEL"], 322 "Name": "LSTM-VT-PREDICTION-35SEC-BACK", [all …]
|
D | thermal_info_config_caiman.json | 280 "Name": "VIRTUAL-SKIN-LSTM-MODEL", 296 "Name": "LSTM-VT-PREDICTION-7SEC-BACK", 300 "Combination": ["VIRTUAL-SKIN-LSTM-MODEL"], 305 "Name": "LSTM-VT-PREDICTION-14SEC-BACK", 309 "Combination": ["VIRTUAL-SKIN-LSTM-MODEL"], 314 "Name": "LSTM-VT-PREDICTION-21SEC-BACK", 318 "Combination": ["VIRTUAL-SKIN-LSTM-MODEL"], 323 "Name": "LSTM-VT-PREDICTION-28SEC-BACK", 327 "Combination": ["VIRTUAL-SKIN-LSTM-MODEL"], 332 "Name": "LSTM-VT-PREDICTION-35SEC-BACK", [all …]
|
D | thermal_info_config_komodo.json | 270 "Name": "VIRTUAL-SKIN-LSTM-MODEL", 286 "Name": "LSTM-VT-PREDICTION-7SEC-BACK", 290 "Combination": ["VIRTUAL-SKIN-LSTM-MODEL"], 295 "Name": "LSTM-VT-PREDICTION-14SEC-BACK", 299 "Combination": ["VIRTUAL-SKIN-LSTM-MODEL"], 304 "Name": "LSTM-VT-PREDICTION-21SEC-BACK", 308 "Combination": ["VIRTUAL-SKIN-LSTM-MODEL"], 313 "Name": "LSTM-VT-PREDICTION-28SEC-BACK", 317 "Combination": ["VIRTUAL-SKIN-LSTM-MODEL"], 322 "Name": "LSTM-VT-PREDICTION-35SEC-BACK", [all …]
|
/aosp_15_r20/external/armnn/src/backends/neon/workloads/ |
H A D | NeonUnidirectionalSequenceLstmWorkload.cpp | 149 // Lstm in NeonUnidirectionalSequenceLstmWorkload() 266 // Set LSTM input and output ITensors depending on: in NeonUnidirectionalSequenceLstmWorkload() 267 // input format (timeMajor) & number of LSTM batches (maxTime). in NeonUnidirectionalSequenceLstmWorkload() 271 // If there is only one LSTM time major batch, we will not concat OR permute. in NeonUnidirectionalSequenceLstmWorkload() 272 // Set input of LSTM to be first input ITensor. in NeonUnidirectionalSequenceLstmWorkload() 273 // Set output of LSTM to be final output ITensor. in NeonUnidirectionalSequenceLstmWorkload() 274 // LSTM input/output cannot be > 2 dimensions so need to resize its TensorInfo. in NeonUnidirectionalSequenceLstmWorkload() 292 // If there is only one LSTM batch major batch, we will not concat, only permute. in NeonUnidirectionalSequenceLstmWorkload() 293 // Set input of LSTM to be output of initial permute. in NeonUnidirectionalSequenceLstmWorkload() 294 … // Set output of LSTM to be first element of m_ConcatInputs & use that value later in permute. in NeonUnidirectionalSequenceLstmWorkload() [all …]
|
H A D | NeonUnidirectionalSequenceLstmFloatWorkload.cpp | 147 // Lstm in NeonUnidirectionalSequenceLstmFloatWorkload() 280 // Set LSTM input and output ITensors depending on: in NeonUnidirectionalSequenceLstmFloatWorkload() 281 // input format (timeMajor) & number of LSTM batches (maxTime). in NeonUnidirectionalSequenceLstmFloatWorkload() 285 // If there is only one LSTM time major batch, we will not concat OR permute. in NeonUnidirectionalSequenceLstmFloatWorkload() 286 // Set input of LSTM to be first input ITensor. in NeonUnidirectionalSequenceLstmFloatWorkload() 287 // Set output of LSTM to be final output ITensor. in NeonUnidirectionalSequenceLstmFloatWorkload() 288 // LSTM input/output cannot be > 2 dimensions so need to resize its TensorInfo. in NeonUnidirectionalSequenceLstmFloatWorkload() 306 // If there is only one LSTM batch major batch, we will not concat, only permute. in NeonUnidirectionalSequenceLstmFloatWorkload() 307 // Set input of LSTM to be output of initial permute. in NeonUnidirectionalSequenceLstmFloatWorkload() 308 … // Set output of LSTM to be first element of m_ConcatInputs & use that value later in permute. in NeonUnidirectionalSequenceLstmFloatWorkload() [all …]
|
/aosp_15_r20/external/pytorch/test/cpp/api/ |
H A D | rnn.cpp | 72 // Expect the LSTM to have 64 outputs and 3 layers, with an input of batch in check_lstm_sizes() 103 // Expect the LSTM to have 32 outputs and 3 layers, with an input of batch in check_lstm_sizes_proj() 134 LSTM model(LSTMOptions(128, 64).num_layers(3).dropout(0.2)); in TEST_F() 161 LSTM model(LSTMOptions(128, 64).num_layers(3).dropout(0.2).proj_size(32)); in TEST_F() 190 LSTM model(2, 2); in TEST_F() 260 ASSERT_TRUE(test_RNN_xor<LSTM>( in TEST_F() 261 [](int s) { return LSTM(LSTMOptions(s, s).num_layers(2)); })); in TEST_F() 265 ASSERT_TRUE(test_RNN_xor<LSTM>([](int s) { in TEST_F() 266 return LSTM(LSTMOptions(s, s).num_layers(2).proj_size(s / 2)); in TEST_F() 289 LSTM model(LSTMOptions(128, 64).num_layers(3).dropout(0.2)); in TEST_F() [all …]
|
/aosp_15_r20/external/armnn/src/backends/cl/workloads/ |
H A D | ClUnidirectionalSequenceLstmFloatWorkload.cpp | 149 // Lstm in ClUnidirectionalSequenceLstmFloatWorkload() 282 // Set LSTM input and output ITensors depending on: in ClUnidirectionalSequenceLstmFloatWorkload() 283 // input format (timeMajor) & number of LSTM batches (maxTime). in ClUnidirectionalSequenceLstmFloatWorkload() 286 // If there is only one LSTM time major batch, we will not concat OR permute. in ClUnidirectionalSequenceLstmFloatWorkload() 287 // Set input of LSTM to be first input ITensor. in ClUnidirectionalSequenceLstmFloatWorkload() 288 // Set output of LSTM to be final output ITensor. in ClUnidirectionalSequenceLstmFloatWorkload() 289 // LSTM input/output cannot be > 2 dimensions so need to resize its TensorInfo. in ClUnidirectionalSequenceLstmFloatWorkload() 303 // If there is only one LSTM batch major batch, we will not concat, only permute. in ClUnidirectionalSequenceLstmFloatWorkload() 304 // Set input of LSTM to be output of initial permute. in ClUnidirectionalSequenceLstmFloatWorkload() 305 … // Set output of LSTM to be first element of m_ConcatInputs & use that value later in permute. in ClUnidirectionalSequenceLstmFloatWorkload() [all …]
|
/aosp_15_r20/external/pytorch/benchmarks/fastrnns/ |
H A D | factory.py | 223 lstm = torch.nn.LSTM(inputSize, hiddenSize, numLayers).to(device) 226 return x, lengths, (hx, cx), lstm.all_weights, lstm 228 # NB: lstm.all_weights format: 229 # wih, whh, bih, bhh = lstm.all_weights[layer] 230 return x, lengths, (hx, cx), lstm.all_weights, None 318 # cudnn_layernorm_lstm: since cudnn does not have Layernorm LSTM, we cannot benchmark 320 # computation of a cudnn lstm + seq_len * 3 layernorm computation. This should serve 321 # as a perf lowerbound for the Layernorm LSTM forward pass(given that Layernorm itself 337 # Layernorm cudnn LSTM in the forward pass 356 # input: lstm.all_weights format (wih, whh, bih, bhh = lstm.all_weights[layer]) [all …]
|
H A D | custom_lstms.py | 44 """Returns a ScriptModule that mimics a PyTorch native LSTM.""" 81 """Returns a ScriptModule that mimics a PyTorch native LSTM.""" 163 # XXX: This is true for our LSTM / NLP use case and helps simplify code 358 # Introduces a Dropout layer on the outputs of each LSTM layer except 364 "dropout lstm adds dropout layers after all but last " 409 # Control: pytorch native LSTM 410 lstm = nn.LSTM(input_size, hidden_size, 1) 412 for lstm_param, custom_param in zip(lstm.all_weights[0], rnn.parameters()): 416 lstm_out, lstm_out_state = lstm(inp, lstm_state) 433 # Control: pytorch native LSTM [all …]
|
/aosp_15_r20/external/pytorch/test/ao/sparsity/ |
H A D | test_structured_sparsifier.py | 111 model.lstm.weight_ih_l0 = nn.Parameter(manual_weights) 112 model.lstm.weight_hh_l0 = nn.Parameter(torch.Tensor(manual_weights)) 113 model.lstm.bias_ih_l0 = nn.Parameter(manual_weights[:, 0]) 114 model.lstm.bias_hh_l0 = nn.Parameter(manual_weights[:, 0]) 117 {"tensor_fqn": "lstm.weight_ih_l0"}, 118 {"tensor_fqn": "lstm.weight_hh_l0"}, 136 pruned = model.lstm.weight_ih_l0 141 pruned = model.lstm.weight_hh_l0 146 for pruned in [model.lstm.bias_ih_l0, model.lstm.bias_hh_l0]: 743 Test fusion support for LSTM(multi-layer) -> Linear [all …]
|
/aosp_15_r20/external/pytorch/torch/ao/nn/quantized/modules/ |
H A D | rnn.py | 6 "LSTM", 10 class LSTM(torch.ao.nn.quantizable.LSTM): class 11 r"""A quantized long short-term memory (LSTM). 13 For the description and the argument types, please, refer to :class:`~torch.nn.LSTM` 20 See examples in :class:`~torch.ao.nn.quantizable.LSTM` 26 ... nn.LSTM: nn.quantizable.LSTM, 29 ... nn.quantizable.LSTM: nn.quantized.LSTM, 35 _FLOAT_MODULE = torch.ao.nn.quantizable.LSTM # type: ignore[assignment] 46 "non-observed LSTM module. Please, see "
|