a74039320336c858a0b13f5161c0f7fda2f4922b,opennmt/tests/tflite_test.py,,_get_predictions,#Any#Any#Any#,32

Before Change


    pred_ids = tf.squeeze(tokens_to_ids.lookup(pred["tokens"]))
    tflite_concrete_fn = tf.function(
        model.infer_tflite,
        input_signature=[tf.TensorSpec([None], dtype=tf.dtypes.int32, name="ids")],
    ).get_concrete_function()
    tflite_pred_ids = tflite_concrete_fn(elem_ids)

After Change



    _, pred = model(elem)
    pred_ids = tf.squeeze(tokens_to_ids.lookup(pred["tokens"]))
    tflite_concrete_fn = model.tflite_function().get_concrete_function()
    tflite_pred_ids = tflite_concrete_fn(elem_ids)

    // Modify tflite ids tensor to be the same size as normal model output
    if tf.size(pred_ids) < tf.size(tflite_pred_ids):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: OpenNMT/OpenNMT-tf
Commit Name: a74039320336c858a0b13f5161c0f7fda2f4922b
Time: 2021-03-02
Author: guillaumekln@users.noreply.github.com
File Name: opennmt/tests/tflite_test.py
Class Name:
Method Name: _get_predictions


Project Name: OpenNMT/OpenNMT-tf
Commit Name: a36066dd6aa9012aed3774b658004f8e9d75d7af
Time: 2021-02-24
Author: guillaumekln@users.noreply.github.com
File Name: opennmt/utils/exporters.py
Class Name: TFLiteExporter
Method Name: _export_model


Project Name: tensorflow/transform
Commit Name: f2088b93ccffa6cb15e4662f23b6fc53f032f6c4
Time: 2020-07-07
Author: varshaan@google.com
File Name: tensorflow_transform/saved/saved_transform_io_v2.py
Class Name: SavedModelLoader
Method Name: __init__