Search code examples
pythonkerasgpuinitializer

ImportError: cannot import name 'HeNormal' from 'keras.initializers'


If I try to run the line

from keras.initializers import HeNormal

I get the error message

ImportError: cannot import name 'HeNormal' from 'keras.initializers'

I'm in a conda environment where I installed keras-gpu with

conda install -c anaconda keras-gpu

and from

import keras
keras.__version__

I get

'2.3.1'

How can I solve this?


Solution

  • I solved by replacing HeNormal with he_normal, since in initializers.py it was defined in this way.

    I don't know why since in all the other devices I can import it with HeNormal