mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/69064 This commit upstreams helpers for converting a c10::Device to BackendDevice and vice versa. Test Plan: ./build/bin/test_lazy --gtest_filter=BackendDeviceTest.FromAten:BackendDeviceTest.ToAten Reviewed By: wconstab Differential Revision: D32732607 Pulled By: alanwaketan fbshipit-source-id: 0dd233d37a4a30fc4b22dba322ddd85d4cb3635b
18 lines
408 B
C++
18 lines
408 B
C++
#include <torch/csrc/lazy/backend/backend_interface.h>
|
|
|
|
namespace torch {
|
|
namespace lazy {
|
|
|
|
namespace {
|
|
std::atomic<const BackendImplInterface*> backend_impl_registry;
|
|
} // namespace
|
|
|
|
const BackendImplInterface* getBackend() {
|
|
auto* interface = backend_impl_registry.load();
|
|
TORCH_CHECK(interface, "Lazy tensor backend not registered.");
|
|
return interface;
|
|
}
|
|
|
|
} // namespace lazy
|
|
} // namespace torch
|