tflite-micro
tflite-micro copied to clipboard
Failed to get restistration from op code REVERSE_V2
I've searched through schema_generated.h and it seems like REVERSE_V2 is given Op Code 105 and included in the BuiltInOperator enumerations, however there's no reference implementation provided in /micro/kernels. Without REVERSE_V2, I am unable to implement a simple keras bidirectional LSTM.
Are there any plans to complete the implementation of REVERSE_V2? All the other op codes are implemented (even if they're not included in AllOpsResolver) except REVERSE_V2.
Thanks!
I'm having the same issue. Any progress or is there a workaround?
I also have this problem, how did you solve it in the end?
I also have this problem, have you guys solve the problem?
I think you should start by following the following document porting_reference_ops.md to port reverseV2 to micro tflite and change the name of the issue to "micro: port op REVERSE_V2 from lite" .
I started on my side in local but impossible to execute the command "bazel test tensorflow/lite/kernels:all"
"This issue is being marked as stale due to inactivity. Remove label or comment to prevent closure in 5 days."
"This issue is being closed because it has been marked as stale for 5 days with no further activity."
Hello there! Any updates on this?
I found a solution that works for me.
It consists of splitting the bidirectional RNN layer into two unidirectional layers. Then, perform the reverse operations manually with slicing operators, which are supported in TFLM, and concatenate the outputs together.
from tensorflow.keras.layers import GRU, Concatenate
def manual_reverse(x, axis):
return x[..., ::-1, :] if axis == 1 else x[::-1]
# Define numer of GRU cell units
units = 10
# Forward GRU
forward_gru = GRU(units, return_sequences=True)(x)
# Backward GRU (reverse input sequence manually)
reversed_input = manual_reverse(x, axis=1)
backward_gru = GRU(units, return_sequences=True)(reversed_input)
# Reverse backward output back to original order
backward_gru_reversed = manual_reverse(backward_gru, axis=1)
# Concatenate forward and backward outputs
output_frgu = Concatenate()([forward_gru, backward_gru_reversed])
[internal: see #3052 for @rkuester implementation prior to REVERSE_V2 being added to TfLite]
Implemented with PR #3123