Convolutions for Images

1 Like

Help me please, I tried using our defined Conv2D class in place of tf.keras.layers.Conv2D. Whenever I specify kernel_size (1, 2) by calling build method on instance of our defined Conv2D class, it works. But then when I call conv2d(X) with X.shape is (1, 6, 8, 1), the weight kernel_size is re initialized to have the shape as X. Is build method called again inside call method? Help me please, thank you. @mli

Y_hat computation on section 6.2.4 Learning a Kernel has been repeated. Y_hat computation just above for loop can be omitted.

In the Learning a Kernel section, what’s the purpose to multiply a factor 3e-2 to the gradient in the update step.

I think, 3e-2 is the “learning rate”, which controls the velocity to update.

1 Like

Hi @qyqstc, great catch! Just fixed in

Thanks for the timely reply!!!

the velocity to optim…


When I use different X, especially when X is large such as a 120*120 matrix, the kernel learning algorithm(section 6.2.4) explodes and makes a large numbers for loss functions and weights. Can you explain why it happens?



You can remove the build method of Conv2d as we can move the ‘build’ method implementation in to the ‘init’ section and have ‘kernel_size’ as a initialization parameter like shown below

While implementing autodiff for the Conv2d, g.gradient fails to extract gradients for the weight

and spews the error message " ValueError : Attempt to convert a value (None) with an unsupported type (<class ‘NoneType’>) to a Tensor."

Is the exercise supposed to demonstrate this?