class_docstr: Function object which memoizes the result of `create_value_fn()`.
  
  This object is used to memoize the computation of some function. Upon first
  call, the user provided `create_value_fn` is called and with the args/kwargs
  provided to this object's `__call__`. On subsequent calls the previous result
  is returned and **regardless of the args/kwargs provided to this object's
  `__call__`**. To trigger a new evaluation, invoke `this.reset()` and to
  identify if a new evaluation will execute (on-demand) invoke
  `this.is_unset()`. For an example application of this object, see
  `help(tfp.experimental.nn.util.RandomVariable)` and/or
  `help(tfp.util.DeferredTensor)`.
class_docstr_tok: ["Function","object","which","memoizes","the","result","of","`","create_value_fn","(",")","`",".","This","object","is","used","to","memoize","the","computation","of","some","function",".","Upon","first","call",",","the","user","provided","`","create_value_fn","`","is","called","and","with","the","args\/kwargs","provided","to","this","object","'s","`","__call__","`",".","On","subsequent","calls","the","previous","result","is","returned","and","*","*","regardless","of","the","args\/kwargs","provided","to","this","object's","`","__call__","`","*","*",".","To","trigger","a","new","evaluation",",","invoke","`","this.reset","(",")","`","and","to","identify","if","a","new","evaluation","will","execute","(","on-demand",")","invoke","`","this.is_unset","(",")","`",".","For","an","example","application","of","this","object",",","see","`","help","(","tfp.experimental.nn.util.RandomVariable",")","`","and\/or","`","help","(","tfp.util.DeferredTensor",")","`","."]
docstr: Return the memoized value.
docstr_tok: ["Return","the","memoized","value","."]
code: def __call__(self, *args, **kwargs):
      """Return the memoized value."""
      if self.is_unset():
          self._value = self._create_value_fn(*args, **kwargs)
          return (
              self._value
          )  # No need to to go through checks on first call.
      my_graph = getattr(self._value, "graph", None)
      my_graph_was_deleted = (
          my_graph is None
          and
          # Don't check subclass; check parent only.
          type(self._value) is tf.Tensor
      )  # pylint: disable=unidiomatic-typecheck
      # We write `your_graph` as a lambda to ensure it's only evaluated when
      # necessary.
      your_graph = lambda: getattr(
          tf.constant([], dtype=tf.bool), "graph", None
      )
      if my_graph_was_deleted or (
          my_graph is not None and my_graph is not your_graph()
      ):
          raise ValueError(
              "You are attempting to access a memoized value from a different "
              "graph context. Please call `this.reset()` before accessing a "
              "memoized value from a different graph context."
          )
      return self._value
  
imports: import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.util.deferred_tensor import DeferredTensor
label_desc: Use image node_id 5 for calling the CallOnce obj's underlying member method code with example usage: obj.__call__() and returns: self, self