tensorplay.nn._reduction
No description provided.
Functions
get_enum()
python
get_enum(reduction: str) -> intConverts a string-based reduction mode to its corresponding integer enumeration value.
This function maps standard reduction string identifiers (e.g., "none", "mean", "sum") to integer constants for internal enumeration use.
Parameters
reduction: A string specifying the reduction mode. Valid options are:
- "none": No reduction is applied (returns raw values)
- "mean": Reduce by computing the arithmetic mean of the values
- "sum": Reduce by computing the sum of the values
Returns
Integer enumeration value corresponding to the reduction mode:
- 0 for "none"
- 1 for "mean"
- 2 for "sum"
