2021年1月28日星期四

Using MaxPool1D on inputs with 4 dimensions (4D tensor)?

I am trying to create a NN architecture for multiple instance learning, so the instances are actually bags of of time series segments. I would like to do COnv1D and MaxPool1D over the features (last dimension), I specify input as having 4 dimensions and that works fine for Conv1D but throws an error with MaxPool1D:

n = 6  sample_size = 300  code_size = 50  learning_rate = 0.001  bag_size = None    # autoencoder: n_bags X bag_size X n_samples (timesteps) X n_measurements  input_window = Input(shape=(bag_size,sample_size, n))   x = Conv1D(filters=40, kernel_size=21, activation='relu', padding='valid')(input_window)  x = MaxPooling1D(pool_size=2)(x)  

The error is:

ValueError: Input 0 of layer max_pooling1d_4 is incompatible with the layer: expected ndim=3, found ndim=4. Full shape received: [None, None, 280, 40]  

According to MaxPool1D only works on 3D tensors. Is there a work-around?

https://stackoverflow.com/questions/65945784/using-maxpool1d-on-inputs-with-4-dimensions-4d-tensor January 29, 2021 at 05:54AM

没有评论:

发表评论