Tensor.zeros¶
Create a tensor with all admissible blocks filled with zeros.
zeros
classmethod
¶
zeros(
indices: Sequence[Index],
dtype: dtype = torch.float64,
itags: Optional[Sequence[str]] = None,
device: Optional[Union[str, device]] = None,
requires_grad: bool = False,
) -> Tensor
Create a symmetry-aware tensor with admissible zero-filled blocks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
indices
|
Sequence[Index]
|
Sequence of Index objects defining the tensor structure |
required |
dtype
|
dtype
|
Data type for the tensor blocks (default: torch.float64) |
float64
|
itags
|
Sequence[str]
|
Tags for each index (default: "init" for all) |
None
|
device
|
str or device
|
Device to place tensors on (default: current default device) |
None
|
requires_grad
|
bool
|
If True, enables gradient tracking for this tensor (default: False) |
False
|
Notes
Gradient tracking follows PyTorch's default behavior. Set requires_grad=True to enable autograd for this tensor. Use torch.no_grad() context to temporarily disable gradient computation during operations.
MPS (Apple Silicon) doesn't support float64/complex128. If creating on MPS with these dtypes, they will be automatically downgraded to float32/complex64.
For generic symmetry groups (e.g., SU2), intertwiners (intw) are automatically populated with Bridge objects containing default Clebsch-Gordan specifications.
Description¶
Creates a new tensor with zero-filled blocks for all charge combinations that satisfy conservation rules. The tensor structure is defined by the provided indices.
See Also¶
- random: Create random tensor
- Tensor: Main tensor class
- Examples: First Tensor
Notes¶
Only admissible blocks (satisfying charge conservation) are created. The number of blocks depends on the index sectors and symmetry group.