class_docstr: Computes differentially private gradients as required by DP-SGD.
  This module can be used in place of GradVals, and automatically makes the optimizer differentially private.
class_docstr_tok: ["Computes","differentially","private","gradients","as","required","by","DP-SGD",".","This","module","can","be","used","in","place","of","GradVals",",","and","automatically","makes","the","optimizer","differentially","private","."]
docstr: Returns the computed DP-SGD gradients.
  
  Returns:
      A tuple (gradients, value of f).
docstr_tok: ["Returns","the","computed","DP-SGD","gradients",".","Returns",":","A","tuple","(","gradients",",","value","of","f",")","."]
code: def __call__(self, *args):
      """Returns the computed DP-SGD gradients.
  
      Returns:
          A tuple (gradients, value of f)."""
      batch = args[0].shape[0]
      assert batch % self.microbatch == 0
      num_microbatches = batch // self.microbatch
      stddev = (
          self.l2_norm_clip * self.noise_multiplier / num_microbatches
      )
      g, v = self.clipped_grad(
          *[self.reshape_microbatch(x) for x in args]
      )
      g = [
          gx
          + random.normal(
              gx.shape, stddev=stddev, generator=self.keygen
          )
          for gx in g
      ]
      return g, v
  
file_path: objax/objax/privacy/dpsgd/gradient.py
imports: import functools
  from typing import Optional, Callable, Tuple
  import jax
  import jax.numpy
  from objax import random
  from objax.gradient import GradValues
  from objax.module import Function, Module, Vectorize
  from objax.typing import JaxArray
  from objax.util import repr_function, class_name
  from objax.variable import VarCollection
label_desc: Use image node_id 5 for calling the PrivateGradValues obj's underlying member method code with example usage: obj.__call__() and returns: g,  v