bartorch.interpolate#
- bartorch.interpolate(input, coord, axes, *, order=1)#
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.- Parameters:
input (torch.Tensor)
coord (torch.Tensor) – Real positions of shape
(..., len(axes)); componentiof the last axis is the position alongaxes[i]. The leading shape is aligned right againstinput.shape: along each ofaxesit is the output size, along every other axis it is one (the positions are shared) or the input’s size. Along an axis outside the last three (bart interpolate -xsizes only BART dims 0-2) the output size must equal the input’s.axes (int or tuple of int) – Axes interpolated over.
order ({0, 1, 3}) – Nearest neighbour (
-N, rounds half up), linear, or Keys cubic witha = -1/2(-C).
- Returns:
input.shapewith each ofaxesreplaced bycoord’s size there.- Return type:
torch.Tensor
Examples
>>> line = interpolate(image, torch.tensor([[1.5, 2.0]]), axes=(-2, -1)) # (1, 1)