class_docstr: A distribution strategy for running on a single device.
  
  Using this strategy will place any variables created in its scope on the
  specified device. Input distributed through this strategy will be
  prefetched to the specified device. Moreover, any functions called via
  `strategy.run` will also be placed on the specified device
  as well.
  
  Typical usage of this strategy could be testing your code with the
  tf.distribute.Strategy API before switching to other strategies which
  actually distribute to multiple devices/machines.
  
  For example:
  ```
  strategy = tf.distribute.OneDeviceStrategy(device="/gpu:0")
  
  with strategy.scope():
    v = tf.Variable(1.0)
    print(v.device)  # /job:localhost/replica:0/task:0/device:GPU:0
  
  def step_fn(x):
    return x * 2
  
  result = 0
  for i in range(10):
    result += strategy.run(step_fn, args=(i,))
  print(result)  # 90
  ```
class_docstr_tok: ["A","distribution","strategy","for","running","on","a","single","device",".","Using","this","strategy","will","place","any","variables","created","in","its","scope","on","the","specified","device",".","Input","distributed","through","this","strategy","will","be","prefetched","to","the","specified","device",".","Moreover",",","any","functions","called","via","`","strategy.run","`","will","also","be","placed","on","the","specified","device","as","well",".","Typical","usage","of","this","strategy","could","be","testing","your","code","with","the","tf.distribute.Strategy","API","before","switching","to","other","strategies","which","actually","distribute","to","multiple","devices\/machines",".","For","example",":","``","`","strategy","=","tf.distribute.OneDeviceStrategy","(","device=","''","\/gpu:0","''",")","with","strategy.scope","(",")",":","v","=","tf.Variable","(","1.0",")","print","(","v.device",")","#","\/job",":","localhost\/replica:0\/task:0\/device",":","GPU:0","def","step_fn","(","x",")",":","return","x","*","2","result","=","0","for","i","in","range","(","10",")",":","result","+=","strategy.run","(","step_fn",",","args=","(","i",",",")",")","print","(","result",")","#","90","``","`"]
docstr: Run `fn` on each replica, with the given arguments.
  
  In `OneDeviceStrategy`, `fn` is simply called within a device scope for the
  given device, with the provided arguments.
  
  Args:
    fn: The function to run. The output must be a `tf.nest` of `Tensor`s.
    args: (Optional) Positional arguments to `fn`.
    kwargs: (Optional) Keyword arguments to `fn`.
    options: (Optional) An instance of `tf.distribute.RunOptions` specifying
      the options to run `fn`.
  
  Returns:
    Return value from running `fn`.
docstr_tok: ["Run","`","fn","`","on","each","replica",",","with","the","given","arguments",".","In","`","OneDeviceStrategy","`",",","`","fn","`","is","simply","called","within","a","device","scope","for","the","given","device",",","with","the","provided","arguments",".","Args",":","fn",":","The","function","to","run",".","The","output","must","be","a","`","tf.nest","`","of","`","Tensor","`","s",".","args",":","(","Optional",")","Positional","arguments","to","`","fn","`",".","kwargs",":","(","Optional",")","Keyword","arguments","to","`","fn","`",".","options",":","(","Optional",")","An","instance","of","`","tf.distribute.RunOptions","`","specifying","the","options","to","run","`","fn","`",".","Returns",":","Return","value","from","running","`","fn","`","."]
code: def run(
      self, fn, args=(), kwargs=None, options=None
  ):  # pylint: disable=useless-super-delegation
      """Run `fn` on each replica, with the given arguments.
  
      In `OneDeviceStrategy`, `fn` is simply called within a device scope for the
      given device, with the provided arguments.
  
      Args:
        fn: The function to run. The output must be a `tf.nest` of `Tensor`s.
        args: (Optional) Positional arguments to `fn`.
        kwargs: (Optional) Keyword arguments to `fn`.
        options: (Optional) An instance of `tf.distribute.RunOptions` specifying
          the options to run `fn`.
  
      Returns:
        Return value from running `fn`.
      """
      return super(OneDeviceStrategy, self).run(
          fn, args, kwargs, options
      )
  
imports: from tensorflow.python.distribute import device_util
  from tensorflow.python.distribute import distribute_lib
  from tensorflow.python.distribute import distribute_utils
  from tensorflow.python.distribute import input_lib
  from tensorflow.python.distribute import input_util
  from tensorflow.python.distribute import numpy_dataset
  from tensorflow.python.distribute.v1 import input_lib
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import while_loop
  from tensorflow.python.util import nest
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 5 for calling the OneDeviceStrategy obj's underlying member method code with example usage: obj.run(fn, args, kwargs, options) and returns: super