parameters: (g, self, tensor)
return_statement: return self
docstring: Convert self into the same type of tensor, as necessary.
  
      We only support implicit casting for scalars, so we never
      actually need to insert an ONNX cast operator here; just
      fix up the scalar.
docstring_summary: Convert self into the same type of tensor, as necessary.
docstring_tokens: Convert self into the same type of tensor as necessary .
function: def _if_scalar_type_as(g, self, tensor):
      """
      Convert self into the same type of tensor, as necessary.
  
      We only support implicit casting for scalars, so we never
      actually need to insert an ONNX cast operator here; just
      fix up the scalar.
      """
      if isinstance(self, torch._C.Value):
          return self
  
      scalar_type = tensor.type().scalarType()
      if scalar_type:
          ty = scalar_type.lower()
          return getattr(self, ty)()
  
      return self
function_tokens: def _if_scalar_type_as ( g , self , tensor ) : if isinstance ( self , torch . _C . Value ) : return self scalar_type = tensor . type ( ) . scalarType ( ) if scalar_type : ty = scalar_type . lower ( ) return getattr ( self , ty ) ( ) return self