leideng/QCFuse / srt /compilation /weak_ref_tensor_jit.py
leideng's picture
download
raw
390 Bytes
import os
import torch
from torch.utils.cpp_extension import load
_abs_path = os.path.dirname(os.path.abspath(__file__))
load(
name="weak_ref_tensor_ext",
sources=[f"{_abs_path}/weak_ref_tensor.cpp"],
extra_cflags=["-O3"],
)
x = torch.arange(12, device="cuda").reshape(3, 4)
y = torch.ops.jit_weak_ref_tensor.weak_ref_tensor(x)
print("alias:", x.data_ptr() == y.data_ptr())

Xet Storage Details

Size:
390 Bytes
·
Xet hash:
491202e56d04c2d5df8cff5b9b956a9cd98c61c2382ba8e77f0ee8dbd9886e96

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.