# tensorplay.nn.attention.bias API Source: https://www.tensorplay.cn/docs/api/tensorplay.nn.attention.bias.html ## Functions 2 [#](#api-tensorplay.nn.attention.bias.causal_lower_right) ### causal_lower_right function[Full reference ↗](/docs/generated/tensorplay.nn.attention.bias.causal_lower_right.html) ```python tensorplay.nn.attention.bias.causal_lower_right(*size) → CausalBias ``` Creates a lower-right triangular causal bias. This function generates a lower-right triangular matrix to represent causal attention bias with a diagonal offset set so that the inclusive values are aligned to the lower right corner of the matrix. The equivalent code for constructing this bias is: ``` diagonal_offset = size[1] - size[0] tensorplay.tril( tensorplay.ones(size, dtype=tensorplay.bool), diagonal=diagonal_offset, ) ``` For instance, with shape=(3,4), the materialized bias tensor will be: ``` [[1, 1, 0, 0], [1, 1, 1, 0], [1, 1, 1, 1]] ``` Parameters: size – The size of the bias matrix. Returns: The LOWER_RIGHT triangular causal bias variant. Return type: [CausalBias](/docs/generated/tensorplay.nn.attention.bias.CausalBias.html#tensorplay.nn.attention.bias.CausalBias) [#](#api-tensorplay.nn.attention.bias.causal_upper_left) ### causal_upper_left function[Full reference ↗](/docs/generated/tensorplay.nn.attention.bias.causal_upper_left.html) ```python tensorplay.nn.attention.bias.causal_upper_left(*size) → CausalBias ``` Creates an upper-left triangular causal bias. This function generates an upper-left triangular matrix to represent causal attention bias with a diagonal offset set so that the inclusive values are aligned to the upper left corner of the matrix. This equivalent to the is_causal=True argument in scaled_dot_product_attention. The equivalent code for constructing this bias is: ``` tensorplay.tril(tensorplay.ones(size, dtype=tensorplay.bool)) ``` For instance, with shape=(3,4), the materialized bias tensor will be: ``` [[1, 0, 0, 0], [1, 1, 0, 0], [1, 1, 1, 0]] ``` Parameters: size – The size of the bias matrix. Returns: The UPPER_LEFT triangular causal bias variant. Return type: [CausalBias](/docs/generated/tensorplay.nn.attention.bias.CausalBias.html#tensorplay.nn.attention.bias.CausalBias) ## Classes 2 [#](#api-tensorplay.nn.attention.bias.CausalBias) ### CausalBias class[Full reference ↗](/docs/generated/tensorplay.nn.attention.bias.CausalBias.html) ```python class tensorplay.nn.attention.bias.CausalBias(variant: CausalVariant, seq_len_q: int, seq_len_kv: int) ``` A bias representing causal attention patterns. For an overview of the bias structure, see the [CausalVariant](/docs/generated/tensorplay.nn.attention.bias.CausalVariant.html#tensorplay.nn.attention.bias.CausalVariant) enum. This class is used for defining causal (triangular) attention biases. For constructing the bias, there exist two factory functions: [causal_upper_left()](/docs/generated/tensorplay.nn.attention.bias.causal_upper_left.html#tensorplay.nn.attention.bias.causal_upper_left) and [causal_lower_right()](/docs/generated/tensorplay.nn.attention.bias.causal_lower_right.html#tensorplay.nn.attention.bias.causal_lower_right). Example: ``` from tensorplay.nn.attention.bias import causal_lower_right bsz, num_heads, seqlen_q, seqlen_kv, head_dim = 32, 8, 4, 12, 8 # Create a lower-right causal bias attn_bias = causal_lower_right(seqlen_q, seqlen_kv) q = tensorplay.randn( bsz, num_heads, seqlen_q, head_dim, device="cuda", dtype=tensorplay.float16 ) k = tensorplay.randn( bsz, num_heads, seqlen_kv, head_dim, device="cuda", dtype=tensorplay.float16 ) v = tensorplay.randn( bsz, num_heads, seqlen_kv, head_dim, device="cuda", dtype=tensorplay.float16 ) out = F.scaled_dot_product_attention(q, k, v, attn_bias) ``` > **Warning** > > This class is a prototype and subject to change. ```python abs() ``` abs(Tensor self) -> Tensor ```python abs_() ``` abs_(Tensor(a!) self) -> Tensor(a!) ```python absolute() ``` absolute(Tensor self) -> Tensor ```python absolute_() ``` absolute_(Tensor(a!) self) -> Tensor(a!) ```python acos() ``` acos(Tensor self) -> Tensor ```python acos_() ``` acos_(Tensor(a!) self) -> Tensor(a!) ```python acosh() ``` acosh(Tensor self) -> Tensor ```python acosh_() ``` acosh_(Tensor(a!) self) -> Tensor(a!) ```python add() ``` add.Tensor(Tensor self, Tensor other, *, Scalar alpha=1) -> Tensor add.Scalar(Tensor self, Scalar other, Scalar alpha=1) -> Tensor ```python add_(other, *, alpha=1) → Tensor ``` In-place version of tensorplay.Tensor.add() ```python addbmm() ``` addbmm(Tensor self, Tensor batch1, Tensor batch2, *, Scalar beta=1, Scalar alpha=1) -> Tensor ```python addbmm_() ``` addbmm_(Tensor(a!) self, Tensor batch1, Tensor batch2, *, Scalar beta=1, Scalar alpha=1) -> Tensor(a!) ```python addcdiv() ``` addcdiv(Tensor self, Tensor tensor1, Tensor tensor2, *, Scalar value=1) -> Tensor ```python addcdiv_() ``` addcdiv_(Tensor(a!) self, Tensor tensor1, Tensor tensor2, *, Scalar value=1) -> Tensor(a!) ```python addcmul() ``` addcmul(Tensor self, Tensor tensor1, Tensor tensor2, *, Scalar value=1) -> Tensor ```python addcmul_() ``` addcmul_(Tensor(a!) self, Tensor tensor1, Tensor tensor2, *, Scalar value=1) -> Tensor(a!) ```python addmm() ``` addmm(Tensor self, Tensor mat1, Tensor mat2, *, Scalar beta=1, Scalar alpha=1) -> Tensor ```python addmm_() ``` addmm_(Tensor(a!) self, Tensor mat1, Tensor mat2, *, Scalar beta=1, Scalar alpha=1) -> Tensor(a!) ```python addmv() ``` addmv(Tensor self, Tensor mat, Tensor vec, *, Scalar beta=1, Scalar alpha=1) -> Tensor ```python addmv_() ``` addmv_(Tensor(a!) self, Tensor mat, Tensor vec, *, Scalar beta=1, Scalar alpha=1) -> Tensor(a!) ```python addr() ``` addr(Tensor self, Tensor vec1, Tensor vec2, *, Scalar beta=1, Scalar alpha=1) -> Tensor ```python addr_() ``` addr_(Tensor(a!) self, Tensor vec1, Tensor vec2, *, Scalar beta=1, Scalar alpha=1) -> Tensor(a!) ```python adjoint() ``` adjoint(Tensor(a) self) -> Tensor(a) ```python airy_ai() ``` airy_ai(Tensor self) -> Tensor ```python alias() ``` alias(Tensor(a) self) -> Tensor(a) ```python all() ``` all(Tensor self) -> Tensor all.dim(Tensor self, int dim, bool keepdim=False) -> Tensor all.dims(Tensor self, int[]? dim=None, bool keepdim=False) -> Tensor ```python allclose() ``` allclose(Tensor self, Tensor other, float rtol=1e-05, float atol=1e-08, bool equal_nan=False) -> bool ```python alpha_dropout_() ``` alpha_dropout_(Tensor(a!) self, float p=0.5, bool train=True) -> Tensor(a!) ```python aminmax() ``` aminmax(Tensor self, int[] dim=[], bool keepdim=False) -> (Tensor min, Tensor max) ```python angle() ``` angle(Tensor self) -> Tensor ```python any() ``` any(Tensor self) -> Tensor any.dim(Tensor self, int dim, bool keepdim=False) -> Tensor any.dims(Tensor self, int[]? dim=None, bool keepdim=False) -> Tensor ```python apply_(self: object, callable: object) → object ``` ```python arccos() ``` arccos(Tensor self) -> Tensor ```python arccos_() ``` arccos_(Tensor(a!) self) -> Tensor(a!) ```python arccosh() ``` arccosh(Tensor self) -> Tensor ```python arccosh_() ``` arccosh_(Tensor(a!) self) -> Tensor(a!) ```python arcsin() ``` arcsin(Tensor self) -> Tensor ```python arcsin_() ``` arcsin_(Tensor(a!) self) -> Tensor(a!) ```python arcsinh() ``` arcsinh(Tensor self) -> Tensor ```python arcsinh_() ``` arcsinh_(Tensor(a!) self) -> Tensor(a!) ```python arctan() ``` arctan(Tensor self) -> Tensor ```python arctan2() ``` arctan2(Tensor self, Tensor other) -> Tensor ```python arctan2_() ``` arctan2_(Tensor(a!) self, Tensor other) -> Tensor(a!) ```python arctan_() ``` arctan_(Tensor(a!) self) -> Tensor(a!) ```python arctanh() ``` arctanh(Tensor self) -> Tensor ```python arctanh_() ``` arctanh_(Tensor(a!) self) -> Tensor(a!) ```python argmax() ``` argmax(Tensor self, int? dim=None, bool keepdim=False) -> Tensor ```python argmin() ``` argmin(Tensor self, int? dim=None, bool keepdim=False) -> Tensor ```python argsort() ``` argsort(Tensor self, int dim=-1, bool descending=False) -> Tensor argsort.stable(Tensor self, *, bool stable, int dim=-1, bool descending=False) -> Tensor ```python argwhere() ``` argwhere(Tensor self) -> Tensor ```python as_strided_() ``` as_strided_(Tensor(a!) self, SymInt[] size, SymInt[] stride, SymInt? storage_offset=None) -> Tensor(a!) ```python as_strided_scatter() ``` as_strided_scatter(Tensor self, Tensor src, SymInt[] size, SymInt[] stride, SymInt? storage_offset=None) -> Tensor ```python as_subclass(self: object, cls: object) → object ``` ```python asin() ``` asin(Tensor self) -> Tensor ```python asin_() ``` asin_(Tensor(a!) self) -> Tensor(a!) ```python asinh() ``` asinh(Tensor self) -> Tensor ```python asinh_() ``` asinh_(Tensor(a!) self) -> Tensor(a!) ```python atan() ``` atan(Tensor self) -> Tensor ```python atan2() ``` atan2(Tensor self, Tensor other) -> Tensor ```python atan2_() ``` atan2_(Tensor(a!) self, Tensor other) -> Tensor(a!) ```python atan_() ``` atan_(Tensor(a!) self) -> Tensor(a!) ```python atanh() ``` atanh(Tensor self) -> Tensor ```python atanh_() ``` atanh_(Tensor(a!) self) -> Tensor(a!) ```python backward(self: tensorplay._C.TensorBase, gradient: tensorplay._C.TensorBase | None = None, retain_graph: bool | None = None, create_graph: bool = False, inputs: object = None) → None ``` ```python baddbmm() ``` baddbmm(Tensor self, Tensor batch1, Tensor batch2, *, Scalar beta=1, Scalar alpha=1) -> Tensor ```python baddbmm_() ``` baddbmm_(Tensor(a!) self, Tensor batch1, Tensor batch2, *, Scalar beta=1, Scalar alpha=1) -> Tensor(a!) ```python bernoulli() ``` bernoulli(Tensor self, *, Generator? generator=None) -> Tensor bernoulli.p(Tensor self, float p, *, Generator? generator=None) -> Tensor ```python bernoulli_(p=0.5, *, generator=None) → Tensor ``` Fills each element of this tensor with an independent sample from the Bernoulli distribution with success probability p, which may be a scalar or a tensor of per-element probabilities. The tensor may hold an integral dtype; each sample is written as 0 or 1. ```python bessel_j0() ``` bessel_j0(Tensor self) -> Tensor ```python bessel_j1() ``` bessel_j1(Tensor self) -> Tensor ```python bessel_y0() ``` bessel_y0(Tensor self) -> Tensor ```python bessel_y1() ``` bessel_y1(Tensor self) -> Tensor ```python bincount() ``` bincount(Tensor self, Tensor? weights=None, SymInt minlength=0) -> Tensor ```python bitwise_and() ``` bitwise_and.Tensor(Tensor self, Tensor other) -> Tensor bitwise_and.Scalar(Tensor self, Scalar other) -> Tensor ```python bitwise_and_() ``` bitwise_and_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!) bitwise_and_.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!) ```python bitwise_left_shift() ``` bitwise_left_shift.Tensor(Tensor self, Tensor other) -> Tensor bitwise_left_shift.Tensor_Scalar(Tensor self, Scalar other) -> Tensor ```python bitwise_left_shift_() ``` bitwise_left_shift_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!) bitwise_left_shift_.Tensor_Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!) ```python bitwise_not() ``` bitwise_not(Tensor self) -> Tensor ```python bitwise_not_() ``` bitwise_not_(Tensor(a!) self) -> Tensor(a!) ```python bitwise_or() ``` bitwise_or.Tensor(Tensor self, Tensor other) -> Tensor bitwise_or.Scalar(Tensor self, Scalar other) -> Tensor ```python bitwise_or_() ``` bitwise_or_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!) bitwise_or_.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!) ```python bitwise_right_shift() ``` bitwise_right_shift.Tensor(Tensor self, Tensor other) -> Tensor bitwise_right_shift.Tensor_Scalar(Tensor self, Scalar other) -> Tensor ```python bitwise_right_shift_() ``` bitwise_right_shift_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!) bitwise_right_shift_.Tensor_Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!) ```python bitwise_xor() ``` bitwise_xor.Tensor(Tensor self, Tensor other) -> Tensor bitwise_xor.Scalar(Tensor self, Scalar other) -> Tensor ```python bitwise_xor_() ``` bitwise_xor_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!) bitwise_xor_.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!) ```python bmm() ``` bmm(Tensor self, Tensor mat2) -> Tensor ```python broadcast_to() ``` broadcast_to(Tensor self, SymInt[] size) -> Tensor ```python bucketize(boundaries, *, out_int32=False, right=False, out=None) ``` Bucket indices of self against a sorted 1-D boundaries tensor. ```python cauchy_() ``` cauchy_(Tensor(a!) self, float median=0.0, float sigma=1.0, *, Generator? generator=None) -> Tensor(a!) ```python ccol_indices() ``` ccol_indices(Tensor(a) self) -> Tensor(a) ```python ceil() ``` ceil(Tensor self) -> Tensor ```python ceil_() ``` ceil_(Tensor(a!) self) -> Tensor(a!) ```python celu() ``` celu(Tensor self, Scalar alpha=1.0) -> Tensor ```python celu_() ``` celu_(Tensor(a!) self, Scalar alpha=1.0) -> Tensor(a!) ```python chalf() ``` chalf(Tensor self, *, MemoryFormat? memory_format=None) -> Tensor ```python channel_shuffle() ``` channel_shuffle(Tensor self, SymInt groups) -> Tensor ```python cholesky() ``` cholesky(Tensor self, bool upper=False) -> Tensor ```python cholesky_inverse() ``` cholesky_inverse(Tensor self, bool upper=False) -> Tensor ```python cholesky_solve() ``` cholesky_solve(Tensor self, Tensor input2, bool upper=False) -> Tensor ```python chunk() ``` chunk(Tensor(a -> *) self, int chunks, int dim=0) -> Tensor(a)[] ```python clamp() ``` clamp.Tensor(Tensor self, Tensor? min=None, Tensor? max=None) -> Tensor clamp(Tensor self, Scalar? min=None, Scalar? max=None) -> Tensor ```python clamp_() ``` clamp_.Tensor(Tensor(a!) self, Tensor? min=None, Tensor? max=None) -> Tensor(a!) clamp_(Tensor(a!) self, Scalar? min=None, Scalar? max=None) -> Tensor(a!) ```python clamp_max() ``` clamp_max.Tensor(Tensor self, Tensor max) -> Tensor clamp_max(Tensor self, Scalar max) -> Tensor ```python clamp_max_() ``` clamp_max_.Tensor(Tensor(a!) self, Tensor max) -> Tensor(a!) clamp_max_(Tensor(a!) self, Scalar max) -> Tensor(a!) ```python clamp_min() ``` clamp_min.Tensor(Tensor self, Tensor min) -> Tensor clamp_min(Tensor self, Scalar min) -> Tensor ```python clamp_min_() ``` clamp_min_.Tensor(Tensor(a!) self, Tensor min) -> Tensor(a!) clamp_min_(Tensor(a!) self, Scalar min) -> Tensor(a!) ```python clip() ``` clip.Tensor(Tensor self, Tensor? min=None, Tensor? max=None) -> Tensor clip(Tensor self, Scalar? min=None, Scalar? max=None) -> Tensor ```python clip_() ``` clip_.Tensor(Tensor(a!) self, Tensor? min=None, Tensor? max=None) -> Tensor(a!) clip_(Tensor(a!) self, Scalar? min=None, Scalar? max=None) -> Tensor(a!) ```python clone() ``` clone(Tensor self, *, MemoryFormat? memory_format=None) -> Tensor ```python combinations() ``` combinations(Tensor self, int r=2, bool with_replacement=False) -> Tensor ```python conj() ``` conj(Tensor(a) self) -> Tensor(a) ```python conj_physical() ``` conj_physical(Tensor self) -> Tensor ```python conj_physical_() ``` conj_physical_(Tensor(a!) self) -> Tensor(a!) ```python contiguous() ``` contiguous(Tensor(a) self, *, MemoryFormat memory_format=Contiguous) -> Tensor(a) ```python copy_() ``` copy_(Tensor(a!) self, Tensor src, bool non_blocking=False) -> Tensor(a!) ```python copysign() ``` copysign.Tensor(Tensor self, Tensor other) -> Tensor copysign.Scalar(Tensor self, Scalar other) -> Tensor ```python copysign_() ``` copysign_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!) copysign_.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!) ```python corrcoef() ``` corrcoef(Tensor self) -> Tensor ```python cos() ``` cos(Tensor self) -> Tensor ```python cos_() ``` cos_(Tensor(a!) self) -> Tensor(a!) ```python cosh() ``` cosh(Tensor self) -> Tensor ```python cosh_() ``` cosh_(Tensor(a!) self) -> Tensor(a!) ```python cot() ``` cot(Tensor self) -> Tensor ```python cov() ``` cov(Tensor self, *, int correction=1, Tensor? fweights=None, Tensor? aweights=None) -> Tensor ```python cpu() ``` Returns a copy of this object in CPU memory. If this object is already in CPU memory, then no copy is performed and the original object is returned. ```python cross() ``` cross(Tensor self, Tensor other, int? dim=None) -> Tensor ```python csc() ``` csc(Tensor self) -> Tensor ```python cuda(device=None, non_blocking=False) ``` Returns a copy of this object in CUDA memory. If this object is already in CUDA memory and on the correct device, then no copy is performed and the original object is returned. ```python cummax() ``` cummax(Tensor self, int dim) -> (Tensor values, Tensor indices) ```python cummin() ``` cummin(Tensor self, int dim) -> (Tensor values, Tensor indices) ```python cumprod() ``` cumprod(Tensor self, int dim, ScalarType? dtype=None) -> Tensor ```python cumprod_() ``` cumprod_(Tensor(a!) self, int dim, ScalarType? dtype=None) -> Tensor(a!) ```python cumsum() ``` cumsum(Tensor self, int dim=0, ScalarType? dtype=None) -> Tensor ```python cumsum_() ``` cumsum_(Tensor(a!) self, int dim=0, ScalarType? dtype=None) -> Tensor(a!) ```python data_ptr(self: tensorplay._C.TensorBase) → int ``` ```python defined(self: tensorplay._C.TensorBase) → bool ``` ```python deg2rad() ``` deg2rad(Tensor self) -> Tensor ```python deg2rad_() ``` deg2rad_(Tensor(a!) self) -> Tensor(a!) ```python dequantize() ``` dequantize.self(Tensor self) -> Tensor ```python det() ``` det(Tensor self) -> Tensor ```python detach_copy() ``` detach_copy(Tensor self) -> Tensor ```python diag() ``` diag(Tensor self, int diagonal=0) -> Tensor ```python diag_embed() ``` diag_embed(Tensor self, int offset=0, int dim1=-2, int dim2=-1) -> Tensor ```python diagflat() ``` diagflat(Tensor self, int offset=0) -> Tensor ```python diagonal() ``` diagonal(Tensor(a) self, int offset=0, int dim1=0, int dim2=1) -> Tensor(a) ```python diagonal_scatter() ``` diagonal_scatter(Tensor self, Tensor src, int offset=0, int dim1=0, int dim2=1) -> Tensor ```python diff() ``` diff(Tensor self, int n=1, int dim=-1, Tensor? prepend=None, Tensor? append=None) -> Tensor ```python digamma() ``` digamma(Tensor self) -> Tensor ```python digamma_() ``` digamma_(Tensor(a!) self) -> Tensor(a!) ```python dim() → int ``` ```python dim_order(self: tensorplay._C.TensorBase) → tuple ``` ```python dist() ``` dist(Tensor self, Tensor other, Scalar p=2) -> Tensor ```python div() ``` div.Tensor(Tensor self, Tensor other) -> Tensor div.Tensor_mode(Tensor self, Tensor other, *, str? rounding_mode) -> Tensor div.Scalar_mode(Tensor self, Scalar other, *, str? rounding_mode) -> Tensor div.Scalar(Tensor self, Scalar other) -> Tensor ```python div_(value, *, rounding_mode=None) → Tensor ``` In-place version of tensorplay.Tensor.div() ```python divide() ``` divide.Tensor(Tensor self, Tensor other) -> Tensor divide.Tensor_mode(Tensor self, Tensor other, *, str? rounding_mode) -> Tensor divide.Scalar(Tensor self, Scalar other) -> Tensor divide.Scalar_mode(Tensor self, Scalar other, *, str? rounding_mode) -> Tensor ```python divide_(value, *, rounding_mode=None) → Tensor ``` In-place version of tensorplay.Tensor.divide() ```python dot() ``` dot(Tensor self, Tensor tensor) -> Tensor ```python dropout_() ``` dropout_(Tensor(a!) self, float p=0.5, bool train=True) -> Tensor(a!) ```python dsplit(split_size_or_sections) → List of Tensors ``` Splits a tensor of at least three dimensions into views along the third axis. split_size_or_sections is either the number of equal sections or the list of sizes of each section. See tensorplay.dsplit() ```python element_size(self: tensorplay._C.TensorBase) → int ``` ```python elu() ``` elu(Tensor self, Scalar alpha=1, Scalar scale=1, Scalar input_scale=1) -> Tensor ```python elu_() ``` elu_(Tensor(a!) self, Scalar alpha=1, Scalar scale=1, Scalar input_scale=1) -> Tensor(a!) ```python entr() ``` entr(Tensor self) -> Tensor ```python eq() ``` eq.Tensor(Tensor self, Tensor other) -> Tensor eq.Scalar(Tensor self, Scalar other) -> Tensor ```python eq_() ``` eq_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!) eq_.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!) ```python equal(other) → bool ``` True if two tensors have the same size and elements, False otherwise. ```python erf() ``` erf(Tensor self) -> Tensor ```python erf_() ``` erf_(Tensor(a!) self) -> Tensor(a!) ```python erfc() ``` erfc(Tensor self) -> Tensor ```python erfc_() ``` erfc_(Tensor(a!) self) -> Tensor(a!) ```python erfcx() ``` erfcx(Tensor self) -> Tensor ```python erfinv() ``` erfinv(Tensor self) -> Tensor ```python erfinv_() ``` erfinv_(Tensor(a!) self) -> Tensor(a!) ```python exp() ``` exp(Tensor self) -> Tensor ```python exp2() ``` exp2(Tensor self) -> Tensor ```python exp2_() ``` exp2_(Tensor(a!) self) -> Tensor(a!) ```python exp_() ``` exp_(Tensor(a!) self) -> Tensor(a!) ```python expand() ``` expand(Tensor(a) self, SymInt[] size, *, bool implicit=False) -> Tensor(a) ```python expand_as() ``` expand_as(Tensor(a) self, Tensor other) -> Tensor(a) ```python expm1() ``` expm1(Tensor self) -> Tensor ```python expm1_() ``` expm1_(Tensor(a!) self) -> Tensor(a!) ```python exponential_() ``` exponential_(Tensor(a!) self, float lambd=1.0, *, Generator? generator=None) -> Tensor(a!) ```python feature_alpha_dropout_() ``` feature_alpha_dropout_(Tensor(a!) self, float p=0.5, bool train=True) -> Tensor(a!) ```python feature_dropout_() ``` feature_dropout_(Tensor(a!) self, float p=0.5, bool train=True) -> Tensor(a!) ```python fill_() ``` fill_.Tensor(Tensor(a!) self, Tensor value) -> Tensor(a!) fill_.Scalar(Tensor(a!) self, Scalar value) -> Tensor(a!) ```python fill_diagonal_() ``` fill_diagonal_(Tensor(a!) self, Scalar fill_value, bool wrap=False) -> Tensor(a!) ```python fix() ``` fix(Tensor self) -> Tensor ```python fix_() ``` fix_(Tensor(a!) self) -> Tensor(a!) ```python flatten() ``` flatten.using_ints(Tensor(a) self, int start_dim=0, int end_dim=-1) -> Tensor(a) ```python flip() ``` flip(Tensor self, int[] dims=[]) -> Tensor ```python fliplr() ``` fliplr(Tensor self) -> Tensor ```python flipud() ``` flipud(Tensor self) -> Tensor ```python float_power() ``` float_power(Tensor self, Tensor exponent) -> Tensor float_power.Tensor_Tensor(Tensor self, Tensor exponent) -> Tensor float_power.Tensor_Scalar(Tensor self, Scalar exponent) -> Tensor ```python float_power_() ``` float_power_.Tensor(Tensor(a!) self, Tensor exponent) -> Tensor(a!) float_power_.Scalar(Tensor(a!) self, Scalar exponent) -> Tensor(a!) ```python floor() ``` floor(Tensor self) -> Tensor ```python floor_() ``` floor_(Tensor(a!) self) -> Tensor(a!) ```python floor_divide() ``` floor_divide(Tensor self, Tensor other) -> Tensor floor_divide.Scalar(Tensor self, Scalar other) -> Tensor ```python floor_divide_() ``` floor_divide_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!) floor_divide_.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!) ```python fmax() ``` fmax(Tensor self, Tensor other) -> Tensor ```python fmin() ``` fmin(Tensor self, Tensor other) -> Tensor ```python fmod() ``` fmod.Tensor(Tensor self, Tensor other) -> Tensor fmod.Scalar(Tensor self, Scalar other) -> Tensor ```python fmod_() ``` fmod_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!) fmod_.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!) ```python frac() ``` frac(Tensor self) -> Tensor ```python frac_() ``` frac_(Tensor(a!) self) -> Tensor(a!) ```python frexp() ``` frexp.Tensor(Tensor self) -> (Tensor mantissa, Tensor exponent) ```python gather() ``` gather(Tensor self, int dim, Tensor index) -> Tensor ```python gcd() ``` gcd(Tensor self, Tensor other) -> Tensor ```python gcd_() ``` gcd_(Tensor(a!) self, Tensor other) -> Tensor(a!) ```python ge() ``` ge.Tensor(Tensor self, Tensor other) -> Tensor ge.Scalar(Tensor self, Scalar other) -> Tensor ```python ge_() ``` ge_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!) ge_.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!) ```python gelu() ``` gelu(Tensor self, str approximate="none") -> Tensor ```python gelu_() ``` gelu_(Tensor(a!) self, str approximate="none") -> Tensor(a!) ```python geometric_() ``` geometric_(Tensor(a!) self, float p, *, Generator? generator=None) -> Tensor(a!) ```python geqrf() ``` geqrf(Tensor self) -> (Tensor a, Tensor tau) ```python ger() ``` ger(Tensor self, Tensor vec2) -> Tensor ```python get_device() → int ``` ```python glu() ``` glu(Tensor self, int dim=-1) -> Tensor ```python greater() ``` greater(Tensor self, Tensor other) -> Tensor greater.Tensor(Tensor self, Tensor other) -> Tensor greater.Scalar(Tensor self, Scalar other) -> Tensor ```python greater_() ``` greater_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!) greater_.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!) ```python greater_equal() ``` greater_equal(Tensor self, Tensor other) -> Tensor greater_equal.Tensor(Tensor self, Tensor other) -> Tensor greater_equal.Scalar(Tensor self, Scalar other) -> Tensor ```python greater_equal_() ``` greater_equal_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!) greater_equal_.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!) ```python gt() ``` gt.Tensor(Tensor self, Tensor other) -> Tensor gt.Scalar(Tensor self, Scalar other) -> Tensor ```python gt_() ``` gt_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!) gt_.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!) ```python hardshrink() ``` hardshrink(Tensor self, Scalar lambd=0.5) -> Tensor ```python hardshrink_backward() ``` hardshrink_backward(Tensor grad_out, Tensor self, Scalar lambd) -> Tensor ```python hardsigmoid() ``` hardsigmoid(Tensor self) -> Tensor ```python hardsigmoid_() ``` hardsigmoid_(Tensor(a!) self) -> Tensor(a!) ```python hardswish() ``` hardswish(Tensor self) -> Tensor ```python hardswish_() ``` hardswish_(Tensor(a!) self) -> Tensor(a!) ```python hardtanh() ``` hardtanh(Tensor self, Scalar min_val=-1, Scalar max_val=1) -> Tensor ```python hardtanh_() ``` hardtanh_(Tensor(a!) self, Scalar min_val=-1, Scalar max_val=1) -> Tensor(a!) ```python hash_tensor() ``` hash_tensor(Tensor self, int[1] dim=[], *, bool keepdim=False, int mode=0) -> Tensor ```python heaviside() ``` heaviside(Tensor self, Tensor values) -> Tensor ```python heaviside_() ``` heaviside_(Tensor(a!) self, Tensor values) -> Tensor(a!) ```python histc() ``` histc(Tensor self, int bins=100, Scalar min=0, Scalar max=0) -> Tensor ```python histogram() ``` histogram.bins_tensor(Tensor self, Tensor bins, *, Tensor? weight=None, bool density=False) -> (Tensor hist, Tensor bin_edges) histogram.bin_ct(Tensor self, int bins=100, *, float[]? range=None, Tensor? weight=None, bool density=False) -> (Tensor hist, Tensor bin_edges) ```python hsplit(split_size_or_sections) → List of Tensors ``` Splits a tensor of at least two dimensions into views along the second axis. split_size_or_sections is either the number of equal sections or the list of sizes of each section. See tensorplay.hsplit() ```python hypot() ``` hypot(Tensor self, Tensor other) -> Tensor ```python hypot_() ``` hypot_(Tensor(a!) self, Tensor other) -> Tensor(a!) ```python i0() ``` i0(Tensor self) -> Tensor ```python i0_() ``` i0_(Tensor(a!) self) -> Tensor(a!) ```python i0e() ``` i0e(Tensor self) -> Tensor ```python i1() ``` i1(Tensor self) -> Tensor ```python i1e() ``` i1e(Tensor self) -> Tensor ```python igamma() ``` igamma(Tensor self, Tensor other) -> Tensor ```python igamma_() ``` igamma_(Tensor(a!) self, Tensor other) -> Tensor(a!) ```python igammac() ``` igammac(Tensor self, Tensor other) -> Tensor ```python igammac_() ``` igammac_(Tensor(a!) self, Tensor other) -> Tensor(a!) ```python index() ``` index.Tensor(Tensor self, Tensor?[] indices) -> Tensor ```python index_add() ``` index_add(Tensor self, int dim, Tensor index, Tensor source) -> Tensor ```python index_add_() ``` index_add_(Tensor(a!) self, int dim, Tensor index, Tensor source) -> Tensor(a!) ```python index_copy() ``` index_copy(Tensor self, int dim, Tensor index, Tensor source) -> Tensor ```python index_copy_() ``` index_copy_(Tensor(a!) self, int dim, Tensor index, Tensor source) -> Tensor(a!) ```python index_fill() ``` index_fill.Tensor(Tensor self, int dim, Tensor index, Tensor value) -> Tensor index_fill.int_Tensor(Tensor self, int dim, Tensor index, Tensor value) -> Tensor index_fill.Scalar(Tensor self, int dim, Tensor index, Scalar value) -> Tensor index_fill.int_Scalar(Tensor self, int dim, Tensor index, Scalar value) -> Tensor ```python index_fill_() ``` index_fill_.Tensor(Tensor(a!) self, int dim, Tensor index, Tensor value) -> Tensor(a!) index_fill_.int_Tensor(Tensor(a!) self, int dim, Tensor index, Tensor value) -> Tensor(a!) index_fill_.Scalar(Tensor(a!) self, int dim, Tensor index, Scalar value) -> Tensor(a!) index_fill_.int_Scalar(Tensor(a!) self, int dim, Tensor index, Scalar value) -> Tensor(a!) ```python index_put() ``` index_put(Tensor self, Tensor?[] indices, Tensor values, bool accumulate=False) -> Tensor ```python index_put_() ``` index_put_(Tensor(a!) self, Tensor?[] indices, Tensor values, bool accumulate=False) -> Tensor(a!) ```python index_reduce() ``` index_reduce(Tensor self, int dim, Tensor index, Tensor source, str reduce, *, bool include_self=True) -> Tensor ```python index_reduce_() ``` index_reduce_(Tensor(a!) self, int dim, Tensor index, Tensor source, str reduce, *, bool include_self=True) -> Tensor(a!) ```python index_select() ``` index_select(Tensor self, int dim, Tensor index) -> Tensor ```python indices() ``` indices(Tensor(a) self) -> Tensor(a) ```python inner() ``` inner(Tensor self, Tensor other) -> Tensor ```python int_repr() ``` int_repr(Tensor self) -> Tensor ```python inverse() ``` inverse(Tensor self) -> Tensor ```python is_channels_last(self: tensorplay._C.TensorBase) → bool ``` ```python is_channels_last_2d(self: tensorplay._C.TensorBase) → bool ``` ```python is_channels_last_3d(self: tensorplay._C.TensorBase) → bool ``` ```python is_complex(self: tensorplay._C.TensorBase) → bool ``` ```python is_conj() ``` is_conj(Tensor self) -> bool ```python is_distributed() ``` is_distributed(Tensor self) -> bool ```python is_inference() ``` is_inference(Tensor self) -> bool ```python is_neg() ``` is_neg(Tensor self) -> bool ```python is_nested() ``` is_nested(Tensor self) -> bool ```python is_nonzero() ``` is_nonzero(Tensor self) -> bool ```python is_quantized() ``` is_quantized(Tensor self) -> bool ```python is_same_size() ``` is_same_size(Tensor self, Tensor other) -> bool ```python is_set_to() ``` is_set_to(Tensor self, Tensor tensor) -> bool ```python is_shared(self: object) → bool ``` ```python is_signed() ``` is_signed(Tensor self) -> bool ```python is_sparse_bsc(self: tensorplay._C.TensorBase) → bool ``` ```python is_sparse_bsr(self: tensorplay._C.TensorBase) → bool ``` ```python is_sparse_compressed(self: tensorplay._C.TensorBase) → bool ``` ```python is_sparse_csc(self: tensorplay._C.TensorBase) → bool ``` ```python is_sparse_csr(self: tensorplay._C.TensorBase) → bool ``` ```python isclose() ``` isclose(Tensor self, Tensor other, float rtol=1e-05, float atol=1e-08, bool equal_nan=False) -> Tensor ```python isfinite() ``` isfinite(Tensor self) -> Tensor ```python isinf() ``` isinf(Tensor self) -> Tensor ```python isnan() ``` isnan(Tensor self) -> Tensor ```python isneginf() ``` isneginf(Tensor self) -> Tensor ```python isposinf() ``` isposinf(Tensor self) -> Tensor ```python isreal() ``` isreal(Tensor self) -> Tensor ```python item() ``` item(Tensor self) -> Scalar ```python itemsize(self: tensorplay._C.TensorBase) → int ``` ```python kron() ``` kron(Tensor self, Tensor other) -> Tensor ```python kthvalue() ``` kthvalue(Tensor self, SymInt k, int dim=-1, bool keepdim=False) -> (Tensor values, Tensor indices) ```python lcm() ``` lcm(Tensor self, Tensor other) -> Tensor ```python lcm_() ``` lcm_(Tensor(a!) self, Tensor other) -> Tensor(a!) ```python ldexp() ``` ldexp(Tensor self, Tensor other) -> Tensor ldexp.Tensor(Tensor self, Tensor other) -> Tensor ```python ldexp_() ``` ldexp_(Tensor(a!) self, Tensor other) -> Tensor(a!) ```python le() ``` le.Tensor(Tensor self, Tensor other) -> Tensor le.Scalar(Tensor self, Scalar other) -> Tensor ```python le_() ``` le_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!) le_.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!) ```python leaky_relu() ``` leaky_relu(Tensor self, Scalar negative_slope=0.01) -> Tensor ```python leaky_relu_() ``` leaky_relu_(Tensor(a!) self, Scalar negative_slope=0.01) -> Tensor(a!) ```python lerp() ``` lerp.Tensor(Tensor self, Tensor end, Tensor weight) -> Tensor lerp(Tensor self, Tensor end, Scalar weight) -> Tensor lerp.Scalar(Tensor self, Tensor end, Scalar weight) -> Tensor ```python lerp_() ``` lerp_.Tensor(Tensor(a!) self, Tensor end, Tensor weight) -> Tensor(a!) lerp_.Scalar(Tensor(a!) self, Tensor end, Scalar weight) -> Tensor(a!) ```python less() ``` less(Tensor self, Tensor other) -> Tensor less.Tensor(Tensor self, Tensor other) -> Tensor less.Scalar(Tensor self, Scalar other) -> Tensor ```python less_() ``` less_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!) less_.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!) ```python less_equal() ``` less_equal(Tensor self, Tensor other) -> Tensor less_equal.Tensor(Tensor self, Tensor other) -> Tensor less_equal.Scalar(Tensor self, Scalar other) -> Tensor ```python less_equal_() ``` less_equal_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!) less_equal_.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!) ```python lgamma() ``` lgamma(Tensor self) -> Tensor ```python lgamma_() ``` lgamma_(Tensor(a!) self) -> Tensor(a!) ```python log() ``` log(Tensor self) -> Tensor ```python log10() ``` log10(Tensor self) -> Tensor ```python log10_() ``` log10_(Tensor(a!) self) -> Tensor(a!) ```python log1p() ``` log1p(Tensor self) -> Tensor ```python log1p_() ``` log1p_(Tensor(a!) self) -> Tensor(a!) ```python log2() ``` log2(Tensor self) -> Tensor ```python log2_() ``` log2_(Tensor(a!) self) -> Tensor(a!) ```python log_() ``` log_(Tensor(a!) self) -> Tensor(a!) ```python log_ndtr() ``` log_ndtr(Tensor self) -> Tensor ```python log_normal_() ``` log_normal_(Tensor(a!) self, float mean=1.0, float std=2.0, *, Generator? generator=None) -> Tensor(a!) ```python log_sigmoid() ``` log_sigmoid(Tensor self) -> Tensor ```python log_softmax() ``` log_softmax(Tensor self, int dim, ScalarType dtype=Undefined) -> Tensor log_softmax.int(Tensor self, int dim, ScalarType? dtype=None) -> Tensor ```python logaddexp() ``` logaddexp(Tensor self, Tensor other) -> Tensor ```python logaddexp2() ``` logaddexp2(Tensor self, Tensor other) -> Tensor ```python logcumsumexp() ``` logcumsumexp(Tensor self, int dim, ScalarType? dtype=None) -> Tensor ```python logdet() ``` logdet(Tensor self) -> Tensor ```python logical_and() ``` logical_and(Tensor self, Tensor other) -> Tensor ```python logical_and_() ``` logical_and_(Tensor(a!) self, Tensor other) -> Tensor(a!) ```python logical_not() ``` logical_not(Tensor self) -> Tensor ```python logical_not_() ``` logical_not_(Tensor(a!) self) -> Tensor(a!) ```python logical_or() ``` logical_or(Tensor self, Tensor other) -> Tensor ```python logical_or_() ``` logical_or_(Tensor(a!) self, Tensor other) -> Tensor(a!) ```python logical_xor() ``` logical_xor(Tensor self, Tensor other) -> Tensor ```python logical_xor_() ``` logical_xor_(Tensor(a!) self, Tensor other) -> Tensor(a!) ```python logit() ``` logit(Tensor self, Scalar? eps=None) -> Tensor ```python logit_() ``` logit_(Tensor(a!) self, Scalar? eps=None) -> Tensor(a!) ```python logit_backward() ``` logit_backward(Tensor grad_output, Tensor self, Scalar? eps=None) -> Tensor ```python logsumexp() ``` logsumexp(Tensor self, int[1] dim, bool keepdim=False) -> Tensor ```python lt() ``` lt.Tensor(Tensor self, Tensor other) -> Tensor lt.Scalar(Tensor self, Scalar other) -> Tensor ```python lt_() ``` lt_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!) lt_.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!) ```python lu_solve() ``` lu_solve(Tensor self, Tensor LU_data, Tensor LU_pivots) -> Tensor ```python map2_(self: object, tensor1: tensorplay._C.TensorBase, tensor2: tensorplay._C.TensorBase, callable: object) → object ``` ```python map_(self: object, tensor: tensorplay._C.TensorBase, callable: object) → object ``` ```python masked_fill() ``` masked_fill.Tensor(Tensor self, Tensor mask, Tensor value) -> Tensor masked_fill(Tensor self, Tensor mask, Scalar value) -> Tensor masked_fill.Scalar(Tensor self, Tensor mask, Scalar value) -> Tensor ```python masked_fill_() ``` masked_fill_.Tensor(Tensor(a!) self, Tensor mask, Tensor value) -> Tensor(a!) masked_fill_(Tensor(a!) self, Tensor mask, Scalar value) -> Tensor(a!) masked_fill_.Scalar(Tensor(a!) self, Tensor mask, Scalar value) -> Tensor(a!) ```python masked_scatter() ``` masked_scatter(Tensor self, Tensor mask, Tensor source) -> Tensor ```python masked_scatter_() ``` masked_scatter_(Tensor(a!) self, Tensor mask, Tensor source) -> Tensor(a!) ```python masked_select() ``` masked_select(Tensor self, Tensor mask) -> Tensor ```python matmul() ``` matmul(Tensor self, Tensor other) -> Tensor ```python matrix_H() ``` matrix_H(Tensor(a) self) -> Tensor(a) ```python matrix_exp() ``` matrix_exp(Tensor self) -> Tensor ```python matrix_power() ``` matrix_power(Tensor self, int n) -> Tensor ```python maximum() ``` maximum(Tensor self, Tensor other) -> Tensor ```python mean() ``` mean(Tensor self, *, ScalarType dtype=Undefined) -> Tensor mean.dim(Tensor self, int[] dim, bool keepdim=false, *, ScalarType dtype=Undefined) -> Tensor ```python median() ``` median(Tensor self) -> Tensor median.dim(Tensor self, int dim, bool keepdim=False) -> (Tensor values, Tensor indices) ```python memory_format(self: tensorplay._C.TensorBase) → int ``` ```python minimum() ``` minimum(Tensor self, Tensor other) -> Tensor ```python mish() ``` mish(Tensor self) -> Tensor ```python mish_() ``` mish_(Tensor(a!) self) -> Tensor(a!) ```python mm() ``` mm(Tensor self, Tensor mat2) -> Tensor ```python mode() ``` mode(Tensor self, int dim=-1, bool keepdim=False) -> (Tensor values, Tensor indices) ```python modified_bessel_i0() ``` modified_bessel_i0(Tensor self) -> Tensor ```python modified_bessel_i1() ``` modified_bessel_i1(Tensor self) -> Tensor ```python modified_bessel_k0() ``` modified_bessel_k0(Tensor self) -> Tensor ```python modified_bessel_k1() ``` modified_bessel_k1(Tensor self) -> Tensor ```python module_load(other, assign=False) ``` Defines how other is remapped before being swapped with self when a state dictionary is loaded into the owning module. Returns a new object that is neither self nor other: the default is self.copy_(other).detach() unless assign selects the detached source directly. ```python moveaxis() ``` moveaxis.int(Tensor(a) self, int source, int destination) -> Tensor(a) moveaxis.intlist(Tensor(a) self, int[] source, int[] destination) -> Tensor(a) ```python movedim() ``` movedim.int(Tensor(a) self, int source, int destination) -> Tensor(a) movedim(Tensor(a) self, int[] source, int[] destination) -> Tensor(a) movedim.intlist(Tensor(a) self, int[] source, int[] destination) -> Tensor(a) ```python msort() ``` msort(Tensor self) -> Tensor ```python mul() ``` mul.Tensor(Tensor self, Tensor other) -> Tensor mul.Scalar(Tensor self, Scalar other) -> Tensor ```python mul_() ``` mul_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!) mul_.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!) ```python multinomial() ``` multinomial(Tensor self, SymInt num_samples, bool replacement=false, *, Generator? generator=None) -> Tensor ```python multiply() ``` multiply.Tensor(Tensor self, Tensor other) -> Tensor multiply.Scalar(Tensor self, Scalar other) -> Tensor ```python multiply_() ``` multiply_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!) multiply_.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!) ```python mv() ``` mv(Tensor self, Tensor vec) -> Tensor ```python mvlgamma() ``` mvlgamma(Tensor self, int p) -> Tensor ```python mvlgamma_() ``` mvlgamma_(Tensor(a!) self, int p) -> Tensor(a!) ```python nan_to_num() ``` nan_to_num(Tensor self, Scalar nan=0.0, Scalar? posinf=None, Scalar? neginf=None) -> Tensor ```python nan_to_num_() ``` nan_to_num_(Tensor(a!) self, Scalar nan=0.0, Scalar? posinf=None, Scalar? neginf=None) -> Tensor(a!) ```python nanmean() ``` nanmean(Tensor self, int? dim=None, bool keepdim=False, *, ScalarType? dtype=None) -> Tensor ```python nanmedian() ``` nanmedian(Tensor self) -> Tensor nanmedian.dim(Tensor self, int dim, bool keepdim=False) -> (Tensor values, Tensor indices) ```python nanquantile() ``` nanquantile.scalar(Tensor self, float q, int? dim=None, bool keepdim=False, *, str interpolation='linear') -> Tensor ```python nansum() ``` nansum(Tensor self, int[] dim=[], bool keepdim=False) -> Tensor ```python narrow() ``` narrow.Tensor(Tensor(a) self, int dim, Tensor start, SymInt length) -> Tensor(a) narrow(Tensor(a) self, int dim, SymInt start, SymInt length) -> Tensor(a) ```python narrow_copy() ``` narrow_copy(Tensor self, int dim, SymInt start, SymInt length) -> Tensor ```python native_channel_shuffle() ``` native_channel_shuffle(Tensor self, SymInt groups) -> Tensor ```python nbytes(self: tensorplay._C.TensorBase) → int ``` ```python ndimension() → int ``` Alias for dim() ```python ndtr() ``` ndtr(Tensor self) -> Tensor ```python ndtri() ``` ndtri(Tensor self) -> Tensor ```python ne() ``` ne.Tensor(Tensor self, Tensor other) -> Tensor ne.Scalar(Tensor self, Scalar other) -> Tensor ```python ne_() ``` ne_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!) ne_.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!) ```python neg() ``` neg(Tensor self) -> Tensor ```python neg_() ``` neg_(Tensor(a!) self) -> Tensor(a!) ```python negative() ``` negative(Tensor self) -> Tensor ```python negative_() ``` negative_(Tensor(a!) self) -> Tensor(a!) ```python nelement() → int ``` Alias of numel(). ```python new(self: tensorplay._C.TensorBase, *args, **kwargs) → tensorplay._C.TensorBase ``` ```python new_empty_strided() ``` new_empty_strided(Tensor self, SymInt[] size, SymInt[] stride, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor ```python nextafter() ``` nextafter(Tensor self, Tensor other) -> Tensor ```python nextafter_() ``` nextafter_(Tensor(a!) self, Tensor other) -> Tensor(a!) ```python nonzero_numpy() ``` nonzero_numpy(Tensor self) -> Tensor[] ```python nonzero_static() ``` nonzero_static(Tensor self, *, SymInt size, int fill_value=-1) -> Tensor ```python norm() ``` norm(Tensor self, float p=2.0) -> Tensor norm.dim(Tensor self, int[] dim, float p=2.0, bool keepdim=false) -> Tensor norm.ScalarOpt_dtype(Tensor self, Scalar? p, *, ScalarType dtype) -> Tensor norm.Scalar(Tensor self, Scalar p=2) -> Tensor norm.ScalarOpt_dim_dtype(Tensor self, Scalar? p, int[1] dim, bool keepdim, *, ScalarType dtype) -> Tensor norm.ScalarOpt_dim(Tensor self, Scalar? p, int[1] dim, bool keepdim=False) -> Tensor ```python normal_() ``` normal_(Tensor(a!) self, float mean=0.0, float std=1.0, *, Generator? generator=None) -> Tensor(a!) ```python not_equal() ``` not_equal(Tensor self, Tensor other) -> Tensor not_equal.Tensor(Tensor self, Tensor other) -> Tensor not_equal.Scalar(Tensor self, Scalar other) -> Tensor ```python not_equal_() ``` not_equal_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!) not_equal_.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!) ```python numel() → int ``` ```python numpy(self: object) → numpy.ndarray ``` ```python numpy_T() ``` numpy_T(Tensor(a) self) -> Tensor(a) ```python orgqr() ``` orgqr(Tensor self, Tensor input2) -> Tensor ```python ormqr() ``` ormqr(Tensor self, Tensor input2, Tensor input3, bool left=True, bool transpose=False) -> Tensor ```python outer() ``` outer(Tensor self, Tensor vec2) -> Tensor ```python output_nr() ``` output_nr(Tensor self) -> int ```python pdist() ``` pdist(Tensor self, float p=2.0) -> Tensor ```python permute() ``` permute(Tensor(a) self, int[] dims) -> Tensor(a) ```python pinverse() ``` pinverse(Tensor self, float rcond=1e-15) -> Tensor ```python poisson() ``` poisson(Tensor self, Generator? generator=None) -> Tensor ```python polygamma() ``` polygamma(int n, Tensor self) -> Tensor ```python polygamma_() ``` polygamma_(Tensor(a!) self, int n) -> Tensor(a!) ```python positive() ``` positive(Tensor(a) self) -> Tensor(a) ```python pow() ``` pow.Tensor_Tensor(Tensor self, Tensor exponent) -> Tensor pow.Tensor_Scalar(Tensor self, Scalar exponent) -> Tensor ```python pow_() ``` pow_.Tensor(Tensor(a!) self, Tensor exponent) -> Tensor(a!) pow_.Scalar(Tensor(a!) self, Scalar exponent) -> Tensor(a!) ```python prelu() ``` prelu(Tensor self, Tensor weight) -> Tensor ```python prod() ``` prod(Tensor self, *, ScalarType dtype=Undefined) -> Tensor prod.dim_IntList(Tensor self, int[] dim, bool keepdim=false, *, ScalarType dtype=Undefined) -> Tensor prod.dim_int(Tensor self, int dim, bool keepdim=False, *, ScalarType? dtype=None) -> Tensor ```python put() ``` put(Tensor self, Tensor index, Tensor source, bool accumulate=False) -> Tensor ```python put_() ``` put_(Tensor(a!) self, Tensor index, Tensor source, bool accumulate=False) -> Tensor(a!) ```python q_per_channel_axis() ``` q_per_channel_axis(Tensor self) -> int ```python q_per_channel_scales() ``` q_per_channel_scales(Tensor self) -> Tensor ```python q_per_channel_zero_points() ``` q_per_channel_zero_points(Tensor self) -> Tensor ```python q_scale() ``` q_scale(Tensor self) -> float ```python q_zero_point() ``` q_zero_point(Tensor self) -> int ```python qscheme() ``` qscheme(Tensor self) -> int ```python quantile() ``` quantile.scalar(Tensor self, float q, int? dim=None, bool keepdim=False, *, str interpolation='linear') -> Tensor ```python rad2deg() ``` rad2deg(Tensor self) -> Tensor ```python rad2deg_() ``` rad2deg_(Tensor(a!) self) -> Tensor(a!) ```python random_() ``` random_(Tensor(a!) self, *, Generator? generator=None) -> Tensor(a!) random_.from(Tensor(a!) self, int from, int? to, *, Generator? generator=None) -> Tensor(a!) random_.to(Tensor(a!) self, int to, *, Generator? generator=None) -> Tensor(a!) ```python ravel() ``` ravel(Tensor(a) self) -> Tensor(a) ```python reciprocal() ``` reciprocal(Tensor self) -> Tensor ```python reciprocal_() ``` reciprocal_(Tensor(a!) self) -> Tensor(a!) ```python register_hook(hook) ``` The hook is called every time a gradient with respect to this tensor is computed. It may modify the gradient by returning a replacement Tensor; returning None leaves the gradient unchanged. Hooks compose in registration order. Returns a RemovableHandle whose remove() method (or context-manager form) unregisters the hook. ```python register_post_accumulate_grad_hook(hook) ``` The hook runs after the gradient has been accumulated into self.grad. It receives the tensor (the parameter) and its return value is ignored; unlike [register_hook()](#tensorplay.nn.attention.bias.CausalBias.register_hook) it cannot replace the gradient, but it may modify self.grad in place. Only leaf tensors that require grad and are used in the autograd graph support this hook. Returns a RemovableHandle. ```python relu() ``` relu(Tensor self) -> Tensor ```python relu6() ``` relu6(Tensor self) -> Tensor ```python relu6_() ``` relu6_(Tensor(a!) self) -> Tensor(a!) ```python relu_() ``` relu_(Tensor(a!) self) -> Tensor(a!) ```python remainder() ``` remainder.Tensor(Tensor self, Tensor other) -> Tensor remainder.Scalar(Tensor self, Scalar other) -> Tensor ```python remainder_() ``` remainder_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!) remainder_.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!) ```python renorm() ``` renorm(Tensor self, Scalar p, int dim, Scalar maxnorm) -> Tensor ```python renorm_() ``` renorm_(Tensor(a!) self, Scalar p, int dim, Scalar maxnorm) -> Tensor(a!) ```python repeat() ``` repeat(Tensor self, SymInt[] repeats) -> Tensor ```python reshape() ``` reshape(Tensor(a) self, SymInt[] shape) -> Tensor(a) ```python resize_() ``` resize_(Tensor(a!) self, SymInt[] size) -> Tensor(a!) ```python resize_as_() ``` resize_as_(Tensor(a!) self, Tensor other, *, MemoryFormat? memory_format=None) -> Tensor(a!) ```python resize_as_sparse_() ``` resize_as_sparse_(Tensor(a!) self, Tensor the_template) -> Tensor(a!) ```python resolve_conj() ``` resolve_conj(Tensor(a) self) -> Tensor(a) ```python resolve_neg() ``` resolve_neg(Tensor(a) self) -> Tensor(a) ```python roll() ``` roll(Tensor self, SymInt[1] shifts, int[] dims=[]) -> Tensor ```python rot90() ``` rot90(Tensor self, int k=1, int[] dims=[0,1]) -> Tensor ```python round() ``` round(Tensor self) -> Tensor round.decimals(Tensor self, *, int decimals) -> Tensor ```python round_() ``` round_(Tensor(a!) self) -> Tensor(a!) round_.decimals(Tensor(a!) self, *, int decimals) -> Tensor(a!) ```python row_indices() ``` row_indices(Tensor(a) self) -> Tensor(a) ```python rrelu() ``` rrelu(Tensor self, Scalar lower=0.125, Scalar upper=0.3333333333333333, bool training=False, Generator? generator=None) -> Tensor ```python rrelu_() ``` rrelu_(Tensor(a!) self, Scalar lower=0.125, Scalar upper=0.3333333333333333, bool training=False, Generator? generator=None) -> Tensor(a!) ```python rsqrt() ``` rsqrt(Tensor self) -> Tensor ```python rsqrt_() ``` rsqrt_(Tensor(a!) self) -> Tensor(a!) ```python scaled_modified_bessel_k0() ``` scaled_modified_bessel_k0(Tensor self) -> Tensor ```python scaled_modified_bessel_k1() ``` scaled_modified_bessel_k1(Tensor self) -> Tensor ```python scatter() ``` scatter.src(Tensor self, int dim, Tensor index, Tensor src) -> Tensor scatter.reduce(Tensor self, int dim, Tensor index, Tensor src, *, str reduce) -> Tensor scatter.value(Tensor self, int dim, Tensor index, Scalar value) -> Tensor scatter.value_reduce(Tensor self, int dim, Tensor index, Scalar value, *, str reduce) -> Tensor ```python scatter_(dim, index, src=None, *, value=None, reduce=None) → Tensor ``` Writes values from src (or the scalar value) into this tensor at the positions picked by [index](#tensorplay.nn.attention.bias.CausalBias.index) along [dim](#tensorplay.nn.attention.bias.CausalBias.dim); the remaining coordinates of each written element come from its position inside [index](#tensorplay.nn.attention.bias.CausalBias.index). With reduce set to "add" or "multiply" ([None](https://docs.python.org/3/builtins/constants.html#None) by default), a destination that receives several values accumulates them instead of keeping the last one. Returns self. ```python scatter_add() ``` scatter_add(Tensor self, int dim, Tensor index, Tensor src) -> Tensor ```python scatter_add_() ``` scatter_add_(Tensor(a!) self, int dim, Tensor index, Tensor src) -> Tensor(a!) ```python scatter_reduce() ``` scatter_reduce(Tensor self, int dim, Tensor index, Tensor src, str reduce, *, bool include_self=True) -> Tensor scatter_reduce.two(Tensor self, int dim, Tensor index, Tensor src, str reduce, *, bool include_self=True) -> Tensor ```python scatter_reduce_(dim, index, src, reduce, *, include_self=True) → Tensor ``` Reduces the values of src into this tensor at the positions picked by [index](#tensorplay.nn.attention.bias.CausalBias.index) along [dim](#tensorplay.nn.attention.bias.CausalBias.dim), applying the reduction named by reduce: "sum", "prod", "mean", "amax" or "amin". When include_self is False, the original value of each destination element takes no part in the reduction. Returns self. ```python searchsorted(sorted_sequence, *, out_int32=False, right=False, side=None, sorter=None, out=None) ``` Insertion positions of self values in sorted_sequence. ```python sec() ``` sec(Tensor self) -> Tensor ```python select() ``` select.int(Tensor(a) self, int dim, SymInt index) -> Tensor(a) ```python select_scatter() ``` select_scatter(Tensor self, Tensor src, int dim, SymInt index) -> Tensor ```python selu() ``` selu(Tensor self) -> Tensor ```python selu_() ``` selu_(Tensor(a!) self) -> Tensor(a!) ```python set_() ``` set_.source_Storage(Tensor(a!) self, Storage source) -> Tensor(a!) set_.source_Storage_storage_offset(Tensor(a!) self, Storage source, SymInt storage_offset, SymInt[] size, SymInt[] stride=[]) -> Tensor(a!) set_.source_Tensor_storage_offset(Tensor(a!) self, Tensor source, SymInt storage_offset, SymInt[] size, SymInt[] stride=[]) -> Tensor(a!) set_.source_Tensor(Tensor(a!) self, Tensor source) -> Tensor(a!) set_(Tensor(a!) self) -> Tensor(a!) ```python set_data() ``` set_data(Tensor(a!) self, Tensor new_data) -> () ```python sgn() ``` sgn(Tensor self) -> Tensor ```python sgn_() ``` sgn_(Tensor(a!) self) -> Tensor(a!) ```python shallow_copy_data() ``` shallow_copy_data(Tensor(a!) self, Tensor new_data) -> () ```python share_memory_(self: object) → object ``` ```python sigmoid() ``` sigmoid(Tensor self) -> Tensor ```python sigmoid_() ``` sigmoid_(Tensor(a!) self) -> Tensor(a!) ```python sigmoid_backward() ``` sigmoid_backward(Tensor grad_output, Tensor output) -> Tensor ```python sign() ``` sign(Tensor self) -> Tensor ```python sign_() ``` sign_(Tensor(a!) self) -> Tensor(a!) ```python signbit() ``` signbit(Tensor self) -> Tensor ```python silu() ``` silu(Tensor self) -> Tensor ```python silu_() ``` silu_(Tensor(a!) self) -> Tensor(a!) ```python sin() ``` sin(Tensor self) -> Tensor ```python sin_() ``` sin_(Tensor(a!) self) -> Tensor(a!) ```python sinc() ``` sinc(Tensor self) -> Tensor ```python sinc_() ``` sinc_(Tensor(a!) self) -> Tensor(a!) ```python sinh() ``` sinh(Tensor self) -> Tensor ```python sinh_() ``` sinh_(Tensor(a!) self) -> Tensor(a!) ```python size() → int[] ``` ```python size(dim) → int ``` ```python slice() ``` slice.Tensor(Tensor(a) self, int dim=0, SymInt? start=None, SymInt? end=None, SymInt step=1) -> Tensor(a) ```python slice_inverse() ``` slice_inverse(Tensor(a) self, Tensor src, int dim=0, SymInt? start=None, SymInt? end=None, SymInt step=1) -> Tensor(a) ```python slice_scatter() ``` slice_scatter(Tensor self, Tensor src, int dim=0, SymInt? start=None, SymInt? end=None, SymInt step=1) -> Tensor ```python slogdet() ``` slogdet(Tensor self) -> (Tensor sign, Tensor logabsdet) ```python smm() ``` smm(Tensor self, Tensor mat2) -> Tensor ```python softmax() ``` softmax(Tensor self, int dim, ScalarType dtype=Undefined) -> Tensor softmax.int(Tensor self, int dim, ScalarType? dtype=None) -> Tensor ```python softplus() ``` softplus(Tensor self, Scalar beta=1, Scalar threshold=20) -> Tensor ```python softshrink() ``` softshrink(Tensor self, Scalar lambd=0.5) -> Tensor ```python softshrink_backward() ``` softshrink_backward(Tensor grad_output, Tensor self, Scalar lambd) -> Tensor ```python sort() ``` sort(Tensor self, int dim=-1, bool descending=False) -> (Tensor values, Tensor indices) sort.stable(Tensor self, *, bool? stable, int dim=-1, bool descending=False) -> (Tensor values, Tensor indices) ```python sparse_blocksize(self: tensorplay._C.TensorBase) → tuple[int, int] ``` ```python sparse_mask(self: tensorplay._C.TensorBase, mask: tensorplay._C.TensorBase) → tensorplay._C.TensorBase ``` ```python sparse_resize_() ``` sparse_resize_(Tensor(a!) self, int[] size, int sparse_dim, int dense_dim) -> Tensor(a!) ```python sparse_resize_and_clear_() ``` sparse_resize_and_clear_(Tensor(a!) self, int[] size, int sparse_dim, int dense_dim) -> Tensor(a!) ```python sparse_sum() ``` sparse_sum(Tensor self, int[]? dim=None, ScalarType? dtype=None) -> Tensor ```python spherical_bessel_j0() ``` spherical_bessel_j0(Tensor self) -> Tensor ```python split() ``` split(Tensor(a) self, int split_size, int dim=0) -> Tensor(a)[] split.Tensor(Tensor(a -> *) self, SymInt split_size, int dim=0) -> Tensor(a)[] split.sizes(Tensor(a) self, int[] split_sizes, int dim=0) -> Tensor(a)[] ```python split_with_sizes() ``` split_with_sizes(Tensor(a) self, SymInt[] split_sizes, int dim=0) -> Tensor(a)[] ```python sqrt() ``` sqrt(Tensor self) -> Tensor ```python sqrt_() ``` sqrt_(Tensor(a!) self) -> Tensor(a!) ```python square() ``` square(Tensor self) -> Tensor ```python square_() ``` square_(Tensor(a!) self) -> Tensor(a!) ```python squared_difference() ``` squared_difference(Tensor self, Tensor other) -> Tensor ```python squeeze() ``` squeeze(Tensor(a) self) -> Tensor(a) squeeze.dim(Tensor(a) self, int dim) -> Tensor(a) squeeze.dims(Tensor(a) self, int[] dim) -> Tensor(a) ```python squeeze_() ``` squeeze_(Tensor(a!) self) -> Tensor(a!) squeeze_.dim(Tensor(a!) self, int dim) -> Tensor(a!) squeeze_.dims(Tensor(a!) self, int[] dim) -> Tensor(a!) ```python sspaddmm() ``` sspaddmm(Tensor self, Tensor mat1, Tensor mat2, *, Scalar beta=1, Scalar alpha=1) -> Tensor ```python std() ``` std(Tensor self, int correction=1) -> Tensor std.dim(Tensor self, int[] dim, int correction=1, bool keepdim=false) -> Tensor std.correction(Tensor self, int[1]? dim=None, *, Scalar? correction=None, bool keepdim=False) -> Tensor ```python stft() ``` stft.center(Tensor self, int n_fft, int? hop_length=None, int? win_length=None, Tensor? window=None, bool center=True, str pad_mode="reflect", bool normalized=False, bool? onesided=None, bool? return_complex=None, bool? align_to_window=None) -> Tensor ```python storage_offset() → int ``` ```python stride() → int[] ``` ```python stride(dim) → int ``` ```python sub() ``` sub.Tensor(Tensor self, Tensor other, *, Scalar alpha=1) -> Tensor sub.Scalar(Tensor self, Scalar other, Scalar alpha=1) -> Tensor ```python sub_(other, *, alpha=1) → Tensor ``` In-place version of tensorplay.Tensor.sub() ```python subtract() ``` subtract.Tensor(Tensor self, Tensor other, *, Scalar alpha=1) -> Tensor subtract.Scalar(Tensor self, Scalar other, Scalar alpha=1) -> Tensor ```python subtract_(other, *, alpha=1) → Tensor ``` In-place version of tensorplay.Tensor.subtract() ```python sum() ``` sum(Tensor self, *, ScalarType dtype=Undefined) -> Tensor sum.dim_IntList(Tensor self, int[] dim, bool keepdim=false, *, ScalarType dtype=Undefined) -> Tensor ```python sum_to_size() ``` sum_to_size(Tensor self, SymInt[] size) -> Tensor ```python svd() ``` svd(Tensor self, bool some=True, bool compute_uv=True) -> (Tensor U, Tensor S, Tensor V) ```python swapaxes() ``` swapaxes(Tensor(a) self, int axis0, int axis1) -> Tensor(a) ```python swapaxes_() ``` swapaxes_(Tensor(a!) self, int axis0, int axis1) -> Tensor(a!) ```python swapdims() ``` swapdims(Tensor(a) self, int dim0, int dim1) -> Tensor(a) ```python swapdims_() ``` swapdims_(Tensor(a!) self, int dim0, int dim1) -> Tensor(a!) ```python swish() ``` swish(Tensor self) -> Tensor ```python t() ``` t(Tensor(a) self) -> Tensor(a) ```python t_() ``` t_(Tensor(a!) self) -> Tensor(a!) ```python take() ``` take(Tensor self, Tensor index) -> Tensor ```python take_along_dim() ``` take_along_dim(Tensor self, Tensor indices, int? dim=None) -> Tensor ```python tan() ``` tan(Tensor self) -> Tensor ```python tan_() ``` tan_(Tensor(a!) self) -> Tensor(a!) ```python tanh() ``` tanh(Tensor self) -> Tensor ```python tanh_() ``` tanh_(Tensor(a!) self) -> Tensor(a!) ```python tanh_backward() ``` tanh_backward(Tensor grad_output, Tensor output) -> Tensor ```python tanhshrink() ``` tanhshrink(Tensor self) -> Tensor ```python tensor_split(indices_or_sections, dim=0) → List of Tensors ``` Splits this tensor into several views along [dim](#tensorplay.nn.attention.bias.CausalBias.dim). indices_or_sections is either the number of equal sections, the list of boundary indices at which the split happens, or a 0-dimensional integer tensor holding those boundaries. See tensorplay.tensor_split() ```python threshold_() ``` threshold_(Tensor(a!) self, Scalar threshold, Scalar value) -> Tensor(a!) ```python tile() ``` tile(Tensor self, SymInt[] dims) -> Tensor ```python to_dense() ``` to_dense(Tensor self) -> Tensor ```python to_mkldnn() ``` to_mkldnn(Tensor self, ScalarType? dtype=None) -> Tensor ```python to_padded_tensor() ``` to_padded_tensor(Tensor self, float padding, SymInt[]? output_size=None) -> Tensor ```python to_sparse() ``` to_sparse(Tensor self) -> Tensor to_sparse.sparse_dim(Tensor self, int sparse_dim) -> Tensor ```python to_sparse_bsc() ``` to_sparse_bsc(Tensor self, int[2] blocksize, int? dense_dim=None) -> Tensor ```python to_sparse_bsr() ``` to_sparse_bsr(Tensor self, int[2] blocksize, int? dense_dim=None) -> Tensor ```python to_sparse_coo() ``` Convert a tensor to [coordinate format](/docs/sparse.html#sparse-coo-docs). ```python to_sparse_csc() ``` to_sparse_csc(Tensor self, int? dense_dim=None) -> Tensor ```python to_sparse_csr() ``` to_sparse_csr(Tensor self) -> Tensor ```python tolist(self: tensorplay._C.TensorBase) → object ``` ```python trace() ``` trace(Tensor self) -> Tensor ```python transpose() ``` transpose(Tensor(a) self, int dim0, int dim1) -> Tensor(a) transpose.int(Tensor(a) self, int dim0, int dim1) -> Tensor(a) ```python transpose_() ``` transpose_(Tensor(a!) self, int dim0, int dim1) -> Tensor(a!) ```python triangular_solve() ``` triangular_solve(Tensor self, Tensor A, bool upper=True, bool transpose=False, bool unitriangular=False) -> (Tensor solution, Tensor cloned_coefficient) ```python tril() ``` tril(Tensor self, SymInt diagonal=0) -> Tensor ```python tril_() ``` tril_(Tensor(a!) self, SymInt diagonal=0) -> Tensor(a!) ```python triu() ``` triu(Tensor self, SymInt diagonal=0) -> Tensor ```python triu_() ``` triu_(Tensor(a!) self, SymInt diagonal=0) -> Tensor(a!) ```python true_divide() ``` true_divide.Tensor(Tensor self, Tensor other) -> Tensor true_divide.Scalar(Tensor self, Scalar other) -> Tensor ```python true_divide_() ``` true_divide_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!) true_divide_.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!) ```python trunc() ``` trunc(Tensor self) -> Tensor ```python trunc_() ``` trunc_(Tensor(a!) self) -> Tensor(a!) ```python type(dtype=None, non_blocking=False, **kwargs) ``` Returns the type if dtype is not provided, else casts this object to the specified type. ```python unbind() ``` unbind(Tensor(a) self, int dim=0) -> Tensor(a)[] unbind.int(Tensor(a -> *) self, int dim=0) -> Tensor(a)[] ```python unflatten() ``` unflatten.int(Tensor self, int dim, SymInt[] sizes) -> Tensor ```python unfold() ``` unfold(Tensor(a) self, int dimension, int size, int step) -> Tensor(a) ```python uniform_() ``` uniform_(Tensor(a!) self, float from=0.0, float to=1.0, *, Generator? generator=None) -> Tensor(a!) ```python unsafe_chunk() ``` unsafe_chunk(Tensor self, int chunks, int dim=0) -> Tensor[] ```python unsafe_split() ``` unsafe_split.Tensor(Tensor self, SymInt split_size, int dim=0) -> Tensor[] ```python unsafe_split_with_sizes() ``` unsafe_split_with_sizes(Tensor self, SymInt[] split_sizes, int dim=0) -> Tensor[] ```python unsqueeze() ``` unsqueeze(Tensor(a) self, int dim) -> Tensor(a) ```python unsqueeze_() ``` unsqueeze_(Tensor(a!) self, int dim) -> Tensor(a!) ```python untyped_storage(self: tensorplay._C.TensorBase) → tensorplay._C.UntypedStorage ``` ```python var() ``` var(Tensor self, int correction=1) -> Tensor var.dim(Tensor self, int[] dim, int correction=1, bool keepdim=false) -> Tensor var.correction(Tensor self, int[1]? dim=None, *, Scalar? correction=None, bool keepdim=False) -> Tensor ```python vdot() ``` vdot(Tensor self, Tensor other) -> Tensor ```python view(*shape) → Tensor ``` ```python view(dtype) → Tensor ``` ```python view_as() ``` view_as(Tensor(a) self, Tensor other) -> Tensor(a) ```python view_as_complex() ``` view_as_complex(Tensor(a) self) -> Tensor(a) ```python view_as_real() ``` view_as_real(Tensor(a) self) -> Tensor(a) ```python vsplit(split_size_or_sections) → List of Tensors ``` Splits a tensor of at least two dimensions into views along the first axis. split_size_or_sections is either the number of equal sections or the list of sizes of each section. See tensorplay.vsplit() ```python where() ``` where.self(Tensor condition, Tensor self, Tensor other) -> Tensor where.ScalarOther(Tensor condition, Tensor self, Scalar other) -> Tensor ```python xlog1py() ``` xlog1py(Tensor self, Tensor other) -> Tensor ```python xlog1py_() ``` xlog1py_(Tensor(a!) self, Tensor other) -> Tensor(a!) ```python xlogy() ``` xlogy(Tensor self, Tensor other) -> Tensor xlogy.Tensor(Tensor self, Tensor other) -> Tensor xlogy.Scalar_Other(Tensor self, Scalar other) -> Tensor ```python xlogy_() ``` xlogy_(Tensor(a!) self, Tensor other) -> Tensor(a!) xlogy_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!) xlogy_.Scalar_Other(Tensor(a!) self, Scalar other) -> Tensor(a!) ```python zero_() ``` zero_(Tensor(a!) self) -> Tensor(a!) ```python zeta() ``` zeta(Tensor self, Tensor other) -> Tensor [#](#api-tensorplay.nn.attention.bias.CausalVariant) ### CausalVariant class[Full reference ↗](/docs/generated/tensorplay.nn.attention.bias.CausalVariant.html) ```python class tensorplay.nn.attention.bias.CausalVariant(*values) ``` Enum for causal variants used in attention mechanisms. Defines two types of causal biases: UPPER_LEFT: Represents upper-left triangular bias for standard causal attention. The equivalent code for constructing this bias is: ``` tensorplay.tril(tensorplay.ones(size, dtype=tensorplay.bool)) ``` For instance, with shape=(3,4), the materialized bias tensor will be: ``` [[1, 0, 0, 0], [1, 1, 0, 0], [1, 1, 1, 0]] ``` LOWER_RIGHT: Represents lower-right triangular bias, the include values are aligned to the lower right corner of the matrix. The equivalent code for constructing this bias is: ``` diagonal_offset = size[1] - size[0] tensorplay.tril( tensorplay.ones(size, dtype=tensorplay.bool), diagonal=diagonal_offset, ) ``` For instance, with shape=(3,4), the materialized bias tensor will be: ``` [[1, 1, 0, 0], [1, 1, 1, 0], [1, 1, 1, 1]] ``` Note that these variants are equivalent to each other when the sequence lengths of the query and key/value tensors are equal since the triangular matrix is square. > **Warning** > > This enum is a prototype and subject to change. ```python as_integer_ratio() ``` Return a pair of integers, whose ratio is equal to the original int. The ratio is in lowest terms and has a positive denominator. ``` >>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10, 1) >>> (0).as_integer_ratio() (0, 1) ``` ```python bit_count() ``` Number of ones in the binary representation of the absolute value of self. Also known as the population count. ``` >>> bin(13) '0b1101' >>> (13).bit_count() 3 ``` ```python bit_length() ``` Number of bits necessary to represent self in binary. ``` >>> bin(37) '0b100101' >>> (37).bit_length() 6 ``` ```python conjugate() ``` Returns self, the complex conjugate of any int. ```python denominator ``` the denominator of a rational number in lowest terms ```python classmethod from_bytes(bytes, byteorder='big', *, signed=False) ``` ```python imag ``` the imaginary part of a complex number ```python is_integer() ``` Returns True. Exists for duck type compatibility with float.is_integer. ```python numerator ``` the numerator of a rational number in lowest terms ```python real ``` the real part of a complex number ```python to_bytes(length=1, byteorder='big', *, signed=False) ```