Hi Marc!



 inquest:

I am a newbe and i am stumped … probably simply because i am missing something obvious.
…
...
#range = max - min
...
for j in range(16):
...

Now if i uncomment the “scaling” lines in the code above. My Jupiter notebook tosses the following:
TypeError                                 Traceback (most recent call last)
 in ()
...
---> 19 for j in range(16):
...
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.


This is really a python issue – not specific to pytorch.
range = max - min

This line (when uncommented) sets range to (refer to)
max - min, which, in this case, is a pytorch tensor.
Then when you try to execute
for j in range(16):

range no longer refers to the built-in python “range” function,
and the thing it does refer to (a pytorch tensor) is, indeed, not
callable.
Easy fix:  Change the name of your max - min variable to
something else.  Perhaps my_max_min_range_not_pythons?
The following pure python script shows this general behavior:
range = 'Marc'
print (range)
for  i in range (5):
    print (i)

(I consider this kind of thing to be a weakness in python.  Who
has time to worry about tripping over such things?)
Best regards.
K. Frank