How to use numpy functions on a keras tensor in the loss function? How to use numpy functions on a keras tensor in the loss function? numpy numpy

How to use numpy functions on a keras tensor in the loss function?


The direct using of this numpy function is impossible - as it's not implemented in neither Tensorflow nor Theano. Moreover - there is no a direct correspondence between tensors and arrays. Tensors should be understood as an algebraic variables whereas numpy arrays as numbers. tensor is an abstract thing and applying a numpy functions to it is usually impossible.

But you could still try to reimplement this function on your own using keras.backend functions. Then you'll use the valid tensor operations and no problem should be raised.