Hi @fracek,
I'm having an issue with figuring out whether the input tensor x should be reshaped to the layer's input_size (as opposed to keeping it as the input layer's output shape) before being passed to Layer._eval. Right now this is what happens, in neuralnet/layer.py::90-93 (in Layer.eval). This reshaping also seems to be what is assumed by the dense layer code.
However, the convolutional layer code seems to assume this reshaping should not happen. In neuralnet/layer.py::296 (in ConvLayer._eval), x[index] is used to access elements of the input tensor x, x being the reshaped tensor passed to Layer._eval.
However, index here is yielded from the ConvLayer.kernel_with_input_indexes generator. At neuralnet/layer.py::265, this index is mapped back to an input layer output index. Since this index is used to index x, this would suggest x should not be reshaped, as should remain the input layer output shape.
As a result, the status quo (reshaping x before passing it to Layer._eval) keeps the dense layer code fine but breaks convolutional layer code with index mapping. Not reshaping x fixes this issue but then breaks the dense layer code.
I cannot figure out whether the convolutional layer assumption or the dense layer assumption is the one I should be using, as index mapping is not thoroughly covered by the tests for the input and convolutional layers. Any help would be greatly appreciated! :)
Hi @fracek, I'm having an issue with figuring out whether the input tensor
x
should be reshaped to the layer'sinput_size
(as opposed to keeping it as the input layer's output shape) before being passed toLayer._eval
. Right now this is what happens, in neuralnet/layer.py::90-93 (inLayer.eval
). This reshaping also seems to be what is assumed by the dense layer code. However, the convolutional layer code seems to assume this reshaping should not happen. In neuralnet/layer.py::296 (inConvLayer._eval
),x[index]
is used to access elements of the input tensorx
,x
being the reshaped tensor passed toLayer._eval
. However,index
here is yielded from theConvLayer.kernel_with_input_indexes
generator. At neuralnet/layer.py::265, this index is mapped back to an input layer output index. Since this index is used to indexx
, this would suggestx
should not be reshaped, as should remain the input layer output shape. As a result, the status quo (reshapingx
before passing it toLayer._eval
) keeps the dense layer code fine but breaks convolutional layer code with index mapping. Not reshapingx
fixes this issue but then breaks the dense layer code. I cannot figure out whether the convolutional layer assumption or the dense layer assumption is the one I should be using, as index mapping is not thoroughly covered by the tests for the input and convolutional layers. Any help would be greatly appreciated! :)