tf.losses.Reduction
Stay organized with collections
Save and categorize content based on your preferences.
Types of loss reduction.
Contains the following values:
NONE
: Un-reduced weighted losses with the same shape as input.
SUM
: Scalar sum of weighted losses.
MEAN
: Scalar SUM
divided by sum of weights. DEPRECATED.
SUM_OVER_BATCH_SIZE
: Scalar SUM
divided by number of elements in losses.
SUM_OVER_NONZERO_WEIGHTS
: Scalar SUM
divided by number of non-zero
weights. DEPRECATED.
SUM_BY_NONZERO_WEIGHTS
: Same as SUM_OVER_NONZERO_WEIGHTS
. DEPRECATED.
Methods
all
View source
@classmethod
all()
validate
View source
@classmethod
validate(
key
)
Class Variables
MEAN = 'weighted_mean'
NONE = 'none'
SUM = 'weighted_sum'
SUM_BY_NONZERO_WEIGHTS = 'weighted_sum_by_nonzero_weights'
SUM_OVER_BATCH_SIZE = 'weighted_sum_over_batch_size'
SUM_OVER_NONZERO_WEIGHTS = 'weighted_sum_by_nonzero_weights'
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-10-01 UTC.
[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.losses.Reduction\n\n\u003cbr /\u003e\n\n|------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/ops/losses/losses_impl.py#L38-L72) |\n\nTypes of loss reduction.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.losses.Reduction`](/api_docs/python/tf/compat/v1/losses/Reduction)\n\n\u003cbr /\u003e\n\nContains the following values:\n\n- `NONE`: Un-reduced weighted losses with the same shape as input.\n- `SUM`: Scalar sum of weighted losses.\n- `MEAN`: Scalar `SUM` divided by sum of weights. DEPRECATED.\n- `SUM_OVER_BATCH_SIZE`: Scalar `SUM` divided by number of elements in losses.\n- `SUM_OVER_NONZERO_WEIGHTS`: Scalar `SUM` divided by number of non-zero weights. DEPRECATED.\n- `SUM_BY_NONZERO_WEIGHTS`: Same as `SUM_OVER_NONZERO_WEIGHTS`. DEPRECATED.\n\nMethods\n-------\n\n### `all`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/ops/losses/losses_impl.py#L59-L67) \n\n @classmethod\n all()\n\n### `validate`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/ops/losses/losses_impl.py#L69-L72) \n\n @classmethod\n validate(\n key\n )\n\nClass Variables\n---------------\n\n- `MEAN = 'weighted_mean'`\n- `NONE = 'none'`\n- `SUM = 'weighted_sum'`\n- `SUM_BY_NONZERO_WEIGHTS = 'weighted_sum_by_nonzero_weights'`\n- `SUM_OVER_BATCH_SIZE = 'weighted_sum_over_batch_size'`\n- `SUM_OVER_NONZERO_WEIGHTS = 'weighted_sum_by_nonzero_weights'`"]]