Skip to content

Specify 'None' as Shape dimension #231

@ordinaryorange

Description

@ordinaryorange

I'm trying to do a Conv1D layer with variable features

1st attempt

let model = new Sequential()
model.Add(new Input(Shape(3)))
model.Add(new Conv1D(50, 1 ))

Error: Python.Runtime.PythonException: ValueError : Input 0 of layer "conv1d_9" is incompatible with the layer: expected min_ndim=3, found ndim=2. Full shape received: (None, 3)

2nd attempt setting the batch_shape arg (thinking the batch size will fix it)

let model = new Sequential()
model.Add(new Input(Shape(3), Shape(1)))
model.Add(new Conv1D(50, 1 ))

Error: Python.Runtime.PythonException: ValueError : Only provide the shape OR batch_input_shape argument to Input, not both at the same time.

According to this issue batch_size is being depreciated from tensorflow. So I figure that is the reason for the latter python error.

I've looked at the design of the Shape class and in it's current form and it only takes int types so dead end there.

The first error suggests that internally within Keras.NET a conversion is being done to emit (None,3) to python but in my brief look I cant see how.

Suggestions for a work around ?
Or even a pointer to the section of code in Keras.NET that does the shape conversion, so I can hack in something local ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions