class_docstr: Backward Pass Differentiable Approximation.
  
  The module should be provided a `forward` method and a `backward`
  method that approximates the derivatives of `forward`.
  
  The `forward` function is called in the forward pass, and the
  `backward` function is used to find gradients in the backward pass.
  
  The `backward` function can be implicitly provided-by providing
  `forwardsub` - an alternative forward pass function, which its
  gradient will be used in the backward pass.
  
  If not `backward` nor `forwardsub` are provided, the `backward`
  function will be assumed to be the identity.
  
  :param forward: `forward(*inputs)` - the forward function for BPDA.
  :param forwardsub: (Optional) a substitute forward function, for the
                     gradients approximation of `forward`.
  :param backward: (Optional) `backward(inputs, grad_outputs)` the
                   backward pass function for BPDA.
class_docstr_tok: ["Backward","Pass","Differentiable","Approximation",".","The","module","should","be","provided","a","`","forward","`","method","and","a","`","backward","`","method","that","approximates","the","derivatives","of","`","forward","`",".","The","`","forward","`","function","is","called","in","the","forward","pass",",","and","the","`","backward","`","function","is","used","to","find","gradients","in","the","backward","pass",".","The","`","backward","`","function","can","be","implicitly","provided-by","providing","`","forwardsub","`","-","an","alternative","forward","pass","function",",","which","its","gradient","will","be","used","in","the","backward","pass",".","If","not","`","backward","`","nor","`","forwardsub","`","are","provided",",","the","`","backward","`","function","will","be","assumed","to","be","the","identity",".",":","param","forward",":","`","forward","(","*","inputs",")","`","-","the","forward","function","for","BPDA",".",":","param","forwardsub",":","(","Optional",")","a","substitute","forward","function",",","for","the","gradients","approximation","of","`","forward","`",".",":","param","backward",":","(","Optional",")","`","backward","(","inputs",",","grad_outputs",")","`","the","backward","pass","function","for","BPDA","."]
code: def _create_func(cls, forward_fn, backward_fn, forwardsub_fn):
      if backward_fn is not None:
          return cls._create_func_backward(forward_fn, backward_fn)
  
      if forwardsub_fn is not None:
          return cls._create_func_forwardsub(forward_fn, forwardsub_fn)
  
      return cls._create_func_forward_only(forward_fn)
  
file_path: advertorch/advertorch/bpda.py
imports: import torch
  import torch.nn
label_desc: Use image node_id 2 for calling the BPDAWrapper obj's underlying member method code with example usage: obj._create_func(cls, forward_fn, backward_fn, forwardsub_fn) and returns: cls, cls, cls