Could you help me creating an equivalent layer of Keras Dense (128,7,7), hence outputting a 3D (128,7,7) layer ? thank you very much.
nn.Linear(in_features=100, out_features=(128,7,7), bias=True), but I don’t know if this is correct.
I’m working on DCGAN, and my input z is of 100 size.
Thank you very much
Could you explain, how this layer is applied, i.e. what input shape is expected and how is the weight parameter applied to the input?
I can’t find any information in the Keras docs about these multi-dimensional shapes.
Sorry, I’m still new to using Keras and Pytorch.
My input layer is of 100 dim, the output should be of
128*7*7 dimensions (tensor), I’ve tempted
nn.Linear(in_features=100, out_features=128*7*7, bias=True) which seemed working, I saw it in other notebooks, but I can’t figure out this syntax,
128*7*7. Is this a correct syntax ? Why isn’t it interpreted as
In your code snippet,
128*7*7 is interpreted as
The way to write the input shape as a multiplication makes instead of the result directly makes it easier to understand the shape.
E.g. when this linear layer is preceded by conv layers, you would flatten the conv activation, so that it’ll have the shape
[batch_size, channels*height*width]. In this case it’s clear to define
channels*height*width or in your case
However, in the Keras code these numbers are not multiplied, but seem to be passed as a multi-dimensional shape?
Note that I’m not deeply familiar with Keras, so my interpretation might be wrong.