Closed m-rph closed 4 years ago
tl.Conv2d
returns 4D
tensor of shape [batch, channels, width, height]
, after flatten
it becomes [batch, channels * width * height]
which is quite standard practice.
This goes into torch.nn.Linear
. If you flatten everything is correctly inferred (in_features
will be channels * width * height
). Please beware of images of different size as it will not work due to stride
different than 1
.
torch.nn.Linear
supports any size of tensor though so torchlayers
should infer size of last dimension instead of first as it is currently done. This should be resolved soon, will close this issue when it lands in nightly
.
Hi
I am trying to build the following:
but I am getting
It works just fine with
flatten
right before the linear.