mindspore.Tensor

class mindspore.Tensor(input_data=None, dtype=None, shape=None, init=None, internal=False, const_arg=False)[source]

Tensor is a data structure that stores an n-dimensional array.

Note

If init interface is used to initialize Tensor, the Tensor.init_data API needs to be called to load the actual data to Tensor.

Warning

To convert dtype of a Tensor, it is recommended to use Tensor.astype() rather than Tensor(sourceTensor, dtype=newDtype).

Parameters
  • input_data (Union[Tensor, float, int, bool, tuple, list, numpy.ndarray]) – The data to be stored. It can be another Tensor, Python number or NumPy ndarray. Default: None .

  • dtype (mindspore.dtype) – Used to indicate the data type of the output Tensor. The argument should be defined in mindspore.dtype. If it is None , the data type of the output Tensor will be the same as the input_data. Default: None .

  • shape (Union[tuple, list, int, mindspore.Symbol]) – Used to indicate the shape of the output Tensor. If input_data is available, shape doesn’t need to be set. If None or Symbol exists in shape , a tensor of dynamic shape is created, input_data doesn’t need to be set; if only integers exist in shape, a tensor of static shape is created, input_data or init must be set. Default: None .

  • init (Initializer) – The information of init data. init is used for delayed initialization in parallel mode, when using init, dtype and shape must be set. Default: None .

  • internal (bool) – Whether it is created by the framework. 'True' means that the tensor is created by framework. 'False' means that the tensor is created by user. Default: False .

  • const_arg (bool) – Whether the tensor is a constant when it is used for the argument of a network. Default: False .

Outputs:

Tensor.

Note

The default value None of input_data works as a placeholder, it does not mean that we can create a NoneType Tensor. Tensor with shape contains 0 is not fully tested and supported.

Examples

>>> import numpy as np
>>> import mindspore as ms
>>> from mindspore import Tensor
>>> from mindspore.common.initializer import One
>>> # initialize a tensor with numpy.ndarray
>>> t1 = Tensor(np.zeros([1, 2, 3]), ms.float32)
>>> print(t1)
[[[0. 0. 0.]
[0. 0. 0.]]]
>>> print(type(t1))
<class 'mindspore.common.tensor.Tensor'>
>>> print(t1.shape)
(1, 2, 3)
>>> print(t1.dtype)
Float32
>>>
>>> # initialize a tensor with a float scalar
>>> t2 = Tensor(0.1)
>>> print(t2)
0.1
>>> print(type(t2))
<class 'mindspore.common.tensor.Tensor'>
>>> print(t2.shape)
()
>>> print(t2.dtype)
Float32
>>>
>>> # initialize a tensor with a tuple
>>> t3 = Tensor((1, 2))
>>> print(t3)
[1 2]
>>> print(type(t3))
<class 'mindspore.common.tensor.Tensor'>
>>> print(t3.shape)
(2,)
>>> print(t3.dtype)
Int64
...
>>> # initialize a tensor with init
>>> t4 = Tensor(shape = (1, 3), dtype=ms.float32, init=One())
>>> print(t4)
[[1. 1. 1.]]
>>> print(type(t4))
<class 'mindspore.common.tensor.Tensor'>
>>> print(t4.shape)
(1, 3)
>>> print(t4.dtype)
Float32

mindspore.Tensor.abs

For details, please refer to mindspore.ops.abs().

mindspore.Tensor.absolute

Alias for mindspore.Tensor.abs().

mindspore.Tensor.acos

For details, please refer to mindspore.ops.acos().

mindspore.Tensor.acosh

For details, please refer to mindspore.ops.acosh().

mindspore.Tensor.add

For details, please refer to mindspore.ops.add().

mindspore.Tensor.addbmm

For details, please refer to mindspore.ops.addbmm().

mindspore.Tensor.addcdiv

For details, please refer to mindspore.ops.addcdiv().

mindspore.Tensor.addcmul

