from tensorflow.python.ops import state_ops

        broadcast_weights = math_ops.mul(
            weights, array_ops.ones_like(average_precision),
            name='broadcast_weights')
        batch_max = math_ops.reduce_sum(broadcast_weights, name='batch_max')
      max_update = state_ops.assign_add(max_var, batch_max, name='update')
    with ops.name_scope(None, 'total', (average_precision,)) as total_scope:
      total_var = contrib_variables.local_variable(
          array_ops.zeros([], dtype=dtypes.float64), name=total_scope)
