code: def fn_device_dependency(name, device=""):
    
    key = name + "_" + device
    outs = []
  
    def body():
      with tf.control_dependencies(fn_device_dependency_dict()[key]):
        yield outs
        assert outs
  
        deps = outs
        if isinstance(outs[0], (list, tuple)):
          assert len(outs) == 1
          deps = outs[0]
        fn_device_dependency_dict()[key] = deps
  
    if device:
      with tf.device(device):
        return body()
    else:
      return body()
docs: Add control deps for name and device.