bartorch.interpolate#
- bartorch.interpolate()#
Sample
inputat the voxel positionscoordalongaxes.out[..., q, ...] = sum_j input[..., j, ...] w(coord[q, i] - j_i)over theaxes, wherewis the kernel oforder. Positions are array indices:coord = 2.0is the sampleinput[2]. The grid is zero outside[0, n - 1], so a position within one kernel radius of the edge is weighted against zeros. BART’sinterpolate.- Parameters:
input (torch.Tensor) – Array to sample.
coord (torch.Tensor) – Real positions
(..., len(axes)): componentiis the position alongaxes[i]. The leading shape aligns right againstinput.shape: the output size along each ofaxes, and one (shared positions) or the input’s size elsewhere. Along an axis before the last three, the output size must equal the input’s.axes (int or tuple of int) – Axes interpolated over.
order ({0, 1, 3}, default=1) – Nearest neighbour (rounding half up), linear, or Keys cubic with
a = -1/2.
- Returns:
input.shapewith each ofaxesreplaced bycoord’s size there.- Return type:
torch.Tensor
- Raises:
ValueError – If
coorddoes not matchinputas described.
Examples
>>> line = interpolate(image, torch.tensor([[1.5, 2.0]]), axes=(-2, -1)) # (1, 1)