How to generate 2D tensor from a tensorflow 2D tensor with getting elements only at indexes of (3n+2) along axis=1

  deep-learning, keras, machine-learning, python, tensorflow
def my_loss_fn(y_true, y_pred):
     squared_difference = tf.math.abs(y_true - y_pred)
     squared_difference=tf.math.reduce_sum(squared_difference,axis=-1)
     return tf.reduce_mean(squared_difference, axis=-1)

i want to build a custom loss function which checks only specific positions of a output tensor and based on some condition return the loss to optimizer

Source: Python Questions

LEAVE A COMMENT