Use TimeDistributed+LSTM with variable input size

I want to use TimeDistributed+LSTM with variable input size

Input(shape=(None,None,1),name=‘the_input’) #not work

x = Conv2D(512,(3,3),strides=(1,1),padding='same',activation='relu',kernel_initializer='normal',name='rpn_conv1')(base_layers)

bilstm = Bidirectional(GRU(128,return_sequences=True),name='blstm')

x =TimeDistributed(bilstm,name='timedistributed')(x)

TypeError: Failed to convert object of type to Tensor. Contents: (-1, None, 512). Consider casting elements to a supported type.

when I fixed input size ,it’s work