For details, please refer to mindspore.ops.addcmul().

mindspore.Tensor.addmm

For details, please refer to mindspore.ops.addmm().

mindspore.Tensor.addmv

For details, please refer to mindspore.ops.addmv().

mindspore.Tensor.addr

For details, please refer to mindspore.ops.addr().

mindspore.Tensor.adjoint

For details, please refer to mindspore.ops.adjoint().

mindspore.Tensor.all

For details, please refer to mindspore.ops.all().

mindspore.Tensor.amax

For details, please refer to mindspore.ops.amax().

mindspore.Tensor.amin

For details, please refer to mindspore.ops.amin().

mindspore.Tensor.aminmax

For details, please refer to mindspore.ops.aminmax().

mindspore.Tensor.any

For details, please refer to mindspore.ops.any().

mindspore.Tensor.angle

For details, please refer to mindspore.ops.angle().

mindspore.Tensor.approximate_equal

For details, please refer to mindspore.ops.approximate_equal().

mindspore.Tensor.arccos

Alias for mindspore.Tensor.acos().

mindspore.Tensor.arccosh

For details, please refer to mindspore.ops.arccosh().

mindspore.Tensor.arcsin

For details, please refer to mindspore.ops.arcsin().

mindspore.Tensor.arcsinh

Alias for mindspore.Tensor.asinh().

mindspore.Tensor.arctan

For details, please refer to mindspore.ops.arctan().

mindspore.Tensor.arctan2

For details, please refer to mindspore.ops.arctan2().

mindspore.Tensor.arctanh

Alias for mindspore.Tensor.atanh().

mindspore.Tensor.argmax

For details, please refer to mindspore.ops.argmax().

mindspore.Tensor.argmax_with_value

Returns the maximum value with corresponding index.

mindspore.Tensor.argmin

For details, please refer to mindspore.ops.argmin().

mindspore.Tensor.argmin_with_value

Returns the minimum value with corresponding index.

mindspore.Tensor.argsort

For details, please refer to mindspore.ops.argsort().

mindspore.Tensor.argwhere

For details, please refer to mindspore.ops.argwhere().

mindspore.Tensor.asin

For details, please refer to mindspore.ops.asin().

mindspore.Tensor.asinh

For details, please refer to mindspore.ops.asinh().

mindspore.Tensor.asnumpy

Convert tensor to numpy array.

mindspore.Tensor.assign_value

Assign another tensor value to this tensor.

mindspore.Tensor.astype

Return a copy of the tensor, cast to a specified type.

mindspore.Tensor.atan

For details, please refer to mindspore.ops.atan().

mindspore.Tensor.atan2

For details, please refer to mindspore.ops.atan2().

mindspore.Tensor.atanh

For details, please refer to mindspore.ops.atanh().

mindspore.Tensor.baddbmm

For details, please refer to mindspore.ops.baddbmm().

mindspore.Tensor.bernoulli

For details, please refer to mindspore.ops.bernoulli().

mindspore.Tensor.bincount

For details, please refer to mindspore.ops.bincount().

mindspore.Tensor.bitwise_and

For details, please refer to mindspore.ops.bitwise_and().

mindspore.Tensor.bitwise_left_shift

For details, please refer to mindspore.ops.bitwise_left_shift().

mindspore.Tensor.bitwise_or

For details, please refer to mindspore.ops.bitwise_or().

mindspore.Tensor.bitwise_right_shift

For details, please refer to mindspore.ops.bitwise_right_shift().

mindspore.Tensor.bitwise_xor

For details, please refer to mindspore.ops.bitwise_xor().

mindspore.Tensor.bmm

For details, please refer to mindspore.ops.bmm().

mindspore.Tensor.bool

Converts input tensor dtype to bool.

mindspore.Tensor.broadcast_to

For details, please refer to mindspore.ops.broadcast_to().

mindspore.Tensor.cauchy

Fills the tensor with numbers drawn from the Cauchy distribution.

