I am working on creating a custom loss function in Keras. Here is an example.
import keras.backend as K
def test(y_true, y_pred):
loss = K.square(y_pred - y_true)
loss = K.mean(loss, axis = 1)
return loss
Now in this example, I would like to only subtract let's say specific values from y_pred, but since this is in tensorflow, how do I iterate throw them.
For example, can I iterate through y_pred to pick values? and how? Lets say for this example, the batch size is 5.
I have tried things such as y_pred[0...i] tf.arange and many more...