mltk.core.TfliteUnidirectionalLstmLayer

class TfliteUnidirectionalLstmLayer[source]

UNIDIRECTIONAL_SEQUENCE_LSTM operation TfliteLayer

Properties

activation

Fused activation

cell_clip

Input tensor data

cell_gate_bias_tensor

Cell gate bias tensor of size {n_cell}

cell_layer_norm_coeff_tensor

(Optional) Layer norm coefficient tensor of size {n_cell}, representing a diagonal matrix

cell_state_tensor

The cell state tensor is defined as variable tensor, and will be modified at runtime

cell_to_forget_weights_tensor

(Optional) Peephole weights tensor of size {n_cell}, representing a diagonal matrix

cell_to_input_weights_tensor

(Optional) Peephole weights tensor of size {n_cell}, representing a diagonal matrix

cell_to_output_weights_tensor

(Optional) Peephole weights tensor of size {n_cell}, representing a diagonal matrix

forget_gate_bias_tensor

Forget gate bias tensor of size {n_cell}

forget_layer_norm_coeff_tensor

(Optional) Layer norm coefficient tensor of size {n_cell}, representing a diagonal matrix

index

Index of this layer in the model

input_data

Input tensor data

input_gate_bias_tensor

(Optional) Input gate bias tensor of size {n_cell}

input_layer_norm_coeff_tensor

(Optional) Layer norm coefficient tensor of size {n_cell}, representing a diagonal matrix

input_tensor

Input tensor of size {n_batch, n_input}

input_to_cell_weights_tensor

{n_cell, n_input}

input_to_forget_weights_tensor

{n_cell, n_input}

input_to_input_weights_tensor

{n_cell, n_input}

input_to_output_weights_tensor

{n_cell, n_input}

inputs

List of layer input tensor(s)

is_time_major

Return if this kernel uses time major or batch major

metadata

Additional key/value data to associated with layer

model

Reference to associated TfliteModel

n_cells

Number of LSTM cells

n_inputs

Return the number of inputs

n_outputs

Return the number of outputs

name

op<index>-<OpCodeStr>

opcode

OpCode numeric value

opcode_str

OpCode as a string

options

Layer-specific options/config

output_data

Output tensor data

output_gate_bias_tensor

Output gate bias tensor of size {n_cell}

output_layer_norm_coeff_tensor

(Optional) Layer norm coefficient tensor of size {n_cell}, representing a diagonal matrix

output_state_tensor

The output state tensor is defined as variable tensor, and will be modified at runtime

output_tensor

Output tensor data

outputs

List of layer output tensor(s)

proj_clip

Input tensor data

projection_bias_tensor

(Optional) Projection bias tensor of size {n_output}

projection_weights_tensor

(Optional) Projection weight tensor of size {n_output, n_cell}

recurrent_to_cell_weights_tensor

Recurrent weight tensor of size {n_cell, n_output}

recurrent_to_forget_weights_tensor

Recurrent weight tensor of size {n_cell, n_output}

recurrent_to_input_weights_tensor

(Optional) Recurrent weight tensor of size {n_cell, n_output}

recurrent_to_output_weights_tensor

Recurrent weight tensor of size {n_cell, n_output}

Methods

__init__

from_flatbuffer

Instantiate a TfliteLayer from then given TfliteModel flatbuffer operation

get_input_data

Get layer input tensor as np.ndarray

get_input_tensor

Get layer input tensor as TfliteTensor

get_output_data

Layer output tensor as np.ndarray

get_output_tensor

Layer output tensor as TfliteTensor

get_tensor_name_value_tuples

__init__(fb_operation, **kwargs)[source]
Parameters:

fb_operation (OperatorT) –

property options: TfliteUnidirectionalLstmLayerOptions

Layer-specific options/config

Return type:

TfliteUnidirectionalLstmLayerOptions

property activation: str

Fused activation

Return type:

str

property is_time_major: bool

Return if this kernel uses time major or batch major

Return type:

bool

property cell_clip: float

Input tensor data

Return type:

float

property proj_clip: float

Input tensor data

Return type:

float

property n_cells: int

Number of LSTM cells

Return type:

int

property input_tensor: TfliteTensor

Input tensor of size {n_batch, n_input}

Return type:

TfliteTensor

property input_data: ndarray

Input tensor data

Return type:

ndarray

property output_tensor: TfliteTensor

Output tensor data

Return type:

TfliteTensor

property output_data: ndarray

Output tensor data

Return type:

ndarray

property input_to_input_weights_tensor: TfliteTensor

{n_cell, n_input}

Type:

(Optional) Input weight tensor of size

Return type:

TfliteTensor

static from_flatbuffer(index, model, fb_operation)

Instantiate a TfliteLayer from then given TfliteModel flatbuffer operation

Return type:

TfliteLayer

Parameters:
  • index (int) –

  • model (TfliteModel) –

  • fb_operation (OperatorT) –

