A thing I hear sometimes: "what if my loss doesn't match the signature loss = fn(y_true, y_pred)?" This is not a requirement in Keras -- it's only the default setting. If you have a loss with multiple inputs/targets, here are your options, in order of preference: (a thread)
-
-
2. Override the `train_step` method of your Model class to implement your custom loss. Guide: https://keras.io/guides/customizing_what_happens_in_fit/ … A few examples: Metric learning: https://keras.io/examples/vision/metric_learning/ … Vanilla GAN: https://keras.io/examples/generative/dcgan_overriding_train_step/ … WGAN-GP: https://keras.io/examples/generative/wgan_gp/ … CycleGAN: https://keras.io/examples/generative/cyclegan/ …
Show this thread -
3. Write a custom training loop from scratch. Guide: https://keras.io/guides/writing_a_training_loop_from_scratch/ … Remember that Keras defaults are only meant to cover the most common workflows -- for anything else, you have a range of increasingly advanced options. We call it "progressive disclosure of complexity"
Show this thread
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.