I am trying to train a model using tensorflow 1.15 with eager execution enabled. For train loss I am using
train loss = mse_loss*args.lmbda + bits_per_pixel_loss
I've defined the optimizer as below
main_optimiser = tf.train.AdamOptimiser(learning_rate=1e-3)
Upto here the code is working fine The error is coming in the minimizer part of the optimisation
main_step = main_optimiser.minimise(train_loss, global_step=step)
I'm getting the following error:
RuntimeError: `loss` passed to Optimizer.compute_gradients should be a function when eager execution is enabled.
So when I calculate train_loss inside a function say, loss_computer
, built inside the train function and then using
main_step =main_optimiser.minimise(loss_computer, global_step=step)
I am getting the following error:
AttributeError: 'NoneType' object has no attribute 'dtype'.
How can I train the model with eager execution enabled? Please let me know if I need to clarify anything. Any help is greatly appreciated, thank you!