To reshape data into 3D

I am creating BiLSTM model for predictin but I fail to fit the model using tensor flow, it need 3D and my data is 2D, Anyone know how to reshape data to 3D

Hi @Fatna_saeed, You can use tf.reshape( ) to covert 2d to 3d.

For example, I have 2d tensor defined as

two_dim_tensor=tf.Variable([[1.],
                            [2.]])

#To convert it to 3d you can use tf.reshape and pass the tensor that you need to convert and add the desired shape

converting_2d_to_3d=tf.reshape(two_dim_tensor,[1,1,2])

#or you can use tf.expand_dims 

tf.expand_dims(two_dim_tensor, axis=0) 

Thank You.