a guest Dec 7th, 2018 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- class CustomLoss():
- def __init__(self, steps_per_epoch):
- self.steps_per_epoch = steps_per_epoch
- self.step = 0
- def calc_custom_loss(self, y_true, y_pred):
- y_true1 = get_y_true1(self.step)
- y_true2 = get_y_true2(self.step)
- self.step += 1
- self.step %= self.steps_per_epoch
- # Assuming there are 100 batches in one epoch ...
- custom_loss = CustomLoss(steps_per_epoch=100)
- model.compile(loss=custom_loss.calc_custom_loss, ...)
RAW Paste Data