Initial project scaffold
This commit is contained in:
26
tasks/06_pytorch_custom_op/extension_skeleton.py
Normal file
26
tasks/06_pytorch_custom_op/extension_skeleton.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
if str(ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
import torch
|
||||
|
||||
from tools.lab_extension import build_extension
|
||||
|
||||
|
||||
def main() -> None:
|
||||
ext = build_extension(verbose=True)
|
||||
if ext is None:
|
||||
return
|
||||
print("Extension loaded.")
|
||||
print("Available torch.ops namespace:", hasattr(torch.ops, "kernel_lab"))
|
||||
if hasattr(torch.ops, "kernel_lab"):
|
||||
print("Registered ops:", dir(torch.ops.kernel_lab))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user