One: Compiler FE: Enable LSTM operator

Created on 26 May 2020  路  13Comments  路  Source: Samsung/ONE

  • [ ] tflchef
  • [ ] luci.IR
  • [ ] luci.Import
  • [ ] luci.Export
  • [ ] luci.logex
  • [ ] luci.Service
  • [ ] res/TensorFlowPythonExamples
  • [ ] res/TensorFlowLiteRecipes
  • [ ] tflite2circle
  • [ ] luci.tests
  • [ ] tfldump
  • [ ] circledump

for #1167

postponed

Most helpful comment

For tf.keras.layers.LSTM:
lstm_keras_02

All 13 comments

@d-krylov , @binarman , how is this going?

Sorry, this operator isn't easy in implementation for me. Now I work on implementation in luci.

Yes, I also think this isn't easy. Like the RNN op (#1712), we are not sure how this operator is going to be used.
If you've got some clear diections, it is OK to proceed.
If there are undecided things that are holding you, could you please add some notes about it?
@lemmaa and I had a short talk and we decided it is OK to hold this Op for a while (postpone)
The note you leave will be some reminder when we continue this task.

I made example.

import tensorflow as tf
import numpy as np

tf.compat.v1.reset_default_graph()
tf.compat.v1.disable_eager_execution()
tf.compat.v1.disable_v2_behavior()

num_units = 1
lstm = tf.compat.v1.nn.rnn_cell.LSTMCell(num_units = num_units)
batch=1
timesteps = 1
num_input = 1
X = tf.compat.v1.placeholder("float", [batch, timesteps, num_input])
x = tf.unstack(X, timesteps, 1)
outputs, states = tf.compat.v1.nn.static_rnn(lstm, x, dtype=tf.float32)

sess = tf.compat.v1.Session()
init = tf.compat.v1.global_variables_initializer()
sess.run(init)

converter = tf.compat.v1.lite.TFLiteConverter.from_session(sess, x, outputs)
tflite_model = converter.convert()
open("LSTM.tflite", "wb").write(tflite_model)

And got:

LSTM

For tf.keras.layers.LSTM:
lstm_keras_02

FYI, you can get a recipe from build/compiler/tflchef/tools/reverse/tflchef-reverse

build/compiler/tflchef/tools/reverse/tflchef-reverse LSTM.tflite LSTM.recipe

If something goes wrong, we need to fix it, but you don't have to. you can write down as you've done manually.

For tf.keras.layers.LSTM:

The gray ones seems to be CustomOp...

I made example.

This example seems to be for one LSTM cell... so there is no loop or control flow.

This example seems to be for one LSTM cell... so there is no loop or control flow.

This what we want actually. Get minimal example to experiment with.

@d-krylov , @binarman , if it's OK with you guys, can we postpone this Op?
We need to check our customer how this Op is going to be used.

@seanshpark

if it's OK with you guys, can we postpone this Op?

We discussed, and have no objections. =)

We discussed, and have no objections. =)

OK, I'll mark in #1167 as postpone :)

Nothing to do in this task so far.
For more info see #4528

Was this page helpful?
0 / 5 - 0 ratings