AttributeError: 'property' object has no attribute 'strip'

Hello, I am building a DQN to train on a game, but during the model.fit() process, I get this error:

AttributeError: 'property' object has no attribute 'strip'

It comes from:

\anaconda3\lib\site-packages\tensorflow\python\keras\losses.py:118 _set_name_scope
        self._name_scope = self.name.strip('_')

Does anyone know how to fix this? The loss I am using is MeanSquaredError, though I don’t think that has anything to do with it.Thanks!

@Harry_Wang,

Welcome to the Tensorflow Forum!

Which version of Tensorflow are you using? Please share minimal standalone code to replicate the above issue. Thank you!

I had the exact same Problem today:

while compiling the model I used something like this:

model.compile(loss=keras.metrics.SparseCategoricalCrossentropy, optimizer=keras.optimizers.SGD(), metrics=[keras.metrics.sparse_categorical_crossentropy])

changing it to

model.compile(loss=keras.losses.sparse_categorical_crossentropy, optimizer=keras.optimizers.SGD(), metrics=[keras.metrics.sparse_categorical_crossentropy])

solved it.