parameters: (method_name, operation)
docstring: Registers `Series` member functions for binary operations.
  
    Args:
      method_name: the name of the method that will be created in `Series`.
      operation: underlying TensorFlow operation.
docstring_summary: Registers `Series` member functions for binary operations.
docstring_tokens: Registers Series member functions for binary operations .
function: def register_binary_op(method_name, operation):
    """Registers `Series` member functions for binary operations.
  
    Args:
      method_name: the name of the method that will be created in `Series`.
      operation: underlying TensorFlow operation.
    """
  
    # Define series-series `Transform`.
    @property
    def series_name(self):
      return operation.__name__
  
    series_doc = _DOC_FORMAT_STRING.format(operation.__name__, operation.__doc__)
  
    def series_apply_op(self, x, y):
      return operation(x, y)
  
    series_transform_cls = type("scalar_{}".format(operation.__name__),
                                (SeriesBinaryTransform,),
                                {"name": series_name,
                                 "__doc__": series_doc,
                                 "_apply_op": series_apply_op})
  
    # Define series-scalar `Transform`.
    @property
    def scalar_name(self):
      return "scalar_{}".format(operation.__name__)
  
    scalar_doc = _DOC_FORMAT_STRING.format(operation.__name__, operation.__doc__)
  
    def scalar_apply_op(self, x):
      return operation(x, self.scalar)
  
    scalar_transform_cls = type("scalar_{}".format(operation.__name__),
                                (ScalarBinaryTransform,),
                                {"name": scalar_name,
                                 "__doc__": scalar_doc,
                                 "_apply_op": scalar_apply_op})
  
    # Define function that delegates to the two `Transforms`.
    def _fn(self, other, *args, **kwargs):
      # pylint: disable=not-callable,abstract-class-instantiated
      if isinstance(other, series.Series):
        return series_transform_cls(*args, **kwargs)([self, other])[0]
      return scalar_transform_cls(other, *args, **kwargs)([self])[0]
  
    # Register new member function of `Series`.
    setattr(series.Series, method_name, _fn)
function_tokens: def register_binary_op ( method_name , operation ) : # Define series-series `Transform`. @ property def series_name ( self ) : return operation . __name__ series_doc = _DOC_FORMAT_STRING . format ( operation . __name__ , operation . __doc__ ) def series_apply_op ( self , x , y ) : return operation ( x , y ) series_transform_cls = type ( "scalar_{}" . format ( operation . __name__ ) , ( SeriesBinaryTransform , ) , { "name" : series_name , "__doc__" : series_doc , "_apply_op" : series_apply_op } ) # Define series-scalar `Transform`. @ property def scalar_name ( self ) : return "scalar_{}" . format ( operation . __name__ ) scalar_doc = _DOC_FORMAT_STRING . format ( operation . __name__ , operation . __doc__ ) def scalar_apply_op ( self , x ) : return operation ( x , self . scalar ) scalar_transform_cls = type ( "scalar_{}" . format ( operation . __name__ ) , ( ScalarBinaryTransform , ) , { "name" : scalar_name , "__doc__" : scalar_doc , "_apply_op" : scalar_apply_op } ) # Define function that delegates to the two `Transforms`. def _fn ( self , other , * args , * * kwargs ) : # pylint: disable=not-callable,abstract-class-instantiated if isinstance ( other , series . Series ) : return series_transform_cls ( * args , * * kwargs ) ( [ self , other ] ) [ 0 ] return scalar_transform_cls ( other , * args , * * kwargs ) ( [ self ] ) [ 0 ] # Register new member function of `Series`. setattr ( series . Series , method_name , _fn )