xnn.cnn.models.base.grid_coordinates#

xnn.cnn.models.base.grid_coordinates(size, dtype=torch.float64, device=None)[source]#

Integer-centered coordinates of a cubic grid.

Parameters:
  • size (int) – Voxels per axis.

  • dtype (dtype) – Of the returned tensor.

  • device (device | None) – Of the returned tensor.

Returns:

Shape (size, size, size, 3); axis a of voxel (i, j, k) is (i, j, k)[a] - (size - 1) / 2 (the origin at the center).

Return type:

Tensor