docstr: Mark outputs as non-differentiable.
  
  **This should be called at most once, only from inside the**
  :func:`forward` **method, and all arguments should be tensor outputs.**
  
  This will mark outputs as not requiring gradients, increasing the
  efficiency of backward computation. You still need to accept a gradient
  for each output in :meth:`~Function.backward`, but it's always going to
  be a zero tensor with the same shape as the shape of a corresponding
  output.
  
  This is used e.g. for indices returned from a sort. See example::
      >>> class Func(Function):
      >>>     @staticmethod
      >>>     def forward(ctx, x):
      >>>         sorted, idx = x.sort()
      >>>         ctx.mark_non_differentiable(idx)
      >>>         ctx.save_for_backward(x, idx)
      >>>         return sorted, idx
      >>>
      >>>     @staticmethod
      >>>     @once_differentiable
      >>>     def backward(ctx, g1, g2):  # still need to accept g2
      >>>         x, idx = ctx.saved_tensors
      >>>         grad_input = torch.zeros_like(x)
      >>>         grad_input.index_add_(0, idx, g1)
      >>>         return grad_input
docstr_tok: ["Mark","outputs","as","non-differentiable",".","*","*","This","should","be","called","at","most","once",",","only","from","inside","the","*","*",":","func",":","`","forward","`","*","*","method",",","and","all","arguments","should","be","tensor","outputs",".","*","*","This","will","mark","outputs","as","not","requiring","gradients",",","increasing","the","efficiency","of","backward","computation",".","You","still","need","to","accept","a","gradient","for","each","output","in",":","meth",":","`","~Function.backward","`",",","but","it","'s","always","going","to","be","a","zero","tensor","with","the","same","shape","as","the","shape","of","a","corresponding","output",".","This","is","used","e.g",".","for","indices","returned","from","a","sort",".","See","example",":",":",">",">",">","class","Func","(","Function",")",":",">",">",">","@","staticmethod",">",">",">","def","forward","(","ctx",",","x",")",":",">",">",">","sorted",",","idx","=","x.sort","(",")",">",">",">","ctx.mark_non_differentiable","(","idx",")",">",">",">","ctx.save_for_backward","(","x",",","idx",")",">",">",">","return","sorted",",","idx",">",">",">",">",">",">","@","staticmethod",">",">",">","@","once_differentiable",">",">",">","def","backward","(","ctx",",","g1",",","g2",")",":","#","still","need","to","accept","g2",">",">",">","x",",","idx","=","ctx.saved_tensors",">",">",">","grad_input","=","torch.zeros_like","(","x",")",">",">",">","grad_input.index_add_","(","0",",","idx",",","g1",")",">",">",">","return","grad_input"]
code: def mark_non_differentiable(self, *args: torch.Tensor):
      r"""Mark outputs as non-differentiable.
  
      **This should be called at most once, only from inside the**
      :func:`forward` **method, and all arguments should be tensor outputs.**
  
      This will mark outputs as not requiring gradients, increasing the
      efficiency of backward computation. You still need to accept a gradient
      for each output in :meth:`~Function.backward`, but it's always going to
      be a zero tensor with the same shape as the shape of a corresponding
      output.
  
      This is used e.g. for indices returned from a sort. See example::
          >>> class Func(Function):
          >>>     @staticmethod
          >>>     def forward(ctx, x):
          >>>         sorted, idx = x.sort()
          >>>         ctx.mark_non_differentiable(idx)
          >>>         ctx.save_for_backward(x, idx)
          >>>         return sorted, idx
          >>>
          >>>     @staticmethod
          >>>     @once_differentiable
          >>>     def backward(ctx, g1, g2):  # still need to accept g2
          >>>         x, idx = ctx.saved_tensors
          >>>         grad_input = torch.zeros_like(x)
          >>>         grad_input.index_add_(0, idx, g1)
          >>>         return grad_input
  
      """
      self.non_differentiable = args
  
imports: import functools
  import inspect
  import itertools
  import warnings
  from collections import OrderedDict
  from typing import Any, List, Optional, Tuple
  import torch
  import torch._C
  import torch._functorch
  import torch.utils.hooks
  from torch._C import _functions
  from torch._functorch.autograd_function import custom_function_call
label_desc: Use image node_id 5 for calling the FunctionCtx obj's underlying member method code with example usage: obj.mark_non_differentiable() without return types