conversion
Source code: tianshou/utils/conversion.py
-
to_optional_float(x: Tensor) → float[source]
-
to_optional_float(x: float) → float
-
to_optional_float(x: None) → None
For the common case where one needs to extract a float from a scalar Tensor, which may be None.