Skip to content

Issue with MaxPooling1D #969

@AdrienDeverin

Description

@AdrienDeverin

Dear Community,
I have a problem when trying to add a MaxPooling1D layer in any of my models.

Here an exemple which work in python but not in c# ():

var t = tf.constant(new int[] { 1, 2, 3, 4, 5 });
t = tf.reshape(t, (1, 5, 1));
Tensor max_pool_1d = keras.layers.MaxPooling1D(pool_size: 2, strides: 1, padding : "valid").Apply(t);
NDArray array = max_pool_1d.numpy();

I'm really confused by the error I get (l.3) :

Tensorflow.InvalidArgumentError : 'Length for attr 'strides' of 3 must be at least minimum 4
; NodeDef: {{node MaxPool}}; Op<name=MaxPool; signature=input:T -> output:T; attr=T:type,default=DT_FLOAT,allowed=[DT_HALF, DT_BFLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT32, DT_INT64, DT_UINT8, DT_INT16, DT_INT8, DT_UINT16, DT_QINT8]; attr=ksize:list(int),min=4; attr=strides:list(int),min=4; attr=padding:string,allowed=["SAME", "VALID", "EXPLICIT"]; attr=explicit_paddings:list(int),default=[]; attr=data_format:string,default="NHWC",allowed=["NHWC", "NCHW", "NCHW_VECT_C"]>

Even if I didn't understand why the argument "strides" should be >= 4, change it to this value send the same mistake.

Note : I didn't get any problems in the case of 2D or even 3D pooling.

Thanks,

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions