torch — PyTorch 2.5 documentation (original) (raw)

abs

Computes the absolute value of each element in input.

absolute

Alias for torch.abs()

acos

Computes the inverse cosine of each element in input.

arccos

Alias for torch.acos().

acosh

Returns a new tensor with the inverse hyperbolic cosine of the elements of input.

arccosh

Alias for torch.acosh().

add

Adds other, scaled by alpha, to input.

addcdiv

Performs the element-wise division of tensor1 by tensor2, multiplies the result by the scalar value and adds it to input.

addcmul

Performs the element-wise multiplication of tensor1 by tensor2, multiplies the result by the scalar value and adds it to input.

angle

Computes the element-wise angle (in radians) of the given input tensor.

asin

Returns a new tensor with the arcsine of the elements of input.

arcsin

Alias for torch.asin().

asinh

Returns a new tensor with the inverse hyperbolic sine of the elements of input.

arcsinh

Alias for torch.asinh().

atan

Returns a new tensor with the arctangent of the elements of input.

arctan

Alias for torch.atan().

atanh

Returns a new tensor with the inverse hyperbolic tangent of the elements of input.

arctanh

Alias for torch.atanh().

atan2

Element-wise arctangent of inputi/otheri\text{input}_{i} / \text{other}_{i} with consideration of the quadrant.

arctan2

Alias for torch.atan2().

bitwise_not

Computes the bitwise NOT of the given input tensor.

bitwise_and

Computes the bitwise AND of input and other.

bitwise_or

Computes the bitwise OR of input and other.

bitwise_xor

Computes the bitwise XOR of input and other.

bitwise_left_shift

Computes the left arithmetic shift of input by other bits.

bitwise_right_shift

Computes the right arithmetic shift of input by other bits.

ceil

Returns a new tensor with the ceil of the elements of input, the smallest integer greater than or equal to each element.

clamp

Clamps all elements in input into the range [ min, max ].

clip

Alias for torch.clamp().

conj_physical

Computes the element-wise conjugate of the given input tensor.

copysign

Create a new floating-point tensor with the magnitude of input and the sign of other, elementwise.

cos

Returns a new tensor with the cosine of the elements of input.

cosh

Returns a new tensor with the hyperbolic cosine of the elements of input.

deg2rad

Returns a new tensor with each of the elements of input converted from angles in degrees to radians.

div

Divides each element of the input input by the corresponding element of other.

divide

Alias for torch.div().

digamma

Alias for torch.special.digamma().

erf

Alias for torch.special.erf().

erfc

Alias for torch.special.erfc().

erfinv

Alias for torch.special.erfinv().

exp

Returns a new tensor with the exponential of the elements of the input tensor input.

exp2

Alias for torch.special.exp2().

expm1

Alias for torch.special.expm1().

fake_quantize_per_channel_affine

Returns a new tensor with the data in input fake quantized per channel using scale, zero_point, quant_min and quant_max, across the channel specified by axis.

fake_quantize_per_tensor_affine

Returns a new tensor with the data in input fake quantized using scale, zero_point, quant_min and quant_max.

fix

Alias for torch.trunc()

float_power

Raises input to the power of exponent, elementwise, in double precision.

floor

Returns a new tensor with the floor of the elements of input, the largest integer less than or equal to each element.

floor_divide

fmod

Applies C++'s std::fmod entrywise.

frac

Computes the fractional portion of each element in input.

frexp

Decomposes input into mantissa and exponent tensors such that input=mantissa×2exponent\text{input} = \text{mantissa} \times 2^{\text{exponent}}.

gradient

Estimates the gradient of a function g:Rn→Rg : \mathbb{R}^n \rightarrow \mathbb{R} in one or more dimensions using the second-order accurate central differences method and either first or second order estimates at the boundaries.

imag

Returns a new tensor containing imaginary values of the self tensor.

ldexp

Multiplies input by 2 ** other.

lerp

Does a linear interpolation of two tensors start (given by input) and end based on a scalar or tensor weight and returns the resulting out tensor.

lgamma

Computes the natural logarithm of the absolute value of the gamma function on input.

log

Returns a new tensor with the natural logarithm of the elements of input.

log10

Returns a new tensor with the logarithm to the base 10 of the elements of input.

log1p

Returns a new tensor with the natural logarithm of (1 + input).

log2

Returns a new tensor with the logarithm to the base 2 of the elements of input.

logaddexp

Logarithm of the sum of exponentiations of the inputs.

logaddexp2

Logarithm of the sum of exponentiations of the inputs in base-2.

logical_and

Computes the element-wise logical AND of the given input tensors.

logical_not

Computes the element-wise logical NOT of the given input tensor.

logical_or

Computes the element-wise logical OR of the given input tensors.

logical_xor

Computes the element-wise logical XOR of the given input tensors.

logit

Alias for torch.special.logit().

hypot

Given the legs of a right triangle, return its hypotenuse.

i0

Alias for torch.special.i0().

igamma

Alias for torch.special.gammainc().

igammac

Alias for torch.special.gammaincc().

mul

Multiplies input by other.

multiply

Alias for torch.mul().

mvlgamma

Alias for torch.special.multigammaln().

nan_to_num

Replaces NaN, positive infinity, and negative infinity values in input with the values specified by nan, posinf, and neginf, respectively.

neg

Returns a new tensor with the negative of the elements of input.

negative

Alias for torch.neg()

nextafter

Return the next floating-point value after input towards other, elementwise.

polygamma

Alias for torch.special.polygamma().

positive

Returns input.

pow

Takes the power of each element in input with exponent and returns a tensor with the result.

quantized_batch_norm

Applies batch normalization on a 4D (NCHW) quantized tensor.

quantized_max_pool1d

Applies a 1D max pooling over an input quantized tensor composed of several input planes.

quantized_max_pool2d

Applies a 2D max pooling over an input quantized tensor composed of several input planes.

rad2deg

Returns a new tensor with each of the elements of input converted from angles in radians to degrees.

real

Returns a new tensor containing real values of the self tensor.

reciprocal

Returns a new tensor with the reciprocal of the elements of input

remainder

Computes Python's modulus operation entrywise.

round

Rounds elements of input to the nearest integer.

rsqrt

Returns a new tensor with the reciprocal of the square-root of each of the elements of input.

sigmoid

Alias for torch.special.expit().

sign

Returns a new tensor with the signs of the elements of input.

sgn

This function is an extension of torch.sign() to complex tensors.

signbit

Tests if each element of input has its sign bit set or not.

sin

Returns a new tensor with the sine of the elements of input.

sinc

Alias for torch.special.sinc().

sinh

Returns a new tensor with the hyperbolic sine of the elements of input.

softmax

Alias for torch.nn.functional.softmax().

sqrt

Returns a new tensor with the square-root of the elements of input.

square

Returns a new tensor with the square of the elements of input.

sub

Subtracts other, scaled by alpha, from input.

subtract

Alias for torch.sub().

tan

Returns a new tensor with the tangent of the elements of input.

tanh

Returns a new tensor with the hyperbolic tangent of the elements of input.

true_divide

Alias for torch.div() with rounding_mode=None.

trunc

Returns a new tensor with the truncated integer values of the elements of input.

xlogy

Alias for torch.special.xlogy().