parameter.pyi 936 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # mypy: allow-untyped-defs
  2. import builtins
  3. from typing import Optional, Tuple
  4. import torch
  5. from torch import Tensor
  6. class Parameter(Tensor):
  7. def __init__(
  8. self,
  9. data: Tensor = ...,
  10. requires_grad: builtins.bool = ...,
  11. ): ...
  12. def is_lazy(param: Tensor): ...
  13. class UninitializedParameter(Tensor):
  14. def __init__(
  15. self,
  16. data: Tensor = ...,
  17. requires_grad: builtins.bool = ...,
  18. ): ...
  19. def materialize(
  20. self,
  21. shape: Tuple[int, ...],
  22. device: Optional[torch.device] = None,
  23. dtype: Optional[torch.dtype] = None,
  24. ): ...
  25. class UninitializedBuffer(Tensor):
  26. def __init__(
  27. self,
  28. data: Tensor = ...,
  29. requires_grad: builtins.bool = ...,
  30. ): ...
  31. def materialize(
  32. self,
  33. shape: Tuple[int, ...],
  34. device: Optional[torch.device] = None,
  35. dtype: Optional[torch.dtype] = None,
  36. ): ...