tensorflow-eager-tutorials icon indicating copy to clipboard operation
tensorflow-eager-tutorials copied to clipboard

How to get regularizer loss in Eager Mode?

Open Johnson-yue opened this issue 7 years ago • 0 comments

Hi, this me again.

I have an question about reg_loss .

The total_loss should be equal to reg_loss + softmax_loss ,but I do not know how to get reg_loss .

I have configure parameter of Conv2D(kernel_regularizer= tf.keras.regularizers.l2) like this demo but when the compute the loss of this mode compute loss . loss only compute softmax_loss, where is reg_loss , and how to get it for computing gradients??

I also use tf.get_total_loss() API but I do not know useful or not?

Johnson-yue avatar Jul 30 '18 08:07 Johnson-yue