class_docstr: The base class for all structured metrics used within TFMA.
  
  This class allows custom metrics to control how proto serialization happens,
  and how to handle basic algebraic operations used in computing confidence
  intervals and model diffs. By implementing the _apply_binary_op methods,
  subclasses can then be treated like primitive numeric types.
class_docstr_tok: ["The","base","class","for","all","structured","metrics","used","within","TFMA",".","This","class","allows","custom","metrics","to","control","how","proto","serialization","happens",",","and","how","to","handle","basic","algebraic","operations","used","in","computing","confidence","intervals","and","model","diffs",".","By","implementing","the","_apply_binary_op","methods",",","subclasses","can","then","be","treated","like","primitive","numeric","types","."]
docstr: Applies the binary operator elementwise on self and `other`.
  
  Given two structures of the same type, this function's job is to find
  corresponding pairs of elements within both structures, invoke `op` on each
  pair, and store the result in a corresponding location within a new
  structure. For example, to implement for a list, this function could be
  implemented as:
  
      return [op(elem, other_elem) for elem, other_elem in zip(self, other)]
  
  Args:
    other: A structure containing elements which should be the second operand
      when applying `op`. `Other` must be a structured metric of the same type
      as self.
    op: A binary operator which should be applied elementwise to corresponding
      primitive values in self and `other`.
  
  Returns:
    A new structured metric that is the result of elementwise applying `op`
    on corresponding elements within self and `other`.
docstr_tok: ["Applies","the","binary","operator","elementwise","on","self","and","`","other","`",".","Given","two","structures","of","the","same","type",",","this","function","'s","job","is","to","find","corresponding","pairs","of","elements","within","both","structures",",","invoke","`","op","`","on","each","pair",",","and","store","the","result","in","a","corresponding","location","within","a","new","structure",".","For","example",",","to","implement","for","a","list",",","this","function","could","be","implemented","as",":","return","[","op","(","elem",",","other_elem",")","for","elem",",","other_elem","in","zip","(","self",",","other",")","]","Args",":","other",":","A","structure","containing","elements","which","should","be","the","second","operand","when","applying","`","op","`",".","`","Other","`","must","be","a","structured","metric","of","the","same","type","as","self",".","op",":","A","binary","operator","which","should","be","applied","elementwise","to","corresponding","primitive","values","in","self","and","`","other","`",".","Returns",":","A","new","structured","metric","that","is","the","result","of","elementwise","applying","`","op","`","on","corresponding","elements","within","self","and","`","other","`","."]
code: def _apply_binary_op_elementwise(
      self: ConcreteStructuredMetricValue,
      other: ConcreteStructuredMetricValue,
      op: Callable[[float, float], float],
  ) -> ConcreteStructuredMetricValue:
      """Applies the binary operator elementwise on self and `other`.
  
      Given two structures of the same type, this function's job is to find
      corresponding pairs of elements within both structures, invoke `op` on each
      pair, and store the result in a corresponding location within a new
      structure. For example, to implement for a list, this function could be
      implemented as:
  
          return [op(elem, other_elem) for elem, other_elem in zip(self, other)]
  
      Args:
        other: A structure containing elements which should be the second operand
          when applying `op`. `Other` must be a structured metric of the same type
          as self.
        op: A binary operator which should be applied elementwise to corresponding
          primitive values in self and `other`.
  
      Returns:
        A new structured metric that is the result of elementwise applying `op`
        on corresponding elements within self and `other`.
      """
      ...
  
imports: import abc
  import datetime
  import operator
  from typing import Any, Callable, Dict, Iterable, List, MutableMapping, NamedTuple, Optional, TypeVar, Tuple, Union
  from apache_beam.utils import shared
  import numpy
  import six
  import tensorflow
  from tensorflow_model_analysis.proto import metrics_for_slice_pb2
label_desc: Use image node_id 2 for calling the StructuredMetricValue obj's underlying member method code with example usage: obj._apply_binary_op_elementwise(other, op) without return types