[Easy][pytree] enable CXX pytree under torch::deploy (#130144)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/130144
Approved by: https://github.com/zou3519
ghstack dependencies: #130895, #130139
This commit is contained in:
Xuehai Pan 2024-07-19 22:09:54 +08:00 committed by PyTorch MergeBot
parent ddde9dd25c
commit 1439bd3c9c

View File

@ -29,11 +29,6 @@ from typing import (
)
from typing_extensions import deprecated
import torch
if torch._running_with_deploy(): # type: ignore[no-untyped-call]
raise ImportError("C++ pytree utilities do not work with torch::deploy.")
import optree
from optree import PyTreeSpec # direct import for type annotations