(tensor: torch.Tensor, spec: TensorSpec)
| 401 | |
| 402 | |
| 403 | def check_spec(tensor: torch.Tensor, spec: TensorSpec) -> None: |
| 404 | internal_assert( |
| 405 | tensor.is_sparse == spec.is_sparse, |
| 406 | f"Tensor attribute 'is_sparse' is expected to be equal to '{spec.is_sparse}', actually got: '{tensor.is_sparse}'", |
| 407 | ) |
| 408 | internal_assert( |
| 409 | tensor.shape == spec.shape, |
| 410 | f"Tensor attribute 'shape' is expected to be equal to '{spec.shape}', actually got: '{tensor.shape}'", |
| 411 | ) |
| 412 | internal_assert( |
| 413 | tensor.dtype == spec.dtype, |
| 414 | f"Tensor attribute 'dtype' is expected to be equal to '{spec.dtype}', actually got: '{tensor.dtype}'", |
| 415 | ) |
nothing calls this directly
no test coverage detected