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 29
29
from tensordict .utils import NestedKey
30
30
from torch import distributions as d
31
31
32
- from torchrl ._utils import _standardize , logger as torchrl_logger
32
+ from torchrl ._utils import _standardize , logger as torchrl_logger , VERBOSE
33
33
from torchrl .objectives .common import LossModule
34
34
from torchrl .objectives .utils import (
35
35
_cache_values ,
@@ -564,14 +564,16 @@ def _get_entropy(
564
564
entropy = dist .entropy ()
565
565
if not entropy .isfinite ().all ():
566
566
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
+ )
570
571
raise NotImplementedError
571
572
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
+ )
575
577
if getattr (dist , "has_rsample" , False ):
576
578
x = dist .rsample ((self .samples_mc_entropy ,))
577
579
else :
You can’t perform that action at this time.
0 commit comments