Have a question? Connect with the community at the TensorFlow Forum

# MeanMetricWrapper

public class MeanMetricWrapper
Known Direct Subclasses

A class that bridges a stateless loss function with the ``` Mean ``` metric using a reduction of ``` WEIGHTED_MEAN ``` .

The loss function calculates the loss between the ``` labels ``` and ``` predictions ``` then passes this loss to the ``` Mean ``` metric to calculate the weighted mean of the loss over many iterations or epochs

### Public Methods

 LossMetric () Gets the loss function. List< Op > ( Operand labels, Operand predictions, Operand sampleWeights) Creates Operations that update the state of the mean metric, by calling the loss function and passing the loss to the Mean metric to calculate the weighted mean of the loss over many iterations.

## Public Methods

#### public LossMetric <T> getLoss ()

Gets the loss function.

##### Returns
• the loss function.

#### public List< Op > updateStateList ( Operand <? extends TNumber > labels, Operand <? extends TNumber > predictions, Operand <? extends TNumber > sampleWeights)

Creates Operations that update the state of the mean metric, by calling the loss function and passing the loss to the Mean metric to calculate the weighted mean of the loss over many iterations.

##### Parameters
 labels the truth values or labels the predictions Optional sampleWeights acts as a coefficient for the loss. If a scalar is provided, then the loss is simply scaled by the given value. If sampleWeights is a tensor of size [batch_size], then the total loss for each sample of the batch is rescaled by the corresponding element in the sampleWeights vector. If the shape of sampleWeights is [batch_size, d0, .. dN-1] (or can be broadcasted to this shape), then each loss element of predictions is scaled by the corresponding value of sampleWeights. (Note on dN-1: all loss functions reduce by 1 dimension, usually axis=-1.)
##### Returns
• a List of control operations that updates the Mean state variables.
[{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"Missing the information I need" },{ "type": "thumb-down", "id": "tooComplicatedTooManySteps", "label":"Too complicated / too many steps" },{ "type": "thumb-down", "id": "outOfDate", "label":"Out of date" },{ "type": "thumb-down", "id": "samplesCodeIssue", "label":"Samples / code issue" },{ "type": "thumb-down", "id": "otherDown", "label":"Other" }]
[{ "type": "thumb-up", "id": "easyToUnderstand", "label":"Easy to understand" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"Solved my problem" },{ "type": "thumb-up", "id": "otherUp", "label":"Other" }]