Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Dec 7th, 2018 56 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. class CustomLoss():
  2.         def __init__(self, steps_per_epoch):
  3.             super().__init__()
  4.             self.steps_per_epoch = steps_per_epoch
  5.             self.step = 0
  6.  
  7.         def calc_custom_loss(self, y_true, y_pred):
  8.             y_true1 = get_y_true1(self.step)
  9.             y_true2 = get_y_true2(self.step)
  10.  
  11.             self.step += 1
  12.             self.step %= self.steps_per_epoch
  13.    
  14. # Assuming there are 100 batches in one epoch ...
  15. custom_loss = CustomLoss(steps_per_epoch=100)
  16. model.compile(loss=custom_loss.calc_custom_loss, ...)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top