tensorflow / tensorflow/probability

Where exactly are the KL losses used after the forward pass?

Open
#885 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

layers
Dominant language
Jupyter Notebook
Stars
4.4k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

I've noticed that the KL part of the loss is added to the list self._losses of the Layer class when self.add_loss is called from the call method of the DenseVariational (i.e. during the forward pass).

But how is this list self._losses (or the method losses of the same Layer class) treated during training? Where is it called from during training?

I would like to know how exactly these losses are combined with the loss that you specify in the fit method. Can you provide me to the code that combines them?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with keras/engine/base_layer.py at Layer._losses and the DenseVariational.call implementation in tensorflow_probability/python/layers/dense_variational.py. Trace the training entry point used by fit and identify where Layer.losses is combined with the user-specified loss. Done means documenting those call paths and the combination behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.