computation.py 892 B

1234567891011121314151617181920212223242526
  1. import torch._C._lazy
  2. import torch._C._lazy_ts_backend
  3. def get_tensors_ts_device_data_node(tensors):
  4. """Return tensor ids and eager tensors for DeviceData nodes in the
  5. IR for the passed in lazy tensors.
  6. TODO: This API is currently ts backend specific. We are working on
  7. generalizing it to all backends including XLA.
  8. """
  9. return torch._C._lazy_ts_backend._get_tensors_ts_device_data_node(tensors)
  10. def get_graph_hash(tensors):
  11. """Return the graph hash for the passed in lazy tensors"""
  12. return torch._C._lazy._get_graph_hash(tensors)
  13. def run_cached_graph(hash_str, graph_inputs):
  14. """Running the cached computation graph with the given inputs
  15. TODO: This API is currently ts backend specific. We are working on
  16. generalizing it to all backends including XLA.
  17. """
  18. return torch._C._lazy_ts_backend._run_cached_graph(hash_str, graph_inputs)