File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 2929from tensordict .utils import NestedKey
3030from torch import distributions as d
3131
32- from torchrl ._utils import _standardize , logger as torchrl_logger
32+ from torchrl ._utils import _standardize , logger as torchrl_logger , VERBOSE
3333from torchrl .objectives .common import LossModule
3434from torchrl .objectives .utils import (
3535 _cache_values ,
@@ -564,14 +564,16 @@ def _get_entropy(
564564 entropy = dist .entropy ()
565565 if not entropy .isfinite ().all ():
566566 del entropy
567- torchrl_logger .info (
568- "Entropy is not finite. Using Monte Carlo sampling."
569- )
567+ if VERBOSE :
568+ torchrl_logger .info (
569+ "Entropy is not finite. Using Monte Carlo sampling."
570+ )
570571 raise NotImplementedError
571572 except NotImplementedError :
572- torchrl_logger .warn (
573- f"Entropy not implemented for { type (dist )} or is not finite. Using Monte Carlo sampling."
574- )
573+ if VERBOSE :
574+ torchrl_logger .warning (
575+ f"Entropy not implemented for { type (dist )} or is not finite. Using Monte Carlo sampling."
576+ )
575577 if getattr (dist , "has_rsample" , False ):
576578 x = dist .rsample ((self .samples_mc_entropy ,))
577579 else :
You can’t perform that action at this time.
0 commit comments