mindspore.Tensor.ceil

For details, please refer to mindspore.ops.ceil().

mindspore.Tensor.cholesky

For details, please refer to mindspore.ops.cholesky().

mindspore.Tensor.cholesky_solve

For details, please refer to mindspore.ops.cholesky_solve().

mindspore.Tensor.choose

Construct a tensor from an index tensor and a list of tensors to choose from.

mindspore.Tensor.chunk

For details, please refer to mindspore.ops.chunk().

mindspore.Tensor.clamp

For details, please refer to mindspore.ops.clamp().

mindspore.Tensor.clip

Alias for mindspore.Tensor.clamp().

mindspore.Tensor.col2im

For details, please refer to mindspore.ops.col2im().

mindspore.Tensor.conj

For details, please refer to mindspore.ops.conj().

mindspore.Tensor.contiguous

Converts a Tensor into a continuous-memory Tensor that contains the same data as the original Tensor.

mindspore.Tensor.copy

Return a copy of the tensor.

mindspore.Tensor.copysign

For details, please refer to mindspore.ops.copysign().

mindspore.Tensor.cos

For details, please refer to mindspore.ops.cos().

mindspore.Tensor.cosh

For details, please refer to mindspore.ops.cosh().

mindspore.Tensor.count_nonzero

For details, please refer to mindspore.ops.count_nonzero().

mindspore.Tensor.cov

For details, please refer to mindspore.ops.cov().

mindspore.Tensor.cross

For details, please refer to mindspore.ops.cross().

mindspore.Tensor.cummax

For details, please refer to mindspore.ops.cummax().

mindspore.Tensor.cummin

For details, please refer to mindspore.ops.cummin().

mindspore.Tensor.cumprod

For details, please refer to mindspore.ops.cumprod().

mindspore.Tensor.cumsum

For details, please refer to mindspore.ops.cumsum().

mindspore.Tensor.deg2rad

For details, please refer to mindspore.ops.deg2rad().

mindspore.Tensor.diag

For details, please refer to mindspore.ops.diag().

mindspore.Tensor.diagflat

For details, please refer to mindspore.ops.diagflat().

mindspore.Tensor.diagonal

For details, please refer to mindspore.ops.diagonal().

mindspore.Tensor.diagonal_scatter

For details, please refer to mindspore.ops.diagonal_scatter().

mindspore.Tensor.diff

For details, please refer to mindspore.ops.diff().

mindspore.Tensor.digamma

For details, please refer to mindspore.ops.digamma().

mindspore.Tensor.div

For details, please refer to mindspore.ops.div().

mindspore.Tensor.divide

Alias for mindspore.Tensor.div().

mindspore.Tensor.dot

For details, please refer to mindspore.ops.dot().

mindspore.Tensor.dsplit

For details, please refer to mindspore.ops.dsplit().

mindspore.Tensor.dtype

Return the dtype of the tensor (mindspore.dtype).

mindspore.Tensor.eq

For details, please refer to mindspore.ops.eq().

mindspore.Tensor.equal

For details, please refer to mindspore.ops.equal().

mindspore.Tensor.erf

For details, please refer to mindspore.ops.erf().

mindspore.Tensor.erfc

For details, please refer to mindspore.ops.erfc().

mindspore.Tensor.erfinv

For details, please refer to mindspore.ops.erfinv().

mindspore.Tensor.eigvals

For details, please refer to mindspore.ops.eigvals().

mindspore.Tensor.exp

For details, please refer to mindspore.ops.exp().

mindspore.Tensor.expand_as

Expand the dimension of target tensor to the dimension of input tensor.

mindspore.Tensor.expand_dims

For details, please refer to mindspore.ops.expand_dims().

mindspore.Tensor.expm1

For details, please refer to mindspore.ops.expm1().

mindspore.Tensor.fill_diagonal

Fills the main diagonal of a Tensor with a specified value and returns the result.

