Do you want just to Reduction.None like in

  

      github.com
  

  
    keras-team/keras/blob/master/keras/losses.py#L546-L547



      
      
          >>> bce = tf.keras.losses.BinaryCrossentropy(from_logits=True,
          ...     reduction=tf.keras.losses.Reduction.NONE)
      
    
  


  

  
    
    
  

  


And then apply your custom operation?