Calculates how often
name: name of the accuracy object
dtype: data type of tensor.
__init__( name=None, dtype=tf.double )
Inits SparseAccuracy with name and dtype.
__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.
**kwargs: A mini-batch of inputs to the Metric, passed on to
add_variable( name, shape=None, dtype=None, initializer=None )
Only for use by descendants of Metric.
Adds in the state from a list of metrics.
Default implementation sums all the metric variables.
metrics: A list of metrics with the same type as
ValueError: If metrics contains invalid data.
build( *args, **kwargs )
call( labels, predictions, weights=None )
Accumulate accuracy statistics.
predictions should have the same shape except the
predictions must have one additional trailing dimension equal to the
number of classes(you want to predict).
Type of labels and predictions can be different.
labels: Tensor of shape (batch_size, ) containing integers
predictions: Tensor with the logits or probabilities for each example.
weights: Optional weighting of each example. Defaults to 1.
The arguments, for easy chaining.
Initializes this Metric's variables.
Should be called after variables are created in the first execution
__call__(). If using graph execution, the return value should be
run() in a session before running the op returned by
(See example above.)
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.
Returns the result of the Metric.
write_summary: bool indicating whether to feed the result to the summary before returning.
aggregated metric as float.
ValueError: if the optional argument is not bool
In graph mode returns the result Tensor while in eager the callable.