PytorchBackend#
- class PytorchBackend(device='cuda', float_dtype=None, complex_dtype=None, int_dtype=None, overflow_safe_dtype=None, **kwargs)[source]#
Bases:
NumpyFFTWBackend
A pytorch-based matching backend.
Methods
PytorchBackend.abs
(*args, **kwargs)Compute the absolute of array elements.
PytorchBackend.add
(*args, **kwargs)Element-wise addition of arrays.
PytorchBackend.arange
(*args, **kwargs)Arange values in evenly spaced interval.
PytorchBackend.argsort
(*args, **kwargs)Compute the indices to sort a given input array.
PytorchBackend.astype
(arr, dtype)Change the datatype of arr.
PytorchBackend.build_fft
(fast_shape, ...[, ...])Build forward and inverse real fourier transform functions.
PytorchBackend.center_of_mass
(arr[, cutoff])Computes the center of mass of a numpy ndarray instance using all available elements.
PytorchBackend.clip
(*args, **kwargs)Clip elements of arr.
Computes regular, optimized and fourier convolution shape.
PytorchBackend.concatenate
(*args, **kwargs)Join a sequence of objects along an existing axis.
Return the number of bytes occupied by a given datatype.
Returns the number of available GPU devices.
PytorchBackend.divide
(*args, **kwargs)Element-wise division of arrays.
PytorchBackend.dot
(*args, **kwargs)PytorchBackend.einsum
(*args, **kwargs)Compute the einstein notation based summation.
PytorchBackend.eps
(dtype)Returns the minimal difference representable by dtype.
PytorchBackend.extract_center
(arr, newshape)Extract the centered portion of an array based on a new shape.
PytorchBackend.fill
(arr, value)Fills
arr
in-place with a given value.PytorchBackend.flip
(a, axis, **kwargs)Free cached objects allocated by backend.
Returns an array of given shape and dtype from shared memory location.
PytorchBackend.full
(shape, fill_value[, dtype])Returns an array filled with fill_value of specified shape and dtype.
Returns the available memory available for computations in bytes.
Given an array instance, returns the corresponding fundamental python type, i.e., int, float or complex.
PytorchBackend.identity
(*args, **kwargs)PytorchBackend.indices
(shape)Creates an array representing the index grid of an input.
PytorchBackend.max
(*args, **kwargs)Compute the maximum of array elements.
Identifies local maxima in score_space separated by min_distance.
Update elements in
max_scores
androtations
where scores is larger than max_scores with score and rotation_index, respectivelty.PytorchBackend.maximum
(x1, x2, *args, **kwargs)Compute the element wise maximum of arr1 and arr2.
PytorchBackend.mean
(*args, **kwargs)Compute the mean of array elements.
PytorchBackend.min
(*args, **kwargs)Compute the minimum of array elements.
PytorchBackend.minimum
(x1, x2, *args, **kwargs)Compute the element wise minimum of arr1 and arr2.
PytorchBackend.mod
(x1, x2, *args, **kwargs)Element-wise modulus of arrays.
PytorchBackend.multiply
(*args, **kwargs)Element-wise multiplication of arrays.
PytorchBackend.norm_scores
(arr, exp_sq, ...)Normalizes
arr
by the standard deviation ensuring numerical stability.PytorchBackend.power
(*args, **kwargs)Compute the n-th power of an array.
PytorchBackend.repeat
(*args, **kwargs)Repeat each array element a specified number of times.
PytorchBackend.reshape
(*args, **kwargs)Reverse the order of elements in an array along all its axes.
PytorchBackend.rigid_transform
(arr, ...[, ...])Rotates the given tensor arr based on the provided rotation_matrix.
PytorchBackend.roll
(a, shift, axis, **kwargs)Roll array elements along a specified axis.
PytorchBackend.set_device
(device_index)Context manager that sets active compute device device for operations.
PytorchBackend.size
(arr)Compute the number of elements of arr.
PytorchBackend.sqrt
(*args, **kwargs)Compute the square root of array elements.
PytorchBackend.square
(*args, **kwargs)Compute the square of array elements.
PytorchBackend.stack
(*args, **kwargs)Join a sequence of objects along a new axis.
PytorchBackend.std
(*args, **kwargs)Compute the standad deviation of array elements.
PytorchBackend.subtract
(*args, **kwargs)Element-wise subtraction of arrays.
PytorchBackend.sum
(*args, **kwargs)Compute the sum of array elements.
Convert a numpy array instance to backend array type.
Convert an array of a given backend to a CPU array of that backend.
Convert an array of given backend to a numpy array.
PytorchBackend.to_sharedarr
(arr[, ...])Converts an array to an object shared in memory.
Compute the bytestring representation of arr.
PytorchBackend.topk_indices
(arr, k)Determinces the indices of largest elements.
PytorchBackend.topleft_pad
(arr, shape[, padval])Returns an array that has been padded to a specified shape with a padding value at the top-left corner.
Compute the transpose of arr.
PytorchBackend.tril_indices
(*args, **kwargs)Compute indices of upper triangular matrix
PytorchBackend.unique
(ar[, return_index, ...])Find the unique elements of an array.
PytorchBackend.unravel_index
(indices, shape)Convert flat index to array indices.
PytorchBackend.where
(*args, **kwargs)Return elements from input depending on
condition
.PytorchBackend.zeros
(shape[, dtype])Returns an aligned array of zeros with specified shape and dtype.