consider the given example. say output channel is m and input channel is n. The filter size will be 3x3xm. now we just need to repeat the process described in the video on n input channels. number of parameters will be (3x3xm + 1) x n
“There’s a mistake, this result isn’t possible. Normally, we should get 3x3 as the output and not 4x4, so his method is at least questionable. It just goes to show that even the great Ng can be wrong.”
@@GAZ___ "I had some doubt because the formula for calculating the output of a transposed convolution is as follows: 𝑂=(𝐼−1)×𝑠 + 𝐾 −2𝑝 = (2-1)*2 + 3 -2*1= 3 "I thought it wasn’t possible, so I did the calculation with PyTorch and got the same result. The output is a (3,3) ." import torch from torch import nn Input = torch.tensor([[2.0, 1.0], [3.0, 2.0]]) Kernel = torch.tensor([[1.0, 2.0,1.0], [2.0, 0.0,1.0],[0.0,2.0,1.0]]) Input = Input.reshape(1, 1, 2, 2) Kernel = Kernel.reshape(1, 1, 3, 3) Transpose convolution Layer Transpose = nn.ConvTranspose2d(in_channels =1, out_channels =1, kernel_size=3, stride = 2, padding=1, bias=False)
# Initialize Kernel Transpose.weight.data = Kernel # Output value Transpose(Input) tensor([[[[ 0., 4., 0.], [10., 7., 6.], [ 0., 7., 0.]]]], grad_fn=) If I'm wrong, please correct me
very clear thank you
very clear! thank you
why the output is 4*4 ? please explain
How is Transpose Convolutions performed in 2D images with multiple channels?
I also have the same doubt...can anybody please elaborate
consider the given example. say output channel is m and input channel is n. The filter size will be 3x3xm. now we just need to repeat the process described in the video on n input channels. number of parameters will be (3x3xm + 1) x n
Stride 1..?
it's the same output, the input no changes, I think
“There’s a mistake, this result isn’t possible. Normally, we should get 3x3 as the output and not 4x4, so his method is at least questionable. It just goes to show that even the great Ng can be wrong.”
What
@@GAZ___ "I had some doubt because the formula for calculating the output of a transposed convolution is as follows:
𝑂=(𝐼−1)×𝑠 + 𝐾 −2𝑝 = (2-1)*2 + 3 -2*1= 3
"I thought it wasn’t possible, so I did the calculation with PyTorch and got the same result. The output is a (3,3) ."
import torch
from torch import nn
Input = torch.tensor([[2.0, 1.0], [3.0, 2.0]])
Kernel = torch.tensor([[1.0, 2.0,1.0], [2.0, 0.0,1.0],[0.0,2.0,1.0]])
Input = Input.reshape(1, 1, 2, 2)
Kernel = Kernel.reshape(1, 1, 3, 3)
Transpose convolution Layer
Transpose = nn.ConvTranspose2d(in_channels =1,
out_channels =1,
kernel_size=3,
stride = 2,
padding=1,
bias=False)
# Initialize Kernel
Transpose.weight.data = Kernel
# Output value
Transpose(Input)
tensor([[[[ 0., 4., 0.],
[10., 7., 6.],
[ 0., 7., 0.]]]], grad_fn=)
If I'm wrong, please correct me
You are right!
he isn't, also don't get why but my professor does it the same.. if anyone gets why lmk:)
The answer is 4x4 because of the kernel, and the parameters padding and stride. You can also get a 3x3 if you use a 2x2 kernel