tensorflow / lucid

A collection of infrastructure and tools for research in neural network interpretability.
Apache License 2.0
4.65k stars 655 forks source link

ValueError: high is out of bounds for int32 #291

Closed dokluch closed 3 years ago

dokluch commented 3 years ago

I am setting up a conda environment on Windows to try lucid. tf is 1.15, numpy is 1.19. However, I keep getting the following error while trying to do all the imports. I've found a related issue that is closed now, but unfortunately it doesn't seem to affect my https://github.com/tensorflow/lucid/issues/53

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_21280/3916648198.py in <module>
      6 from lucid.misc.io import show
      7 import lucid.optvis.objectives as objectives
----> 8 import lucid.optvis.param as param
      9 import lucid.optvis.render as render
     10 import lucid.optvis.transform as transform

~\.conda\envs\lucid\lib\site-packages\lucid\optvis\param\__init__.py in <module>
     14 # ==============================================================================
     15 
---> 16 from lucid.optvis.param.images import image
     17 from lucid.optvis.param.lowres import lowres_tensor
     18 from lucid.optvis.param.color import to_valid_rgb

~\.conda\envs\lucid\lib\site-packages\lucid\optvis\param\images.py in <module>
     21 import tensorflow as tf
     22 
---> 23 from lucid.optvis.param.color import to_valid_rgb
     24 from lucid.optvis.param.spatial import naive, fft_image
     25 

~\.conda\envs\lucid\lib\site-packages\lucid\optvis\param\color.py in <module>
     20 import tensorflow as tf
     21 
---> 22 from lucid.optvis.param.unit_balls import constrain_L_inf
     23 
     24 color_correlation_svd_sqrt = np.asarray([[0.26, 0.09, 0.02],

~\.conda\envs\lucid\lib\site-packages\lucid\optvis\param\unit_balls.py in <module>
     48 
     49 
---> 50 @use_gradient(_constrain_L2_grad)
     51 def constrain_L2(x):
     52   return x / tf.maximum(1.0, tf.norm(x))

~\.conda\envs\lucid\lib\site-packages\lucid\misc\gradient_override.py in use_gradient(grad_f)
    124 
    125   """
--> 126   grad_f_name = register_to_random_name(grad_f)
    127 
    128   def function_wrapper(f):

~\.conda\envs\lucid\lib\site-packages\lucid\misc\gradient_override.py in register_to_random_name(grad_f)
     68     String that gradient function was registered to.
     69   """
---> 70   grad_f_name = grad_f.__name__ + "_" + hex(np.random.randint(0, 1e10))[2:]
     71   tf.RegisterGradient(grad_f_name)(grad_f)
     72   return grad_f_name

mtrand.pyx in numpy.random.mtrand.RandomState.randint()

_bounded_integers.pyx in numpy.random._bounded_integers._rand_int32()

ValueError: high is out of bounds for int32