mindspore.Tensor.flatten

For details, please refer to mindspore.ops.flatten().

mindspore.Tensor.flip

For details, please refer to mindspore.ops.flip().

mindspore.Tensor.fliplr

For details, please refer to mindspore.ops.fliplr().

mindspore.Tensor.flipud

For details, please refer to mindspore.ops.flipud().

mindspore.Tensor.float

Converts input tensor dtype to float32.

mindspore.Tensor.float_power

For details, please refer to mindspore.ops.float_power().

mindspore.Tensor.floor

For details, please refer to mindspore.ops.floor().

mindspore.Tensor.floor_divide

For details, please refer to mindspore.ops.floor_divide().

mindspore.Tensor.flush_from_cache

Flush cache data to host if tensor is cache enable.

mindspore.Tensor.fold

For details, please refer to mindspore.ops.fold().

mindspore.Tensor.fmax

For details, please refer to mindspore.ops.fmax().

mindspore.Tensor.fmod

For details, please refer to mindspore.ops.fmod().

mindspore.Tensor.frac

For details, please refer to mindspore.ops.frac().

mindspore.Tensor.from_numpy

Convert numpy array to Tensor.

mindspore.Tensor.gather

For details, please refer to mindspore.ops.gather().

mindspore.Tensor.gather_elements

For details, please refer to mindspore.ops.gather_elements().

mindspore.Tensor.gather_nd

For details, please refer to mindspore.ops.gather_nd().

mindspore.Tensor.ge

For details, please refer to mindspore.ops.ge().

mindspore.Tensor.geqrf

For details, please refer to mindspore.ops.geqrf().

mindspore.Tensor.ger

For details, please refer to mindspore.ops.ger().

mindspore.Tensor.greater

For details, please refer to mindspore.ops.greater().

mindspore.Tensor.greater_equal

For details, please refer to mindspore.ops.greater_equal().

mindspore.Tensor.gt

For details, please refer to mindspore.ops.gt().

mindspore.Tensor.H

Returns a view of a matrix (2-D tensor) conjugated and transposed.

mindspore.Tensor.half

Converts input tensor dtype to float16.

mindspore.Tensor.hardshrink

For details, please refer to mindspore.ops.hardshrink().

mindspore.Tensor.has_init

Whether tensor is initialized.

mindspore.Tensor.heaviside

For details, please refer to mindspore.ops.heaviside().

mindspore.Tensor.histc

For details, please refer to mindspore.ops.histc().

mindspore.Tensor.hsplit

For details, please refer to mindspore.ops.hsplit().

mindspore.Tensor.hypot

For details, please refer to mindspore.ops.hypot().

mindspore.Tensor.i0

For details, please refer to mindspore.ops.i0().

mindspore.Tensor.igamma

For details, please refer to mindspore.ops.igamma().

mindspore.Tensor.igammac

For details, please refer to mindspore.ops.igammac().

mindspore.Tensor.imag

For details, please refer to mindspore.ops.imag().

mindspore.Tensor.index_add

For details, please refer to mindspore.ops.index_add().

mindspore.Tensor.index_fill

For details, please refer to mindspore.ops.index_fill().

mindspore.Tensor.index_put

Returns a Tensor.

mindspore.Tensor.index_select

For details, please refer to mindspore.ops.index_select().

mindspore.Tensor.init_data

Get the tensor format data of this Tensor.

mindspore.Tensor.inner

For details, please refer to mindspore.ops.inner().

mindspore.Tensor.inplace_update

For details, please refer to mindspore.ops.inplace_update().

mindspore.Tensor.int

Converts input tensor dtype to int32.

mindspore.Tensor.inv

For details, please refer to mindspore.ops.inv().

mindspore.Tensor.inverse

For details, please refer to mindspore.ops.inverse().

mindspore.Tensor.invert

For details, please refer to mindspore.ops.invert().

mindspore.Tensor.isclose

For details, please refer to mindspore.ops.isclose().

