(
self,
dtype: torch.dtype,
shape: torch.Size,
layout: torch.layout = torch.strided,
is_sparse: bool = False,
const: bool = False,
requires_grad: bool = False,
extra_tensor_info: Optional[ExtraTensorInfo] = None,
)
| 150 | """ |
| 151 | |
| 152 | def __init__( |
| 153 | self, |
| 154 | dtype: torch.dtype, |
| 155 | shape: torch.Size, |
| 156 | layout: torch.layout = torch.strided, |
| 157 | is_sparse: bool = False, |
| 158 | const: bool = False, |
| 159 | requires_grad: bool = False, |
| 160 | extra_tensor_info: Optional[ExtraTensorInfo] = None, |
| 161 | ) -> None: |
| 162 | self.scalar_type = dtype |
| 163 | self.const = const |
| 164 | self.alignment: int = ALIGNMENT |
| 165 | self.storage: Optional[torch.UntypedStorage] = None |
| 166 | # convert to list making it easier to handle type checking |
| 167 | self.shape: List[int] = list(shape) |
| 168 | self.stride: Tuple[int] = contiguous_stride_from_shape(shape) |
| 169 | self.dim_order: Tuple[bytes] = dim_order_from_stride(self.stride) |
| 170 | self.requires_grad = requires_grad |
| 171 | self.layout = layout |
| 172 | self.is_sparse = is_sparse |
| 173 | self.init_mem_planning_fields() |
| 174 | self.shape_dynamism: TensorShapeDynamism = determine_tensor_dynanism(self.shape) |
| 175 | self.extra_tensor_info = extra_tensor_info |
| 176 | # device type will be only updated during PropagateDevicePass. |
| 177 | self.device: schema.DeviceType = schema.DeviceType.CPU |
| 178 | self.device_index: int = 0 |
| 179 | |
| 180 | @property |
| 181 | def allocated_memory(self) -> int: |
nothing calls this directly
no test coverage detected