get_input_data(index=0)

Get layer input tensor as np.ndarray

Return type:

ndarray

get_input_tensor(index=0)

Get layer input tensor as TfliteTensor

Return type:

TfliteTensor

get_output_data(index=0)

Layer output tensor as np.ndarray

Return type:

ndarray

get_output_tensor(index=0)

Layer output tensor as TfliteTensor

Return type:

TfliteTensor

property index: int

Index of this layer in the model

Return type:

int

property input_to_forget_weights_tensor: TfliteTensor

{n_cell, n_input}

Type:

Input weight tensor of size

Return type:

TfliteTensor

property inputs: List[TfliteTensor]

List of layer input tensor(s)

Return type:

List[TfliteTensor]

property metadata: Dict[str, object]

Additional key/value data to associated with layer

NOTE: This information is generated by the framework/Python scripts

(i.e. The information does NOT come from the .tflite model)

Return type:

Dict[str, object]

property model: TfliteModel

Reference to associated TfliteModel

Return type:

TypeVar(TfliteModel)

property n_inputs: int

Return the number of inputs

Return type:

int

property n_outputs: int

Return the number of outputs

Return type:

int

property name: str

op<index>-<OpCodeStr>

Type:

Name of current layer as

Return type:

str

property opcode: BuiltinOperator

OpCode numeric value

Return type:

BuiltinOperator

property opcode_str: str

OpCode as a string

Return type:

str

property outputs: List[TfliteTensor]

List of layer output tensor(s)

Return type:

List[TfliteTensor]

property input_to_cell_weights_tensor: TfliteTensor

{n_cell, n_input}

Type:

Input weight tensor of size

Return type:

TfliteTensor

property input_to_output_weights_tensor: TfliteTensor

{n_cell, n_input}

Type:

Input weight tensor of size

Return type:

TfliteTensor

property recurrent_to_input_weights_tensor: TfliteTensor

(Optional) Recurrent weight tensor of size {n_cell, n_output}

Return type:

TfliteTensor

property recurrent_to_forget_weights_tensor: TfliteTensor

Recurrent weight tensor of size {n_cell, n_output}

Return type:

TfliteTensor

property recurrent_to_cell_weights_tensor: TfliteTensor

Recurrent weight tensor of size {n_cell, n_output}

Return type:

TfliteTensor

property recurrent_to_output_weights_tensor: TfliteTensor

Recurrent weight tensor of size {n_cell, n_output}

Return type:

TfliteTensor

property cell_to_input_weights_tensor: TfliteTensor

(Optional) Peephole weights tensor of size {n_cell}, representing a diagonal matrix

Return type:

TfliteTensor

property cell_to_forget_weights_tensor: TfliteTensor

(Optional) Peephole weights tensor of size {n_cell}, representing a diagonal matrix

Return type:

TfliteTensor

property cell_to_output_weights_tensor: TfliteTensor

(Optional) Peephole weights tensor of size {n_cell}, representing a diagonal matrix

Return type:

TfliteTensor

property input_gate_bias_tensor: TfliteTensor

(Optional) Input gate bias tensor of size {n_cell}

Return type:

TfliteTensor

property forget_gate_bias_tensor: TfliteTensor

Forget gate bias tensor of size {n_cell}

Return type:

TfliteTensor

property cell_gate_bias_tensor: TfliteTensor

Cell gate bias tensor of size {n_cell}

Return type:

TfliteTensor

property output_gate_bias_tensor: TfliteTensor

Output gate bias tensor of size {n_cell}

Return type:

TfliteTensor

property projection_weights_tensor: TfliteTensor

(Optional) Projection weight tensor of size {n_output, n_cell}

Return type:

TfliteTensor

property projection_bias_tensor: TfliteTensor

(Optional) Projection bias tensor of size {n_output}

Return type:

TfliteTensor

property output_state_tensor: TfliteTensor

The output state tensor is defined as variable tensor, and will be modified at runtime

Return type:

TfliteTensor

property cell_state_tensor: TfliteTensor

The cell state tensor is defined as variable tensor, and will be modified at runtime

Return type:

TfliteTensor

property input_layer_norm_coeff_tensor: TfliteTensor

(Optional) Layer norm coefficient tensor of size {n_cell}, representing a diagonal matrix

Return type:

TfliteTensor

property forget_layer_norm_coeff_tensor: TfliteTensor

(Optional) Layer norm coefficient tensor of size {n_cell}, representing a diagonal matrix

Return type:

TfliteTensor

property cell_layer_norm_coeff_tensor: TfliteTensor

(Optional) Layer norm coefficient tensor of size {n_cell}, representing a diagonal matrix

Return type:

TfliteTensor

property output_layer_norm_coeff_tensor: TfliteTensor

(Optional) Layer norm coefficient tensor of size {n_cell}, representing a diagonal matrix

Return type:

TfliteTensor