masahi commented on issue #5243: [Frontend][TensorFlow]Improve TensorFlow 
Static Shape Tensor Array
URL: https://github.com/apache/incubator-tvm/pull/5243#issuecomment-610052206
 
 
   Great I got the following working. Also confirmed `get_tensor_array_shape` 
worked. Happy now :) Thank you very much! Unwrapping should enable supporting 
the "stacked" LSTM in 
https://github.com/pytorch/pytorch/blob/master/benchmarks/fastrnns/custom_lstms.py#L252,
 where the output from `LSTMLayer` is pipelined `num_layers` times to get a 
bigger network. 
   
   ```Py
   def _tensor_array_stack(prelude):
       def _impl(inputs, input_types):
           shape = get_tensor_array_shape(inputs[0], "float32", prelude)
           stack = prelude.get_var_static('tensor_array_stack', "float32", 
shape)
           stacked = stack(inputs[0])
   
           stacked_shape = (Any(),) + shape
           static_tensor_array_ops = StaticTensorArrayOps(prelude, "float32", 
shape)
           static_tensor_array_ops.define_tensor_get_data(stacked_shape)
           # passing stacked_shape below gives "'Prelude' object has no 
attribute" error
           get_tensor = prelude.get_var_static('tensor_get_data', "float32", 
shape)
           return get_tensor(stacked)
       return _impl
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to