mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Add torch.Tensor._make_wrapper_subclass to torch/_C/__init__.pyi (#154022)
Fixes #153790 Pull Request resolved: https://github.com/pytorch/pytorch/pull/154022 Approved by: https://github.com/Skylion007
This commit is contained in:
committed by
PyTorch MergeBot
parent
d88699308f
commit
0a7eef140b
@ -138,13 +138,14 @@ class SparseSemiStructuredTensor(torch.Tensor):
|
||||
else:
|
||||
raise ValueError("At least one of packed or packed_t must be provided")
|
||||
|
||||
kwargs = {
|
||||
"device": previous_tensor.device,
|
||||
"dtype": previous_tensor.dtype,
|
||||
"layout": previous_tensor.layout,
|
||||
"requires_grad": requires_grad,
|
||||
}
|
||||
tensor = torch.Tensor._make_wrapper_subclass(cls, shape, **kwargs) # type: ignore[attr-defined]
|
||||
tensor = torch.Tensor._make_wrapper_subclass(
|
||||
cls,
|
||||
shape,
|
||||
device=previous_tensor.device,
|
||||
dtype=previous_tensor.dtype,
|
||||
layout=previous_tensor.layout,
|
||||
requires_grad=requires_grad,
|
||||
)
|
||||
|
||||
tensor.packed = packed
|
||||
tensor.meta = meta
|
||||
|
||||
Reference in New Issue
Block a user