mindspore.Tensor.isfinite

For details, please refer to mindspore.ops.isfinite().

mindspore.Tensor.is_floating_point

For details, please refer to mindspore.ops.is_floating_point().

mindspore.Tensor.isinf

For details, please refer to mindspore.ops.isinf().

mindspore.Tensor.isnan

For details, please refer to mindspore.ops.isnan().

mindspore.Tensor.isneginf

For details, please refer to mindspore.ops.isneginf().

mindspore.Tensor.isposinf

For details, please refer to mindspore.ops.isposinf().

mindspore.Tensor.isreal

For details, please refer to mindspore.ops.isreal().

mindspore.Tensor.is_signed

Judge whether the data type of tensor is a signed data type.

mindspore.Tensor.is_complex

For details, please refer to mindspore.ops.is_complex().

mindspore.Tensor.is_contiguous

Determines whether the memory of tensor is contiguous.

mindspore.Tensor.item

Get the item at the specified index of the tensor.

mindspore.Tensor.itemset

Insert scalar into a tensor (scalar is cast to tensor's dtype, if possible).

mindspore.Tensor.itemsize

Return the length of one tensor element in bytes.

mindspore.Tensor.lcm

For details, please refer to mindspore.ops.lcm().

mindspore.Tensor.ldexp

For details, please refer to mindspore.ops.ldexp().

mindspore.Tensor.le

For details, please refer to mindspore.ops.le().

mindspore.Tensor.lerp

For details, please refer to mindspore.ops.lerp().

mindspore.Tensor.less

For details, please refer to mindspore.ops.less().

mindspore.Tensor.less_equal

For details, please refer to mindspore.ops.less_equal().

mindspore.Tensor.log

For details, please refer to mindspore.ops.log().

mindspore.Tensor.log10

For details, please refer to mindspore.ops.log10().

mindspore.Tensor.log1p

For details, please refer to mindspore.ops.log1p().

mindspore.Tensor.log2

For details, please refer to mindspore.ops.log2().

mindspore.Tensor.logaddexp

For details, please refer to mindspore.ops.logaddexp().

mindspore.Tensor.logaddexp2

For details, please refer to mindspore.ops.logaddexp2().

mindspore.Tensor.logcumsumexp

For details, please refer to mindspore.ops.logcumsumexp().

mindspore.Tensor.logdet

For details, please refer to mindspore.ops.logdet().

mindspore.Tensor.logical_and

For details, please refer to mindspore.ops.logical_and().

mindspore.Tensor.logical_not

For details, please refer to mindspore.ops.logical_not().

mindspore.Tensor.logical_or

For details, please refer to mindspore.ops.logical_or().

mindspore.Tensor.logical_xor

For details, please refer to mindspore.ops.logical_xor().

mindspore.Tensor.logit

For details, please refer to mindspore.ops.logit().

mindspore.Tensor.logsumexp

For details, please refer to mindspore.ops.logsumexp().

mindspore.Tensor.log_normal

Fills the elements of the input tensor with log normal values initialized by given mean and std:

mindspore.Tensor.long

Converts input tensor dtype to int64.

mindspore.Tensor.lt

Alias for mindspore.Tensor.less().

mindspore.Tensor.lu_solve

For details, please refer to mindspore.ops.lu_solve().

mindspore.Tensor.masked_fill

For details, please refer to mindspore.ops.masked_fill().

mindspore.Tensor.masked_scatter

Returns a Tensor.

mindspore.Tensor.masked_select

For details, please refer to mindspore.ops.masked_select().

mindspore.Tensor.matmul

For details, please refer to mindspore.ops.matmul().

mindspore.Tensor.max

Return the maximum of a tensor or maximum along an axis.

mindspore.Tensor.maximum

For details, please refer to mindspore.ops.maximum().

mindspore.Tensor.mean

For details, please refer to mindspore.ops.mean().

mindspore.Tensor.median

For details, please refer to mindspore.ops.median().

mindspore.Tensor.mH

Accessing this property is equivalent to Calling self.adjoint().

mindspore.Tensor.min

Return the minimum of a tensor or minimum along an axis.

mindspore.Tensor.minimum

For details, please refer to mindspore.ops.minimum().

mindspore.Tensor.mm

For details, please refer to mindspore.ops.mm().

mindspore.Tensor.movedim

For details, please refer to mindspore.ops.movedim().

mindspore.Tensor.moveaxis

For details, please refer to mindspore.ops.moveaxis().

mindspore.Tensor.msort

For details, please refer to mindspore.ops.msort().

mindspore.Tensor.mT

Returns the Tensor that exchanges the last two dimensions.

mindspore.Tensor.mul

For details, please refer to mindspore.ops.mul().

mindspore.Tensor.multinomial

For details, please refer to mindspore.ops.multinomial().

mindspore.Tensor.multiply

For details, please refer to mindspore.ops.multiply().

mindspore.Tensor.mvlgamma

For details, please refer to mindspore.ops.mvlgamma().

mindspore.Tensor.nan_to_num

For details, please refer to mindspore.ops.nan_to_num().

mindspore.Tensor.nanmean

For details, please refer to mindspore.ops.nanmean().

mindspore.Tensor.nanmedian

For details, please refer to mindspore.ops.nanmedian().

mindspore.Tensor.nansum

For details, please refer to mindspore.ops.nansum().

mindspore.Tensor.narrow

For details, please refer to mindspore.ops.narrow().

mindspore.Tensor.nbytes

Return the total number of bytes taken by the tensor.

mindspore.Tensor.ndim

Return the number of tensor dimensions.

mindspore.Tensor.ndimension

Alias for mindspore.Tensor.ndim().

mindspore.Tensor.ne

For details, please refer to mindspore.ops.ne().

mindspore.Tensor.neg

For details, please refer to mindspore.ops.neg().

mindspore.Tensor.negative

For details, please refer to mindspore.ops.negative().

mindspore.Tensor.nelement

Alias for mindspore.Tensor.numel().

mindspore.Tensor.new_ones

Return a tensor of size filled with ones.

mindspore.Tensor.new_zeros

Return a tensor of size filled with zeros.

mindspore.Tensor.nextafter

For details, please refer to mindspore.ops.nextafter().

mindspore.Tensor.numel

For details, please refer to mindspore.ops.numel().

mindspore.Tensor.numpy

Alias for mindspore.Tensor.asnumpy().

mindspore.Tensor.nonzero

For details, please refer to mindspore.ops.nonzero().

mindspore.Tensor.norm

For details, please refer to mindspore.ops.norm().

mindspore.Tensor.not_equal

For details, please refer to mindspore.ops.not_equal().

mindspore.Tensor.outer

For details, please refer to mindspore.ops.outer().

mindspore.Tensor.orgqr

For details, please refer to mindspore.ops.orgqr().

mindspore.Tensor.ormqr

For details, please refer to mindspore.ops.ormqr(), Args input2 and input3 correspond to the args tau and other of mindspore.ops.ormqr().

mindspore.Tensor.permute

For details, please refer to mindspore.ops.permute().

mindspore.Tensor.positive

For details, please refer to mindspore.ops.positive().

mindspore.Tensor.pow

For details, please refer to mindspore.ops.pow().

mindspore.Tensor.prod

For details, please refer to mindspore.ops.prod().

mindspore.Tensor.ptp

The name of the function comes from the acronym for "peak to peak".

mindspore.Tensor.rad2deg

For details, please refer to mindspore.ops.rad2deg().

mindspore.Tensor.random_categorical

For details, please refer to mindspore.ops.random_categorical().

mindspore.Tensor.ravel

Return a contiguous flattened tensor.

mindspore.Tensor.real

For details, please refer to mindspore.ops.real().

mindspore.Tensor.reciprocal

For details, please refer to mindspore.ops.reciprocal().

mindspore.Tensor.remainder

For details, please refer to mindspore.ops.remainder().

mindspore.Tensor.renorm

For details, please refer to mindspore.ops.renorm().

mindspore.Tensor.repeat

Repeat elements of a tensor.

mindspore.Tensor.repeat_interleave

For details, please refer to mindspore.ops.repeat_interleave().

mindspore.Tensor.reshape

Rearranges the input Tensor based on the given shape .

mindspore.Tensor.reshape_as

Change the shape of the Tensor to the shape of other without changing the data.

mindspore.Tensor.resize

Changes shape and size of tensor in-place.

mindspore.Tensor.reverse

For details, please refer to mindspore.ops.flip().

mindspore.Tensor.reverse_sequence

For details, please refer to mindspore.ops.reverse_sequence().

mindspore.Tensor.roll

For details, please refer to mindspore.ops.roll().

mindspore.Tensor.round

For details, please refer to mindspore.ops.round().

mindspore.Tensor.rot90

For details, please refer to mindspore.ops.rot90().

mindspore.Tensor.rsqrt

For details, please refer to mindspore.ops.rsqrt().

mindspore.Tensor.register_hook

Registers a backward hook for tensor.

mindspore.Tensor.scatter

For details, please refer to mindspore.ops.scatter().

mindspore.Tensor.scatter_add

For details, please refer to mindspore.ops.scatter_add().

mindspore.Tensor.scatter_div

For details, please refer to mindspore.ops.scatter_div().

mindspore.Tensor.scatter_max

For details, please refer to mindspore.ops.scatter_max().

mindspore.Tensor.scatter_min

For details, please refer to mindspore.ops.scatter_min().

mindspore.Tensor.scatter_mul

For details, please refer to mindspore.ops.scatter_mul().

mindspore.Tensor.scatter_sub

Creates a new tensor by subtracting the values from the positions in self tensor indicated by indices, with values from updates.

mindspore.Tensor.searchsorted

Finds indices where elements should be inserted to maintain order.

mindspore.Tensor.select

For details, please refer to mindspore.ops.select().

mindspore.Tensor.select_scatter

For details, please refer to mindspore.ops.select_scatter().

mindspore.Tensor.set_const_arg

Specify whether the tensor is a constant when it is used for the argument of a network.

mindspore.Tensor.sgn

For details, please refer to mindspore.ops.sgn().

mindspore.Tensor.shape

For details, please refer to mindspore.ops.shape().

mindspore.Tensor.short

Return a copy of the tensor, cast to int16 type, equivalent to self.astype(mstype.int16).

mindspore.Tensor.sigmoid

For details, please refer to mindspore.ops.sigmoid().

mindspore.Tensor.sign

For details, please refer to mindspore.ops.sign().

mindspore.Tensor.signbit

For details, please refer to mindspore.ops.signbit().

mindspore.Tensor.sin

For details, please refer to mindspore.ops.sin().

mindspore.Tensor.sinc

For details, please refer to mindspore.ops.sinc().

mindspore.Tensor.sinh

For details, please refer to mindspore.ops.sinh().

mindspore.Tensor.size

For details, please refer to mindspore.ops.size().

mindspore.Tensor.slice_scatter

For details, please refer to mindspore.ops.slice_scatter().

mindspore.Tensor.slogdet

For details, please refer to mindspore.ops.slogdet().

mindspore.Tensor.softmax

For details, please refer to mindspore.ops.softmax().

mindspore.Tensor.sort

For details, please refer to mindspore.ops.sort().

mindspore.Tensor.split

For details, please refer to mindspore.ops.split().

mindspore.Tensor.sqrt

For details, please refer to mindspore.ops.sqrt().

mindspore.Tensor.square

For details, please refer to mindspore.ops.square().

mindspore.Tensor.squeeze

For details, please refer to mindspore.ops.squeeze().

mindspore.Tensor.std

For details, please refer to mindspore.ops.std().

mindspore.Tensor.storage_offset

Tensor's offset in the underlying storage in terms of the number of storage elements.

mindspore.Tensor.stride

The stride to jump from one element to the next in the input dim.

mindspore.Tensor.strides

Return the tuple of bytes to step in each dimension when traversing a tensor.

mindspore.Tensor.sub

For details, please refer to mindspore.ops.sub().

mindspore.Tensor.subtract

For details, please refer to mindspore.ops.subtract().

mindspore.Tensor.sum

Return sum of tensor elements over a given axis.

mindspore.Tensor.sum_to_size

Sum self Tensor to the size.

mindspore.Tensor.svd

For details, please refer to mindspore.ops.svd().

mindspore.Tensor.swapaxes

For details, please refer to mindspore.ops.swapaxes().

mindspore.Tensor.swapdims

For details, please refer to mindspore.ops.swapdims().

mindspore.Tensor.T

Return the transposed tensor.

mindspore.Tensor.t

For details, please refer to mindspore.ops.t().

mindspore.Tensor.take

Takes elements from a tensor along an axis.

mindspore.Tensor.tan

For details, please refer to mindspore.ops.tan().

mindspore.Tensor.tanh

For details, please refer to mindspore.ops.tanh().

mindspore.Tensor.tensor_split

For details, please refer to mindspore.ops.tensor_split().

mindspore.Tensor.tile

For details, please refer to mindspore.ops.tile().

mindspore.Tensor.to

Performs tensor dtype conversion.

mindspore.Tensor.to_coo

Convert a Tensor to COOTensor.

mindspore.Tensor.to_csr

Convert a Tensor to CSRTensor.

mindspore.Tensor.tolist

Convert a Tensor to List.

mindspore.Tensor.topk

For details, please refer to mindspore.ops.topk().

mindspore.Tensor.trace

Return the sum along diagonals of the tensor.

mindspore.Tensor.transpose

For details, please refer to mindspore.ops.transpose().

mindspore.Tensor.tril

For details, please refer to mindspore.ops.tril().

mindspore.Tensor.triu

For details, please refer to mindspore.ops.triu().

mindspore.Tensor.true_divide

Alias for Tensor.div() with \(rounding\_mode=None\).

mindspore.Tensor.trunc

For details, please refer to mindspore.ops.trunc().

mindspore.Tensor.type

Change the dtype of the Tensor to the dtype .

mindspore.Tensor.type_as

Change the dtype of the Tensor to the dtype of other.

mindspore.Tensor.unbind

For details, please refer to mindspore.ops.unbind().

mindspore.Tensor.unfold

For details, please refer to mindspore.ops.unfold().

mindspore.Tensor.unique_consecutive

For details, please refer to mindspore.ops.unique_consecutive().

mindspore.Tensor.unique_with_pad

For details, please refer to mindspore.ops.unique_with_pad().

mindspore.Tensor.unsorted_segment_max

For details, please refer to mindspore.ops.unsorted_segment_max().

mindspore.Tensor.unsorted_segment_min

For details, please refer to mindspore.ops.unsorted_segment_min().

mindspore.Tensor.unsorted_segment_prod

For details, please refer to mindspore.ops.unsorted_segment_prod().

mindspore.Tensor.unsqueeze

For details, please refer to mindspore.ops.unsqueeze().

mindspore.Tensor.var

Compute the variance along the specified axis.

mindspore.Tensor.view

Reshape the tensor according to the input shape.

mindspore.Tensor.view_as

View self Tensor as the same shape as other .

mindspore.Tensor.where

For details, please refer to mindspore.ops.where().

mindspore.Tensor.xdivy

For details, please refer to mindspore.ops.xdivy().

mindspore.Tensor.xlogy

For details, please refer to mindspore.ops.xlogy().

mindspore.Tensor.vsplit

For details, please refer to mindspore.ops.vsplit().