C5 W1 A3: How do you slice a 3D keras array?

I have a 3D Keras array named ‘X’. If I print its shape, I get:

print(X.shape)
>>> (None, 30, 90)

I am asked to slice this 3D Keras array and turn it into this shape: (90,) (so I want to isolate the last dimension)

How do I do this?

I have tried using this (which would work if it was a 3D numpy array): X[:,t,:], but since I’m using Keras I get:

print(X[:,t,:].shape)
>>> (None, 90)

Any suggestions?

Which week and assignment are you working on?

1 Like

C5, W1, A3

The one in which you create jazz music

If you’re on Step 2.A, it’s this code:
x = X[:,t,:]

1 Like

That’s what I was using yesterday and it didn’t work. For some reason, clicked on ‘run’ today and it just worked :man_shrugging: