code: def add(input: PHETensor, other):
      if not isinstance(input, PHETensor) and isinstance(
          other, PHETensor
      ):
          return add(other, input)
  
      evaluator = input.evaluator
      pk = input.pk
      coder = input.coder
      shape = input.shape
      dtype = input.dtype
      if isinstance(other, PHETensor):
          assert (
              shape == other.shape
          ), f"shape mismatch {shape} != {other.shape}"
          output_dtype = torch.promote_types(dtype, other.dtype)
          data = evaluator.add(input.data, other.data, pk)
          return input.with_template(data, dtype=output_dtype)
  
      elif isinstance(other, torch.Tensor):
          if shape == other.shape:
              output_dtype = torch.promote_types(dtype, other.dtype)
              data = evaluator.add_plain(
                  input.data, other, pk, coder, output_dtype
              )
              return input.with_template(data, dtype=output_dtype)
          elif other.ndim == 0:
              output_dtype = torch.promote_types(dtype, other.dtype)
              data = evaluator.add_plain_scalar(
                  input.data,
                  other.detach().item(),
                  pk,
                  coder,
                  output_dtype,
              )
              return input.with_template(data, dtype=output_dtype)
          else:
              # TODO: support broadcast
              broadcast_shape = torch.broadcast_shapes(
                  shape, other.shape
              )
              raise RuntimeError(
                  f"broadcast shape {shape} and {other.shape} to {broadcast_shape} is fine, but not yet implemented"
              )
  
      elif isinstance(other, (float, int)):
          output_dtype = torch.promote_types(
              dtype, torch.get_default_dtype()
          )
          data = evaluator.add_plain_scalar(
              input.data, other, pk, coder, output_dtype
          )
          return input.with_template(data, dtype=output_dtype)
      else:
          return NotImplemented
  
file_path: FATE/python/fate/arch/tensor/phe/_ops.py
imports: import torch
  from fate.arch.tensor import _custom_ops
  from ._tensor import PHETensor, implements, implements_encoded
label_desc: Use image node_id 7 for calling a global function with example usage: add(input, other) and returns: add, input, input, input, NotImplemented, input