def _on_device(fn, device):
    "Build the subgraph defined by lambda `fn` on `device` if it's not None."
    if device:
        with ops.device(device):
            return fn()
    else:
        return fn()
Build the subgraph defined by lambda `fn` on `device` if it's not None.
def _on_device(fn, device):
    
    if device:
        with ops.device(device):
            return fn()
    else:
        return fn()