Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

output method of convolutional net does not check input shape #4200

Closed
schrum2 opened this issue Oct 24, 2017 · 4 comments

Comments

@schrum2
Copy link

commented Oct 24, 2017

In version 0.9.1 of DL4J:

I've found that in a convolutional network, the "output" method will happily accept inputs with an incorrect shape. Specifically, set up a convolutional network using MultiLayerConfiguration and finalize it using

setInputType(InputType.convolutional(20, 10, 2)).build();

This network should accept inputs with height 20, width 10, and 2 channels. Then, I can create an input of all zeros like so:

double[] linearInputs = new double[400];
int[] inputShape = new int[] {1, 2, 20, 10};
INDArray input = Nd4j.create(linearInputs, inputShape, 'c');
INDArray output = model.output(input, false);

This will work fine. HOWEVER, the following code will also execute without error:

double[] linearInputs = new double[400];
int[] inputShape = new int[] {1, 2, 10, 20}; // <--- Just swapped order of 10 and 20
INDArray input = Nd4j.create(linearInputs, inputShape, 'c');
INDArray output = model.output(input, false);

The code should really throw an exception in the case where the input shape is incorrect.

@AlexDBlack AlexDBlack added the Bug label Oct 24, 2017

@AlexDBlack

This comment has been minimized.

Copy link
Contributor

commented Oct 24, 2017

Can you post the full network configuration you are using?
I was under the impression that this should be checked/handled already.

@schrum2

This comment has been minimized.

@AlexDBlack AlexDBlack self-assigned this Nov 27, 2017

AlexDBlack added a commit that referenced this issue Nov 27, 2017
@AlexDBlack

This comment has been minimized.

Copy link
Contributor

commented Nov 29, 2017

@AlexDBlack AlexDBlack closed this Nov 29, 2017

@lock

This comment has been minimized.

Copy link

commented Sep 24, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Sep 24, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants
You can’t perform that action at this time.