code: def validate(mutable_op: OpOverload):
      if not isinstance(mutable_op, OpOverload):
          raise TypeError(
              f"register_functional_op(mutable_op): expected mutable_op to be instance of "
              f"OpOverload but got {type(mutable_op)}"
          )
  
      # There are generally three types of "in-place" or "mutable" ops.
      # Each of them have their own conventions:
      # - inplace (first input modified in-place and returned as only output)
      # - out= (some args modified in-place and returned as outputs)
      # - mutable (some args modified in-place but none of those returned as outputs)
      # In theory we can support all three, but we'll just support the last
      # option right now for simplicity.
      schema = FunctionSchema.parse(str(mutable_op._schema))
      if not schema.kind() == SchemaKind.mutable:
          raise RuntimeError(
              "Expected op to be mutable (as opposed to functional, inplace or out)"
          )
      for ret in schema.returns:
          # construct_functionalization_kernel assumes this for simplicity
          if ret.annotation is not None:
              raise NotImplementedError(
                  "NYI: register_functional_op(op) where op returns a mutated or aliased value. "
                  "Please file an issue (and as a workaround, modify your operator to "
                  "not return the mutated value or aliases)"
              )
      for arg in schema.arguments.flat_all:
          # construct_functionalization_kernel assumes this for simplicity
          if arg.type.is_tensor_like() and (
              arg.type != BaseType(BaseTy.Tensor)
              and arg.type != OptionalType(BaseType(BaseTy.Tensor))
          ):
              raise NotImplementedError(
                  "NYI: register_functional_op(op) where op has a List[Tensor] input."
                  "Please file an issue."
              )
  
file_path: pytorch/torch/_custom_op/functional.py
imports: import weakref
  import torch
  import torch.utils._pytree
  from torch._C import _ExcludeDispatchKeyGuard, DispatchKey, DispatchKeySet
  from torch._ops import OpOverload
  from torch.library import Library
  from torchgen.model import BaseTy, BaseType, FunctionSchema, OperatorName, OptionalType, SchemaKind
  from .autograd import autograd_not_implemented
label_desc: Use image node_id 4 for calling a global function with example usage: validate(mutable_op) without return types