# tf.contrib.eager.metrics.Mean

## Class Mean

Inherits From: Metric

Computes the (weighted) mean of the given values.

## Methods

### __init__

__init__(
name=None,
dtype=tf.double,
use_global_variables=False
)


### __call__

__call__(
*args,
**kwargs
)


Returns op to execute to update this metric for these inputs.

Returns None if eager execution is enabled. Returns a graph-mode function if graph execution is enabled.

#### Args:

• *args: * **kwargs: A mini-batch of inputs to the Metric, passed on to call().

### add_variable

add_variable(
name,
shape=None,
dtype=None,
initializer=None
)


Only for use by descendants of Metric.

### aggregate

aggregate(metrics)


Adds in the state from a list of metrics.

Default implementation sums all the metric variables.

#### Args:

• metrics: A list of metrics with the same type as self.

#### Raises:

• ValueError: If metrics contains invalid data.

### build

build(
*args,
**kwargs
)


### call

call(
values,
weights=None
)


Accumulate statistics for computing the mean.

For example, if values is [1, 3, 5, 7] then the mean is 4. If the weights were specified as [1, 1, 0, 0] then the mean would be 2.

#### Args:

• values: Tensor with the per-example value.
• weights: Optional weighting of each example. Defaults to 1.

#### Returns:

The arguments, for easy chaining.

### init_variables

init_variables()


Initializes this Metric's variables.

Should be called after variables are created in the first execution of __call__(). If using graph execution, the return value should be run() in a session before running the op returned by __call__(). (See example above.)

#### Returns:

If using graph execution, this returns an op to perform the initialization. Under eager execution, the variables are reset to their initial values as a side effect and this function returns None.

### result

result()


### value

value()


In graph mode returns the result Tensor while in eager the callable.