I am a newbe and i am stumped … probably simply because i am missing something obvious.
Trying to show images of the kernels in a cnn layer.
The following works fine:
kernels = model.cnn1.weights.detach().clone().cpu().view(-1, 3, 3)

#max = torch.max(kernels)
#min = torch.min(kernels)
#range = max - min
#kernels = (kernels - min) / range

kernels = kernels.numpy()

fig, ax = plt.subplots(4, 4)


row = -1
for j in range(16):
  if j%4 == 0:
    row += 1
    col = 0
  ax[row][col].imshow(kernels[j]).set_cmap('Greys')
  ax[row][col].axis('off')
  col += 1


Now if i uncomment the “scaling” lines in the code above. My Jupiter notebook tosses the following:
TypeError                                 Traceback (most recent call last)
 in ()
     17 
     18 row = -1
---> 19 for j in range(16):
     20   if j%4 == 0:
     21     row += 1

TypeError: 'Tensor' object is not callable

Confusing as j there are no tensors on line 19.
printing kernels prior to the loop shows are “scaled” just fine.
Appreciate any assistance to shed light upon my ignorance.