Skip to content

How to get regularizer loss in Eager Mode? #4

@Johnson-yue

Description

@Johnson-yue

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions