Repository: pytorch
Issue: Cannot subclass _TensorBase directly error
Labels: triaged,module: python frontend

### 🐛 Describe the bug

Hi,
I was asked to report an issue here from https://github.com/wootwootwootwoot/ComfyUI-RK-Sampler/issues/1 .
I am on Torch nightly and at first launch of ComfyUI after installing the ComfyUI-RK-Sampler, I receive the following:

`Traceback (most recent call last):
File "D:\ComfyUI\nodes.py", line 1931, in load_custom_node
module_spec.loader.exec_module(module)
File "", line 940, in exec_module
File "", line 241, in call_with_frames_removed
File "D:\ComfyUI\custom_nodes\ComfyUI-RK-Sampler_init.py", line 8, in
from .nodes import nodes_rk_sampler
File "D:\ComfyUI\custom_nodes\ComfyUI-RK-Sampler\nodes\nodes_rk_sampler.py", line 4, in
import torchode
File "D:\ComfyUI\venv\Lib\site-packages\torchode_init_.py", line 5, in
from .adjoints import AutoDiffAdjoint, BacksolveAdjoint, JointBacksolveAdjoint
File "D:\ComfyUI\venv\Lib\site-packages\torchode\adjoints.py", line 7, in
from .problems import InitialValueProblem
File "D:\ComfyUI\venv\Lib\site-packages\torchode\problems.py", line 3, in
from .typing import *
File "D:\ComfyUI\venv\Lib\site-packages\torchode\typing.py", line 4, in
from torchtyping import TensorType, is_float
File "D:\ComfyUI\venv\Lib\site-packages\torchtyping_init_.py", line 10, in
from .tensor_type import TensorType
File "D:\ComfyUI\venv\Lib\site-packages\torchtyping\tensor_type.py", line 37, in
class TensorTypeMixin(metaclass=_TensorTypeMeta):
RuntimeError: Cannot subclass _TensorBase directly

Cannot import D:\ComfyUI\custom_nodes\ComfyUI-RK-Sampler module for custom nodes: Cannot subclass _TensorBase directly`

### Versions

(venv) D:\ComfyUI>python collect_env.py
Collecting environment information...
PyTorch version: 2.5.0.dev20240713+cu124
Is debug build: False
CUDA used to build PyTorch: 12.4
ROCM used to build PyTorch: N/A

OS: Microsoft Windows 11 Home
GCC version: Could not collect
Clang version: Could not collect
CMake version: version 3.29.5
Libc version: N/A

Python version: 3.11.9 (tags/v3.11.9:de54cf5, Apr  2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)] (64-bit runtime)
Python platform: Windows-10-10.0.22631-SP0
Is CUDA available: True
CUDA runtime version: 12.4.131
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 4090
Nvidia driver version: 560.70
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture=9
CurrentClockSpeed=3400
DeviceID=CPU0
Family=198
L2CacheSize=24576
L2CacheSpeed=
Manufacturer=GenuineIntel
MaxClockSpeed=3400
Name=13th Gen Intel(R) Core(TM) i7-13700KF
ProcessorType=3
Revision=

Versions of relevant libraries:
[pip3] numpy==1.26.4
[pip3] onnx==1.16.1
[pip3] onnx2torch==1.5.14
[pip3] onnxruntime==1.18.1
[pip3] onnxruntime-gpu==1.18.1
[pip3] open_clip_torch==2.26.1
[pip3] optree==0.12.1
[pip3] pytorch-lightning==2.3.3
[pip3] torch==2.5.0.dev20240713+cu124
[pip3] torchaudio==2.4.0.dev20240714+cu124
[pip3] torchdiffeq==0.2.4
[pip3] torchmetrics==1.4.0.post0
[pip3] torchode==0.2.0
[pip3] torchsde==0.2.6
[pip3] torchtools==0.3.5
[pip3] torchtyping==0.1.4
[pip3] torchvision==0.20.0.dev20240713+cu124
[conda] No relevant packages

cc @albanD