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: Creates the `CallOnce` object.
  
  Args:
    create_value_fn: Python `callable` which takes any input args/kwargs and
      returns a value to memoize. (The value is not presumed to be of any
      particular type.)
docstr_tok: ["Creates","the","`","CallOnce","`","object",".","Args",":","create_value_fn",":","Python","`","callable","`","which","takes","any","input","args\/kwargs","and","returns","a","value","to","memoize",".","(","The","value","is","not","presumed","to","be","of","any","particular","type",".",")"]
code: def __init__(self, create_value_fn):
      """Creates the `CallOnce` object.
  
      Args:
        create_value_fn: Python `callable` which takes any input args/kwargs and
          returns a value to memoize. (The value is not presumed to be of any
          particular type.)
      """
      self._create_value_fn = create_value_fn
      self._value = _UNSET
      # TODO(b/156185251): We have to set `__name__` because of a
      # not-really-necessary requirement of DeferredTensor.
      self.__name__ = str(
          getattr(create_value_fn, "name", None)
          or getattr(type(create_value_fn), "__name__", "unknown")
      )
      super(CallOnce, self).__init__(name=self.__name__)
  
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 1 to create a new CallOnce object from inherited base classes: tf with example: obj = CallOnce(create_value_fn)