Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cast KERAS Tensor to K.tf.int32

This is from a Custom Keras Callback casted=K.cast((yPred), K.tf.int32)

I absolutely need to cast yPred, which is a Tensor, to the type int32 (The cast is applied to the Tensor content, I know that)

Still, K.cast allow only a conversion to float.

How can I solve the problem?


1 Answers

This is how you do it:

casted = K.cast(yPred,"int32")
like image 60
Daniel Möller Avatar answered Sep 14 '25 11:09

Daniel Möller