Home
last modified time | relevance | path

Searched full:lstm (Results 1 – 25 of 541) sorted by relevance

12345678910>>...22

/external/tensorflow/tensorflow/lite/g3doc/examples/convert/
Drnn.md6 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 …]
/external/tensorflow/tensorflow/lite/kernels/
Dunidirectional_sequence_lstm_test.cc15 // 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 …]
Dbidirectional_sequence_lstm_test.cc15 // 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 …]
Dunidirectional_sequence_lstm.cc40 // 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 …]
Dlstm_test.cc15 // 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 …]
Doptional_tensor_test.cc15 // Unit test for TFLite LSTM op.
235 LSTMOpModel lstm(n_batch, n_input, n_cell, n_output, in TEST() local
266 lstm.SetInputToCellWeights({-0.49770179, -0.27711356, -0.09624726, 0.05100781, in TEST()
270 lstm.SetInputToForgetWeights({-0.55291498, -0.42866567, 0.13056988, in TEST()
274 lstm.SetInputToOutputWeights({0.10725588, -0.02335852, -0.55932593, in TEST()
278 lstm.SetCellBias({0., 0., 0., 0.}); in TEST()
280 lstm.SetForgetGateBias({1., 1., 1., 1.}); in TEST()
282 lstm.SetOutputGateBias({0., 0., 0., 0.}); in TEST()
284 lstm.SetRecurrentToCellWeights( in TEST()
290 lstm.SetRecurrentToForgetWeights( in TEST()
[all …]
/external/pytorch/torch/ao/nn/quantized/modules/
Drnn.py6 "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 "
/external/pytorch/torch/ao/quantization/fx/
Dlstm_utils.py18 # 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 …]
Dutils.py494 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 …]
/external/pytorch/torch/ao/pruning/_experimental/pruner/
Dprune_functions.py365 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 …]
/external/tensorflow/tensorflow/compiler/tests/
Dlstm_test.py15 """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 …]
Dlstm.py15 """A simple LSTM layer with benchmarks.
17 This sets up a simple LSTM (Long Short Term Memory) layer, unrolled to a fixed
18 length sequence. The only deviation from standard LSTM cells is that
39 """Returns the shape of the weights for a single LSTM cell."""
46 """Unrolls a single LSTM cell with clipped activations forward by one step.
65 # Element-wise ops for the standard LSTM cell, with clipped activations.
84 """Unrolls a layer of LSTM cells forward by the sequence length.
136 """Builds a single LSTM layer with random weights and inputs.
140 seq_length: The sequence length to unroll the LSTM layer.
141 num_inputs: Dimension of inputs that are fed into each LSTM cell.
[all …]
/external/tensorflow/tensorflow/lite/delegates/gpu/common/
Dlstm_parser.cc108 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 …]
/external/tensorflow/tensorflow/lite/tools/optimize/calibration/builtin_logging_ops/
Dlstm.cc15 #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 …]
/external/executorch/exir/backend/test/
Dhta_partitioner_demo.py32 patterns are: (lstm + conv) and (sub). backend is a class member instead of instance
44 Initialize a list of pattern partitioners: (lstm + conv) and (sub)
50 self.lstm = torch.nn.LSTM(
58 output, (hn, cn) = self.lstm(x_raw, (h, c))
136 [(0: A, B, C), (1: D, E, F)], # from pattern lstm + conv
171 [(0: A, B, C), (1: D, E, F)], # from pattern lstm + conv
212 …Similar to HTAPartitionerMultiplePatternDemo, the only difference is only one pattern (lstm + conv)
219 Initialize the parent class PatternPartitioner with the pattern (lstm + conv)
222 # Only lowering lstm + conv pattern
226 self.lstm = torch.nn.LSTM(
[all …]
/external/tensorflow/tensorflow/lite/tools/optimize/calibration/custom_logging_ops/
Dlstm.cc15 #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 …]
/external/pytorch/benchmarks/fastrnns/
Dfactory.py223 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 …]
Dcustom_lstms.py44 """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 …]
/external/armnn/src/backends/neon/workloads/
DNeonUnidirectionalSequenceLstmWorkload.cpp149 // 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 …]
DNeonUnidirectionalSequenceLstmFloatWorkload.cpp147 // 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 …]
/external/tensorflow/tensorflow/lite/examples/experimental_new_converter/
DKeras_LSTM_fusion_Codelab.ipynb11 …"This CodeLab demonstrates how to build a fused TFLite LSTM model for MNIST recognition using Kera…
13LSTM [CodeLab](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/examples/exper…
15 …ou can a build a much better model using CNN models. For a more canonical lstm codelab, please see…
46 "# Step 1: Build the MNIST LSTM model."
71 " tf.keras.layers.LSTM(20, time_major=False, return_sequences=True),\n",
190 " # Please note: TfLite fused Lstm kernel is stateful, so we need to reset\n",
204 "Let's check the model, you can see the LSTM will be in it's fused format.\n",
206 …"![Fused LSTM](https://raw.githubusercontent.com/tensorflow/tensorflow/master/tensorflow/lite/exam…
213 "name": "Keras LSTM fusion Codelab.ipynb",
/external/armnn/src/backends/cl/workloads/
DClUnidirectionalSequenceLstmFloatWorkload.cpp149 // 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 …]
/external/executorch/examples/models/lstm/
Dmodel.py22 logging.info("Loading LSTM model")
23 lstm = rnn.LSTM(10, 20, 2)
24 logging.info("Loaded LSTM model")
25 return lstm
/external/pytorch/test/cpp/api/
Drnn.cpp72 // 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 …]
/external/pytorch/aten/src/ATen/native/vulkan/ops/
DLstm.cpp2 #include <ATen/native/vulkan/ops/Lstm.h>
34 // (h_t) from the last layer of the LSTM, for each t
63 "Vulkan LSTM with projections is not supported"); in lstm_input()
66 "Vulkan LSTM expects 'params_cpu' size to be 4 * 'num_layers'."); in lstm_input()
68 input_vk.sizes().size() == 3, "Vulkan LSTM expects input dims to be 3."); in lstm_input()
71 "Vulkan LSTM expects hidden state dims to be 3."); in lstm_input()
74 "Vulkan LSTM expects cell state dims to be 3."); in lstm_input()
76 has_biases, "Vulkan LSTM expects 'has_biases' to be true."); in lstm_input()
77 TORCH_INTERNAL_ASSERT(!train, "Vulkan LSTM expects 'train' to be false."); in lstm_input()
79 !bidirectional, "Vulkan LSTM expects 'bidirectional' to be false."); in lstm_input()
[all …]

12345678910>>...22