opennmt/models/sequence_to_sequence.py
def infer_tflite(self, ids):
        """Runs a prediction, returns a 1-dim Tensor with the target ids it predicted, is TFLite safe.
        This is the function that gets converted was saving as a TFLite model

        Args:
          ids: A 1-dimensional tensor with the ids of the sentence you want to predict
        """
        ids = tf.expand_dims(ids, axis=0)
        source_inputs = self.features_inputter.tflite_call(ids)
        source_length = tf.convert_to_tensor([tf.math.count_nonzero(ids)])

        encoder_outputs, encoder_state, encoder_sequence_length = self.encoder(
            source_inputs, sequence_length=source_length, training=False
        )

        predictions = self._dynamic_decode(
            ids,
            encoder_outputs,
            encoder_state,
            encoder_sequence_length,
            tflite_run=True,
        )

        return predictions
Runs a prediction, returns a 1-dim Tensor with the target ids it predicted, is TFLite safe.
        This is the function that gets converted was saving as a TFLite model

        Args:
          ids: A 1-dimensional tensor with the ids of the sentence you want to predict
        
Runs a prediction, returns a 1-dim Tensor with the target ids it predicted, is TFLite safe.
This is the function that gets converted was saving as a TFLite model
Runs a prediction returns a 1 - dim Tensor with the target ids it predicted is TFLite safe . This is the function that gets converted was saving as a TFLite model
def infer_tflite(self, ids):
        ids = tf.expand_dims(ids, axis=0)
        source_inputs = self.features_inputter.tflite_call(ids)
        source_length = tf.convert_to_tensor([tf.math.count_nonzero(ids)])
        encoder_outputs, encoder_state, encoder_sequence_length = self.encoder(
            source_inputs, sequence_length=source_length, training=False
        )
        predictions = self._dynamic_decode(
            ids,
            encoder_outputs,
            encoder_state,
            encoder_sequence_length,
            tflite_run=True,
        )
        return predictions
def infer_tflite ( self , ids ) : ids = tf . expand_dims ( ids , axis = 0 ) source_inputs = self . features_inputter . tflite_call ( ids ) source_length = tf . convert_to_tensor ( [ tf . math . count_nonzero ( ids ) ] ) encoder_outputs , encoder_state , encoder_sequence_length = self . encoder ( source_inputs , sequence_length = source_length , training = False ) predictions = self . _dynamic_decode ( ids , encoder_outputs , encoder_state , encoder_sequence_length , tflite_run = True , ) return predictions
Runs a prediction, returns a 1-dim Tensor with the target ids it predicted, is TFLite safe.
Runs a prediction returns a 1 - dim Tensor with the target ids it predicted is TFLite safe .
"""Runs a prediction, returns a 1-dim Tensor with the target ids it predicted, is TFLite safe.
        This is the function that gets converted was saving as a TFLite model

        Args:
          ids: A 1-dimensional tensor with the ids of the sentence you want to predict
        """
self
ids
A 1-dimensional tensor with the ids of the sentence you want to predict
A 1 - dimensional tensor with the ids of the sentence you want to predict