Skip to content

WARNING

该页面尚未翻译。 以下内容为英文原版。

tensorplay.nn._reduction

No description provided.

Functions

get_enum()

python
get_enum(reduction: str) -> int

Converts 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"

基于 Apache 2.0 许可发布。

📚DeepWiki