Glau
Glau

Reputation: 131

How to reverse a shape in Keras for LSTM input

I have my input state with shape = (84,84,4)

state = Input(shape=(84,84,4), dtype="float")

It's stacked sequence of continuous frames.

I want to pass this state to the keras model as input, firstly - to TimeDistributed layers and then - to LSTM

as I understand, time step is the first dimension and I need to reshape my state appropriately to

shape=(4, 84, 84)

and holds the frames in their own size and topology

Upvotes: 2

Views: 704

Answers (1)

jeandut
jeandut

Reputation: 2514

state_t=tf.transpose(state,[2,1,0])

Is this what you are looking for ?
(or [2,0,1] that depends on what you wanna do...)

Upvotes: 5

Related Questions