add api_python_en and modify some pagedisplay problems
This commit is contained in:
parent
c33eb85f9a
commit
5e1db76311
|
@ -245,11 +245,13 @@ mindspore.Tensor
|
|||
- **axis** (int) - 扩展维度指定的轴。
|
||||
|
||||
**返回:**
|
||||
Tensor, 指定轴上扩展的维度为1。
|
||||
|
||||
Tensor, 指定轴上扩展的维度为1。
|
||||
|
||||
**异常:**
|
||||
- **TypeError** - axis不是int类型。
|
||||
- **ValueError** - axis的取值不在[-self.ndim - 1, self.ndim + 1)。
|
||||
|
||||
- **TypeError** - axis不是int类型。
|
||||
- **ValueError** - axis的取值不在[-self.ndim - 1, self.ndim + 1)。
|
||||
|
||||
.. py:method:: fill(value)
|
||||
|
||||
|
@ -374,16 +376,19 @@ mindspore.Tensor
|
|||
根据mask矩阵,将值为True对应位置填充为value值。mask矩阵的shape必须与原Tensor相同。
|
||||
|
||||
**参数:**
|
||||
- **mask** (Tensor[bool]) - mask矩阵,值为bool类型的Tensor。
|
||||
- **value** (Union[int, float]) - 填充值,可以为int或float类型。
|
||||
|
||||
- **mask** (Tensor[bool]) - mask矩阵,值为bool类型的Tensor。
|
||||
- **value** (Union[int, float]) - 填充值,可以为int或float类型。
|
||||
|
||||
**返回:**
|
||||
Tensor, shape和dtype与原Tensor相同。
|
||||
|
||||
Tensor, shape和dtype与原Tensor相同。
|
||||
|
||||
**异常:**
|
||||
- **TypeError** - mask不是Tensor。
|
||||
- **TypeError** - mask不是bool类型的Tensor。
|
||||
- **TypeError** - value不是int或float类型。
|
||||
|
||||
- **TypeError** - mask不是Tensor。
|
||||
- **TypeError** - mask不是bool类型的Tensor。
|
||||
- **TypeError** - value不是int或float类型。
|
||||
|
||||
.. py:method:: max(axis=None, keepdims=False, initial=None, where=True)
|
||||
|
||||
|
@ -441,20 +446,23 @@ mindspore.Tensor
|
|||
沿指定轴,指定起始位置获取指定长度的Tensor。
|
||||
|
||||
**参数:**
|
||||
- **axis** (int) - 指定的轴。
|
||||
- **start** (int) - 指定的起始位置。
|
||||
- **length** (int) - 指定的长度。
|
||||
|
||||
- **axis** (int) - 指定的轴。
|
||||
- **start** (int) - 指定的起始位置。
|
||||
- **length** (int) - 指定的长度。
|
||||
|
||||
**返回:**
|
||||
Tensor。
|
||||
|
||||
Tensor。
|
||||
|
||||
**异常:**
|
||||
- **TypeError** - axis不是int类型。
|
||||
- **TypeError** - start不是int类型。
|
||||
- **TypeError** - length不是int类型。
|
||||
- **ValueError** - axis取值不在[0, ndim-1]范围内。
|
||||
- **ValueError** - start取值不在[0, shape[axis]-1]范围内。
|
||||
- **ValueError** - start+length超出Tensor的维度范围shape[axis]-1。
|
||||
|
||||
- **TypeError** - axis不是int类型。
|
||||
- **TypeError** - start不是int类型。
|
||||
- **TypeError** - length不是int类型。
|
||||
- **ValueError** - axis取值不在[0, ndim-1]范围内。
|
||||
- **ValueError** - start取值不在[0, shape[axis]-1]范围内。
|
||||
- **ValueError** - start+length超出Tensor的维度范围shape[axis]-1。
|
||||
|
||||
.. py:method:: nbytes
|
||||
:property:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.. py:class:: mindspore.train.callback.History(has_trained_epoch=0)
|
||||
.. py:class:: mindspore.train.callback.History
|
||||
|
||||
将网络输出的相关信息记录到 `History` 对象中。
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
mindspore.boost
|
||||
===============
|
||||
|
||||
.. automodule:: mindspore.boost
|
||||
:members:
|
|
@ -0,0 +1,5 @@
|
|||
mindspore.common.initializer
|
||||
============================
|
||||
|
||||
.. automodule:: mindspore.common.initializer
|
||||
:members:
|
|
@ -0,0 +1,13 @@
|
|||
mindspore.communication
|
||||
=======================
|
||||
|
||||
.. automodule:: mindspore.communication
|
||||
:members:
|
||||
|
||||
.. py:data:: mindspore.communication.HCCL_WORLD_COMM_GROUP
|
||||
|
||||
The string of "hccl_world_group" referring to the default communication group created by HCCL.
|
||||
|
||||
.. py:data:: mindspore.communication.NCCL_WORLD_COMM_GROUP
|
||||
|
||||
The string of "nccl_world_group" referring to the default communication group created by NCCL.
|
|
@ -0,0 +1,6 @@
|
|||
mindspore.context
|
||||
=================
|
||||
|
||||
.. automodule:: mindspore.context
|
||||
:exclude-members: set_fl_context, get_fl_context
|
||||
:members:
|
|
@ -0,0 +1,37 @@
|
|||
mindspore.dataset.audio
|
||||
=======================
|
||||
|
||||
.. automodule:: mindspore.dataset.audio
|
||||
|
||||
mindspore.dataset.audio.transforms
|
||||
----------------------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: dataset_audio
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.dataset.audio.transforms.AllpassBiquad
|
||||
mindspore.dataset.audio.transforms.AmplitudeToDB
|
||||
mindspore.dataset.audio.transforms.Angle
|
||||
mindspore.dataset.audio.transforms.BandBiquad
|
||||
mindspore.dataset.audio.transforms.BandpassBiquad
|
||||
mindspore.dataset.audio.transforms.BandrejectBiquad
|
||||
mindspore.dataset.audio.transforms.BassBiquad
|
||||
mindspore.dataset.audio.transforms.ComplexNorm
|
||||
mindspore.dataset.audio.transforms.Contrast
|
||||
mindspore.dataset.audio.transforms.FrequencyMasking
|
||||
mindspore.dataset.audio.transforms.LowpassBiquad
|
||||
mindspore.dataset.audio.transforms.TimeMasking
|
||||
mindspore.dataset.audio.transforms.TimeStretch
|
||||
|
||||
|
||||
mindspore.dataset.audio.utils
|
||||
-----------------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: dataset_audio
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.dataset.audio.utils.ScaleType
|
|
@ -0,0 +1,5 @@
|
|||
mindspore.dataset.config
|
||||
========================
|
||||
|
||||
.. automodule:: mindspore.dataset.config
|
||||
:members:
|
|
@ -0,0 +1,156 @@
|
|||
mindspore.dataset
|
||||
=================
|
||||
|
||||
.. automodule:: mindspore.dataset
|
||||
|
||||
Vision
|
||||
-------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: dataset
|
||||
:nosignatures:
|
||||
:template: classtemplate_inherited.rst
|
||||
|
||||
mindspore.dataset.Caltech101Dataset
|
||||
mindspore.dataset.Caltech256Dataset
|
||||
mindspore.dataset.CelebADataset
|
||||
mindspore.dataset.Cifar10Dataset
|
||||
mindspore.dataset.Cifar100Dataset
|
||||
mindspore.dataset.CityscapesDataset
|
||||
mindspore.dataset.CocoDataset
|
||||
mindspore.dataset.DIV2KDataset
|
||||
mindspore.dataset.EMnistDataset
|
||||
mindspore.dataset.FakeImageDataset
|
||||
mindspore.dataset.FashionMnistDataset
|
||||
mindspore.dataset.FlickrDataset
|
||||
mindspore.dataset.Flowers102Dataset
|
||||
mindspore.dataset.ImageFolderDataset
|
||||
mindspore.dataset.KMnistDataset
|
||||
mindspore.dataset.ManifestDataset
|
||||
mindspore.dataset.MnistDataset
|
||||
mindspore.dataset.PhotoTourDataset
|
||||
mindspore.dataset.Places365Dataset
|
||||
mindspore.dataset.QMnistDataset
|
||||
mindspore.dataset.SBDataset
|
||||
mindspore.dataset.SBUDataset
|
||||
mindspore.dataset.SemeionDataset
|
||||
mindspore.dataset.STL10Dataset
|
||||
mindspore.dataset.SVHNDataset
|
||||
mindspore.dataset.USPSDataset
|
||||
mindspore.dataset.VOCDataset
|
||||
mindspore.dataset.WIDERFaceDataset
|
||||
|
||||
Text
|
||||
-----
|
||||
|
||||
.. autosummary::
|
||||
:toctree: dataset
|
||||
:nosignatures:
|
||||
:template: classtemplate_inherited.rst
|
||||
|
||||
mindspore.dataset.AGNewsDataset
|
||||
mindspore.dataset.AmazonReviewDataset
|
||||
mindspore.dataset.CLUEDataset
|
||||
mindspore.dataset.CoNLL2000Dataset
|
||||
mindspore.dataset.CSVDataset
|
||||
mindspore.dataset.DBpediaDataset
|
||||
mindspore.dataset.EnWik9Dataset
|
||||
mindspore.dataset.IMDBDataset
|
||||
mindspore.dataset.IWSLT2016Dataset
|
||||
mindspore.dataset.IWSLT2017Dataset
|
||||
mindspore.dataset.PennTreebankDataset
|
||||
mindspore.dataset.SogouNewsDataset
|
||||
mindspore.dataset.TextFileDataset
|
||||
mindspore.dataset.UDPOSDataset
|
||||
mindspore.dataset.WikiTextDataset
|
||||
mindspore.dataset.YahooAnswersDataset
|
||||
mindspore.dataset.YelpReviewDataset
|
||||
|
||||
Audio
|
||||
------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: dataset
|
||||
:nosignatures:
|
||||
:template: classtemplate_inherited.rst
|
||||
|
||||
mindspore.dataset.LJSpeechDataset
|
||||
mindspore.dataset.SpeechCommandsDataset
|
||||
mindspore.dataset.TedliumDataset
|
||||
mindspore.dataset.YesNoDataset
|
||||
|
||||
Standard Format
|
||||
----------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: dataset
|
||||
:nosignatures:
|
||||
:template: classtemplate_inherited.rst
|
||||
|
||||
mindspore.dataset.CSVDataset
|
||||
mindspore.dataset.MindDataset
|
||||
mindspore.dataset.OBSMindDataset
|
||||
mindspore.dataset.TFRecordDataset
|
||||
|
||||
User Defined
|
||||
--------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: dataset
|
||||
:nosignatures:
|
||||
:template: classtemplate_inherited.rst
|
||||
|
||||
mindspore.dataset.GeneratorDataset
|
||||
mindspore.dataset.NumpySlicesDataset
|
||||
mindspore.dataset.PaddedDataset
|
||||
mindspore.dataset.RandomDataset
|
||||
|
||||
Graph
|
||||
------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: dataset
|
||||
:nosignatures:
|
||||
:template: classtemplate_inherited.rst
|
||||
|
||||
mindspore.dataset.GraphData
|
||||
|
||||
Sampler
|
||||
--------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: dataset
|
||||
:nosignatures:
|
||||
:template: classtemplate_inherited_sampler.rst
|
||||
|
||||
mindspore.dataset.DistributedSampler
|
||||
mindspore.dataset.PKSampler
|
||||
mindspore.dataset.RandomSampler
|
||||
mindspore.dataset.SequentialSampler
|
||||
mindspore.dataset.SubsetRandomSampler
|
||||
mindspore.dataset.SubsetSampler
|
||||
mindspore.dataset.WeightedRandomSampler
|
||||
|
||||
Others
|
||||
-------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: dataset
|
||||
:nosignatures:
|
||||
:template: classtemplate_inherited.rst
|
||||
|
||||
mindspore.dataset.BatchInfo
|
||||
mindspore.dataset.DatasetCache
|
||||
mindspore.dataset.DSCallback
|
||||
mindspore.dataset.SamplingStrategy
|
||||
mindspore.dataset.Schema
|
||||
mindspore.dataset.Shuffle
|
||||
mindspore.dataset.WaitedDSCallback
|
||||
mindspore.dataset.OutputFormat
|
||||
mindspore.dataset.compare
|
||||
mindspore.dataset.deserialize
|
||||
mindspore.dataset.serialize
|
||||
mindspore.dataset.show
|
||||
mindspore.dataset.sync_wait_for_dataset
|
||||
mindspore.dataset.utils.imshow_det_bbox
|
||||
mindspore.dataset.zip
|
|
@ -0,0 +1,50 @@
|
|||
mindspore.dataset.text
|
||||
======================
|
||||
|
||||
.. automodule:: mindspore.dataset.text
|
||||
|
||||
mindspore.dataset.text.transforms
|
||||
---------------------------------
|
||||
|
||||
.. msnoteautosummary::
|
||||
:toctree: dataset_text
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.dataset.text.transforms.BasicTokenizer
|
||||
mindspore.dataset.text.transforms.BertTokenizer
|
||||
mindspore.dataset.text.transforms.CaseFold
|
||||
mindspore.dataset.text.transforms.JiebaTokenizer
|
||||
mindspore.dataset.text.transforms.Lookup
|
||||
mindspore.dataset.text.transforms.Ngram
|
||||
mindspore.dataset.text.transforms.NormalizeUTF8
|
||||
mindspore.dataset.text.transforms.PythonTokenizer
|
||||
mindspore.dataset.text.transforms.RegexReplace
|
||||
mindspore.dataset.text.transforms.RegexTokenizer
|
||||
mindspore.dataset.text.transforms.SentencePieceTokenizer
|
||||
mindspore.dataset.text.transforms.SlidingWindow
|
||||
mindspore.dataset.text.transforms.ToNumber
|
||||
mindspore.dataset.text.transforms.TruncateSequencePair
|
||||
mindspore.dataset.text.transforms.UnicodeCharTokenizer
|
||||
mindspore.dataset.text.transforms.UnicodeScriptTokenizer
|
||||
mindspore.dataset.text.transforms.WhitespaceTokenizer
|
||||
mindspore.dataset.text.transforms.WordpieceTokenizer
|
||||
|
||||
|
||||
mindspore.dataset.text.utils
|
||||
----------------------------
|
||||
|
||||
.. msnoteautosummary::
|
||||
:toctree: dataset_text
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.dataset.text.JiebaMode
|
||||
mindspore.dataset.text.NormalizeForm
|
||||
mindspore.dataset.text.SentencePieceModel
|
||||
mindspore.dataset.text.SentencePieceVocab
|
||||
mindspore.dataset.text.SPieceTokenizerLoadType
|
||||
mindspore.dataset.text.SPieceTokenizerOutType
|
||||
mindspore.dataset.text.to_str
|
||||
mindspore.dataset.text.to_bytes
|
||||
mindspore.dataset.text.Vocab
|
|
@ -0,0 +1,40 @@
|
|||
mindspore.dataset.transforms
|
||||
============================
|
||||
|
||||
.. automodule:: mindspore.dataset.transforms
|
||||
|
||||
mindspore.dataset.transforms.c_transforms
|
||||
-----------------------------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: dataset_transforms
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.dataset.transforms.c_transforms.Compose
|
||||
mindspore.dataset.transforms.c_transforms.Concatenate
|
||||
mindspore.dataset.transforms.c_transforms.Duplicate
|
||||
mindspore.dataset.transforms.c_transforms.Fill
|
||||
mindspore.dataset.transforms.c_transforms.Mask
|
||||
mindspore.dataset.transforms.c_transforms.OneHot
|
||||
mindspore.dataset.transforms.c_transforms.PadEnd
|
||||
mindspore.dataset.transforms.c_transforms.RandomApply
|
||||
mindspore.dataset.transforms.c_transforms.RandomChoice
|
||||
mindspore.dataset.transforms.c_transforms.Relational
|
||||
mindspore.dataset.transforms.c_transforms.Slice
|
||||
mindspore.dataset.transforms.c_transforms.TypeCast
|
||||
mindspore.dataset.transforms.c_transforms.Unique
|
||||
|
||||
mindspore.dataset.transforms.py_transforms
|
||||
------------------------------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: dataset_transforms
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.dataset.transforms.py_transforms.Compose
|
||||
mindspore.dataset.transforms.py_transforms.OneHotOp
|
||||
mindspore.dataset.transforms.py_transforms.RandomApply
|
||||
mindspore.dataset.transforms.py_transforms.RandomChoice
|
||||
mindspore.dataset.transforms.py_transforms.RandomOrder
|
|
@ -0,0 +1,115 @@
|
|||
mindspore.dataset.vision
|
||||
===================================
|
||||
|
||||
.. automodule:: mindspore.dataset.vision
|
||||
|
||||
mindspore.dataset.vision.c_transforms
|
||||
------------------------------------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: dataset_vision
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.dataset.vision.c_transforms.AutoContrast
|
||||
mindspore.dataset.vision.c_transforms.BoundingBoxAugment
|
||||
mindspore.dataset.vision.c_transforms.CenterCrop
|
||||
mindspore.dataset.vision.c_transforms.ConvertColor
|
||||
mindspore.dataset.vision.c_transforms.Crop
|
||||
mindspore.dataset.vision.c_transforms.CutMixBatch
|
||||
mindspore.dataset.vision.c_transforms.CutOut
|
||||
mindspore.dataset.vision.c_transforms.Decode
|
||||
mindspore.dataset.vision.c_transforms.Equalize
|
||||
mindspore.dataset.vision.c_transforms.GaussianBlur
|
||||
mindspore.dataset.vision.c_transforms.HorizontalFlip
|
||||
mindspore.dataset.vision.c_transforms.HWC2CHW
|
||||
mindspore.dataset.vision.c_transforms.Invert
|
||||
mindspore.dataset.vision.c_transforms.MixUpBatch
|
||||
mindspore.dataset.vision.c_transforms.Normalize
|
||||
mindspore.dataset.vision.c_transforms.NormalizePad
|
||||
mindspore.dataset.vision.c_transforms.Pad
|
||||
mindspore.dataset.vision.c_transforms.RandomAffine
|
||||
mindspore.dataset.vision.c_transforms.RandomColor
|
||||
mindspore.dataset.vision.c_transforms.RandomColorAdjust
|
||||
mindspore.dataset.vision.c_transforms.RandomCrop
|
||||
mindspore.dataset.vision.c_transforms.RandomCropDecodeResize
|
||||
mindspore.dataset.vision.c_transforms.RandomCropWithBBox
|
||||
mindspore.dataset.vision.c_transforms.RandomHorizontalFlip
|
||||
mindspore.dataset.vision.c_transforms.RandomHorizontalFlipWithBBox
|
||||
mindspore.dataset.vision.c_transforms.RandomPosterize
|
||||
mindspore.dataset.vision.c_transforms.RandomResize
|
||||
mindspore.dataset.vision.c_transforms.RandomResizedCrop
|
||||
mindspore.dataset.vision.c_transforms.RandomResizedCropWithBBox
|
||||
mindspore.dataset.vision.c_transforms.RandomResizeWithBBox
|
||||
mindspore.dataset.vision.c_transforms.RandomRotation
|
||||
mindspore.dataset.vision.c_transforms.RandomSelectSubpolicy
|
||||
mindspore.dataset.vision.c_transforms.RandomSharpness
|
||||
mindspore.dataset.vision.c_transforms.RandomSolarize
|
||||
mindspore.dataset.vision.c_transforms.RandomVerticalFlip
|
||||
mindspore.dataset.vision.c_transforms.RandomVerticalFlipWithBBox
|
||||
mindspore.dataset.vision.c_transforms.Rescale
|
||||
mindspore.dataset.vision.c_transforms.Resize
|
||||
mindspore.dataset.vision.c_transforms.ResizeWithBBox
|
||||
mindspore.dataset.vision.c_transforms.Rotate
|
||||
mindspore.dataset.vision.c_transforms.SlicePatches
|
||||
mindspore.dataset.vision.c_transforms.SoftDvppDecodeRandomCropResizeJpeg
|
||||
mindspore.dataset.vision.c_transforms.SoftDvppDecodeResizeJpeg
|
||||
mindspore.dataset.vision.c_transforms.UniformAugment
|
||||
mindspore.dataset.vision.c_transforms.VerticalFlip
|
||||
|
||||
mindspore.dataset.vision.py_transforms
|
||||
-------------------------------------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: dataset_vision
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.dataset.vision.py_transforms.AutoContrast
|
||||
mindspore.dataset.vision.py_transforms.CenterCrop
|
||||
mindspore.dataset.vision.py_transforms.Cutout
|
||||
mindspore.dataset.vision.py_transforms.Decode
|
||||
mindspore.dataset.vision.py_transforms.Equalize
|
||||
mindspore.dataset.vision.py_transforms.FiveCrop
|
||||
mindspore.dataset.vision.py_transforms.Grayscale
|
||||
mindspore.dataset.vision.py_transforms.HsvToRgb
|
||||
mindspore.dataset.vision.py_transforms.HWC2CHW
|
||||
mindspore.dataset.vision.py_transforms.Invert
|
||||
mindspore.dataset.vision.py_transforms.LinearTransformation
|
||||
mindspore.dataset.vision.py_transforms.MixUp
|
||||
mindspore.dataset.vision.py_transforms.Normalize
|
||||
mindspore.dataset.vision.py_transforms.NormalizePad
|
||||
mindspore.dataset.vision.py_transforms.Pad
|
||||
mindspore.dataset.vision.py_transforms.RandomAffine
|
||||
mindspore.dataset.vision.py_transforms.RandomColor
|
||||
mindspore.dataset.vision.py_transforms.RandomColorAdjust
|
||||
mindspore.dataset.vision.py_transforms.RandomCrop
|
||||
mindspore.dataset.vision.py_transforms.RandomErasing
|
||||
mindspore.dataset.vision.py_transforms.RandomGrayscale
|
||||
mindspore.dataset.vision.py_transforms.RandomHorizontalFlip
|
||||
mindspore.dataset.vision.py_transforms.RandomPerspective
|
||||
mindspore.dataset.vision.py_transforms.RandomResizedCrop
|
||||
mindspore.dataset.vision.py_transforms.RandomRotation
|
||||
mindspore.dataset.vision.py_transforms.RandomSharpness
|
||||
mindspore.dataset.vision.py_transforms.RandomVerticalFlip
|
||||
mindspore.dataset.vision.py_transforms.Resize
|
||||
mindspore.dataset.vision.py_transforms.RgbToHsv
|
||||
mindspore.dataset.vision.py_transforms.TenCrop
|
||||
mindspore.dataset.vision.py_transforms.ToPIL
|
||||
mindspore.dataset.vision.py_transforms.ToTensor
|
||||
mindspore.dataset.vision.py_transforms.ToType
|
||||
mindspore.dataset.vision.py_transforms.UniformAugment
|
||||
|
||||
mindspore.dataset.vision.utils
|
||||
-------------------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: dataset_vision
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.dataset.vision.Border
|
||||
mindspore.dataset.vision.ConvertMode
|
||||
mindspore.dataset.vision.ImageBatchFormat
|
||||
mindspore.dataset.vision.Inter
|
||||
mindspore.dataset.vision.SliceMode
|
|
@ -0,0 +1,5 @@
|
|||
mindspore.mindrecord
|
||||
====================
|
||||
|
||||
.. automodule:: mindspore.mindrecord
|
||||
:members:
|
|
@ -0,0 +1,42 @@
|
|||
mindspore.nn.probability
|
||||
========================
|
||||
|
||||
Bijectors
|
||||
---------
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: nn_probability
|
||||
:nosignatures:
|
||||
:template: classtemplate_probability.rst
|
||||
|
||||
mindspore.nn.probability.bijector.Bijector
|
||||
mindspore.nn.probability.bijector.Exp
|
||||
mindspore.nn.probability.bijector.GumbelCDF
|
||||
mindspore.nn.probability.bijector.Invert
|
||||
mindspore.nn.probability.bijector.PowerTransform
|
||||
mindspore.nn.probability.bijector.ScalarAffine
|
||||
mindspore.nn.probability.bijector.Softplus
|
||||
|
||||
Distributions
|
||||
--------------
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: nn_probability
|
||||
:nosignatures:
|
||||
:template: classtemplate_probability.rst
|
||||
|
||||
mindspore.nn.probability.distribution.Bernoulli
|
||||
mindspore.nn.probability.distribution.Beta
|
||||
mindspore.nn.probability.distribution.Categorical
|
||||
mindspore.nn.probability.distribution.Cauchy
|
||||
mindspore.nn.probability.distribution.Distribution
|
||||
mindspore.nn.probability.distribution.Exponential
|
||||
mindspore.nn.probability.distribution.Gamma
|
||||
mindspore.nn.probability.distribution.Geometric
|
||||
mindspore.nn.probability.distribution.Gumbel
|
||||
mindspore.nn.probability.distribution.Logistic
|
||||
mindspore.nn.probability.distribution.LogNormal
|
||||
mindspore.nn.probability.distribution.Normal
|
||||
mindspore.nn.probability.distribution.Poisson
|
||||
mindspore.nn.probability.distribution.TransformedDistribution
|
||||
mindspore.nn.probability.distribution.Uniform
|
|
@ -0,0 +1,416 @@
|
|||
mindspore.nn
|
||||
=============
|
||||
|
||||
Neural Network Cell
|
||||
|
||||
For building predefined building blocks or computational units in neural networks.
|
||||
|
||||
Compared with the previous version, the added, deleted and supported platforms change information of `mindspore.nn` operators in MindSpore, please refer to the link `<https://gitee.com/mindspore/docs/blob/master/resource/api_updates/nn_api_updates.md>`_.
|
||||
|
||||
Basic Building Block
|
||||
--------------------
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: nn
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.nn.Cell
|
||||
mindspore.nn.GraphCell
|
||||
mindspore.nn.LossBase
|
||||
mindspore.nn.Optimizer
|
||||
|
||||
Container
|
||||
---------
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: nn
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.nn.CellList
|
||||
mindspore.nn.SequentialCell
|
||||
|
||||
Encapsulation Layer
|
||||
-------------------
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: nn
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.nn.DistributedGradReducer
|
||||
mindspore.nn.DynamicLossScaleUpdateCell
|
||||
mindspore.nn.FixedLossScaleUpdateCell
|
||||
mindspore.nn.ForwardValueAndGrad
|
||||
mindspore.nn.GetNextSingleOp
|
||||
mindspore.nn.MicroBatchInterleaved
|
||||
mindspore.nn.ParameterUpdate
|
||||
mindspore.nn.PipelineCell
|
||||
mindspore.nn.TimeDistributed
|
||||
mindspore.nn.TrainOneStepCell
|
||||
mindspore.nn.TrainOneStepWithLossScaleCell
|
||||
mindspore.nn.WithEvalCell
|
||||
mindspore.nn.WithGradCell
|
||||
mindspore.nn.WithLossCell
|
||||
|
||||
Convolutional Neural Network Layer
|
||||
----------------------------------
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: nn
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.nn.Conv1d
|
||||
mindspore.nn.Conv1dTranspose
|
||||
mindspore.nn.Conv2d
|
||||
mindspore.nn.Conv2dTranspose
|
||||
mindspore.nn.Conv3d
|
||||
mindspore.nn.Conv3dTranspose
|
||||
mindspore.nn.Unfold
|
||||
|
||||
Recurrent Neural Network Layer
|
||||
------------------------------
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: nn
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.nn.RNN
|
||||
mindspore.nn.RNNCell
|
||||
mindspore.nn.GRU
|
||||
mindspore.nn.GRUCell
|
||||
mindspore.nn.LSTM
|
||||
mindspore.nn.LSTMCell
|
||||
|
||||
Embedding Layer
|
||||
---------------
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: nn
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.nn.Embedding
|
||||
mindspore.nn.EmbeddingLookup
|
||||
mindspore.nn.MultiFieldEmbeddingLookup
|
||||
|
||||
Nonlinear Activation Function Layer
|
||||
-----------------------------------
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: nn
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.nn.CELU
|
||||
mindspore.nn.ELU
|
||||
mindspore.nn.FastGelu
|
||||
mindspore.nn.GELU
|
||||
mindspore.nn.HShrink
|
||||
mindspore.nn.HSigmoid
|
||||
mindspore.nn.HSwish
|
||||
mindspore.nn.LeakyReLU
|
||||
mindspore.nn.LogSigmoid
|
||||
mindspore.nn.LogSoftmax
|
||||
mindspore.nn.PReLU
|
||||
mindspore.nn.ReLU
|
||||
mindspore.nn.ReLU6
|
||||
mindspore.nn.Sigmoid
|
||||
mindspore.nn.Softmax
|
||||
mindspore.nn.SoftShrink
|
||||
mindspore.nn.Tanh
|
||||
|
||||
Linear Layer
|
||||
------------
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: nn
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.nn.Dense
|
||||
|
||||
Dropout Layer
|
||||
-------------
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: nn
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.nn.Dropout
|
||||
|
||||
Normalization Layer
|
||||
-------------------
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: nn
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.nn.BatchNorm1d
|
||||
mindspore.nn.BatchNorm2d
|
||||
mindspore.nn.BatchNorm3d
|
||||
mindspore.nn.GlobalBatchNorm
|
||||
mindspore.nn.GroupNorm
|
||||
mindspore.nn.InstanceNorm2d
|
||||
mindspore.nn.LayerNorm
|
||||
mindspore.nn.SyncBatchNorm
|
||||
|
||||
Pooling Layer
|
||||
-------------
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: nn
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.nn.AvgPool1d
|
||||
mindspore.nn.AvgPool2d
|
||||
mindspore.nn.MaxPool1d
|
||||
mindspore.nn.MaxPool2d
|
||||
|
||||
Filling Layer
|
||||
-------------
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: nn
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.nn.Pad
|
||||
|
||||
Loss Function
|
||||
-------------
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: nn
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.nn.BCELoss
|
||||
mindspore.nn.BCEWithLogitsLoss
|
||||
mindspore.nn.CosineEmbeddingLoss
|
||||
mindspore.nn.DiceLoss
|
||||
mindspore.nn.FocalLoss
|
||||
mindspore.nn.L1Loss
|
||||
mindspore.nn.MSELoss
|
||||
mindspore.nn.MultiClassDiceLoss
|
||||
mindspore.nn.RMSELoss
|
||||
mindspore.nn.SampledSoftmaxLoss
|
||||
mindspore.nn.SmoothL1Loss
|
||||
mindspore.nn.SoftMarginLoss
|
||||
mindspore.nn.SoftmaxCrossEntropyWithLogits
|
||||
|
||||
Optimizer
|
||||
---------
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: nn
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.nn.Adagrad
|
||||
mindspore.nn.Adam
|
||||
mindspore.nn.AdamOffload
|
||||
mindspore.nn.AdamWeightDecay
|
||||
mindspore.nn.AdaSumByDeltaWeightWrapCell
|
||||
mindspore.nn.AdaSumByGradWrapCell
|
||||
mindspore.nn.ASGD
|
||||
mindspore.nn.FTRL
|
||||
mindspore.nn.Lamb
|
||||
mindspore.nn.LARS
|
||||
mindspore.nn.LazyAdam
|
||||
mindspore.nn.Momentum
|
||||
mindspore.nn.ProximalAdagrad
|
||||
mindspore.nn.RMSProp
|
||||
mindspore.nn.Rprop
|
||||
mindspore.nn.SGD
|
||||
mindspore.nn.thor
|
||||
|
||||
Evaluation Metrics
|
||||
------------------
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: nn
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.nn.Accuracy
|
||||
mindspore.nn.auc
|
||||
mindspore.nn.BleuScore
|
||||
mindspore.nn.ConfusionMatrix
|
||||
mindspore.nn.ConfusionMatrixMetric
|
||||
mindspore.nn.CosineSimilarity
|
||||
mindspore.nn.Dice
|
||||
mindspore.nn.F1
|
||||
mindspore.nn.Fbeta
|
||||
mindspore.nn.HausdorffDistance
|
||||
mindspore.nn.get_metric_fn
|
||||
mindspore.nn.Loss
|
||||
mindspore.nn.MAE
|
||||
mindspore.nn.MeanSurfaceDistance
|
||||
mindspore.nn.Metric
|
||||
mindspore.nn.MSE
|
||||
mindspore.nn.names
|
||||
mindspore.nn.OcclusionSensitivity
|
||||
mindspore.nn.Perplexity
|
||||
mindspore.nn.Precision
|
||||
mindspore.nn.Recall
|
||||
mindspore.nn.ROC
|
||||
mindspore.nn.RootMeanSquareDistance
|
||||
mindspore.nn.rearrange_inputs
|
||||
mindspore.nn.Top1CategoricalAccuracy
|
||||
mindspore.nn.Top5CategoricalAccuracy
|
||||
mindspore.nn.TopKCategoricalAccuracy
|
||||
|
||||
Dynamic Learning Rate
|
||||
---------------------
|
||||
|
||||
LearningRateSchedule Class
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The dynamic learning rates in this module are all subclasses of LearningRateSchedule. Pass the instance of
|
||||
LearningRateSchedule to an optimizer. During the training process, the optimizer calls the instance taking current step
|
||||
as input to get the current learning rate.
|
||||
|
||||
.. code-block::
|
||||
|
||||
import mindspore.nn as nn
|
||||
|
||||
min_lr = 0.01
|
||||
max_lr = 0.1
|
||||
decay_steps = 4
|
||||
cosine_decay_lr = nn.CosineDecayLR(min_lr, max_lr, decay_steps)
|
||||
|
||||
net = Net()
|
||||
optim = nn.Momentum(net.trainable_params(), learning_rate=cosine_decay_lr, momentum=0.9)
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: nn
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.nn.CosineDecayLR
|
||||
mindspore.nn.ExponentialDecayLR
|
||||
mindspore.nn.InverseDecayLR
|
||||
mindspore.nn.NaturalExpDecayLR
|
||||
mindspore.nn.PolynomialDecayLR
|
||||
mindspore.nn.WarmUpLR
|
||||
|
||||
Dynamic LR Function
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The dynamic learning rates in this module are all functions. Call the function and pass the result to an optimizer.
|
||||
During the training process, the optimizer takes result[current step] as current learning rate.
|
||||
|
||||
.. code-block::
|
||||
|
||||
import mindspore.nn as nn
|
||||
|
||||
min_lr = 0.01
|
||||
max_lr = 0.1
|
||||
total_step = 6
|
||||
step_per_epoch = 1
|
||||
decay_epoch = 4
|
||||
|
||||
lr= nn.cosine_decay_lr(min_lr, max_lr, total_step, step_per_epoch, decay_epoch)
|
||||
|
||||
net = Net()
|
||||
optim = nn.Momentum(net.trainable_params(), learning_rate=lr, momentum=0.9)
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: nn
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.nn.cosine_decay_lr
|
||||
mindspore.nn.exponential_decay_lr
|
||||
mindspore.nn.inverse_decay_lr
|
||||
mindspore.nn.natural_exp_decay_lr
|
||||
mindspore.nn.piecewise_constant_lr
|
||||
mindspore.nn.polynomial_decay_lr
|
||||
mindspore.nn.warmup_lr
|
||||
|
||||
Sparse Layer
|
||||
------------
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: nn
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.nn.SparseTensorDenseMatmul
|
||||
mindspore.nn.SparseToDense
|
||||
|
||||
Image Processing Layer
|
||||
----------------------
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: nn
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.nn.CentralCrop
|
||||
mindspore.nn.ImageGradients
|
||||
mindspore.nn.MSSSIM
|
||||
mindspore.nn.PSNR
|
||||
mindspore.nn.ResizeBilinear
|
||||
mindspore.nn.SSIM
|
||||
|
||||
Matrix Processing
|
||||
-----------------
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: nn
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.nn.MatrixDiag
|
||||
mindspore.nn.MatrixDiagPart
|
||||
mindspore.nn.MatrixSetDiag
|
||||
|
||||
Tools
|
||||
-----
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: nn
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.nn.ClipByNorm
|
||||
mindspore.nn.Flatten
|
||||
mindspore.nn.get_activation
|
||||
mindspore.nn.L1Regularizer
|
||||
mindspore.nn.Norm
|
||||
mindspore.nn.OneHot
|
||||
mindspore.nn.Range
|
||||
mindspore.nn.Roll
|
||||
mindspore.nn.Tril
|
||||
mindspore.nn.Triu
|
||||
|
||||
Mathematical Operations
|
||||
-----------------------
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: nn
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.nn.MatMul
|
||||
mindspore.nn.Moments
|
||||
mindspore.nn.ReduceLogSumExp
|
||||
|
||||
Gradient
|
||||
--------
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: nn
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.nn.Jvp
|
||||
mindspore.nn.Vjp
|
|
@ -0,0 +1,5 @@
|
|||
mindspore.nn.transformer
|
||||
========================
|
||||
|
||||
.. automodule:: mindspore.nn.transformer
|
||||
:members:
|
|
@ -0,0 +1,724 @@
|
|||
mindspore.numpy
|
||||
===============
|
||||
|
||||
.. currentmodule:: mindspore.numpy
|
||||
|
||||
MindSpore Numpy package contains a set of Numpy-like interfaces, which allows developers to build models on MindSpore with similar syntax of Numpy.
|
||||
|
||||
MindSpore Numpy operators can be classified into four functional modules: `array generation`, `array operation`, `logic operation` and `math operation`.
|
||||
|
||||
Common imported modules in corresponding API examples are as follows:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import mindspore.numpy as np
|
||||
|
||||
Array Generation
|
||||
----------------
|
||||
|
||||
Array generation operators are used to generate tensors.
|
||||
|
||||
Here is an example to generate an array:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import mindspore.numpy as np
|
||||
import mindspore.ops as ops
|
||||
|
||||
input_x = np.array([1, 2, 3], np.float32)
|
||||
print("input_x =", input_x)
|
||||
print("type of input_x =", ops.typeof(input_x))
|
||||
|
||||
The result is as follows:
|
||||
|
||||
.. code-block::
|
||||
|
||||
input_x = [1. 2. 3.]
|
||||
type of input_x = Tensor[Float32]
|
||||
|
||||
Here we have more examples:
|
||||
|
||||
- Generate a tensor filled with the same element
|
||||
|
||||
`np.full` can be used to generate a tensor with user-specified values:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
input_x = np.full((2, 3), 6, np.float32)
|
||||
print(input_x)
|
||||
|
||||
The result is as follows:
|
||||
|
||||
.. code-block::
|
||||
|
||||
[[6. 6. 6.]
|
||||
[6. 6. 6.]]
|
||||
|
||||
|
||||
Here is another example to generate an array with the specified shape and filled with the value of 1:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
input_x = np.ones((2, 3), np.float32)
|
||||
print(input_x)
|
||||
|
||||
The result is as follows:
|
||||
|
||||
.. code-block::
|
||||
|
||||
[[1. 1. 1.]
|
||||
[1. 1. 1.]]
|
||||
|
||||
|
||||
- Generate tensors in a specified range
|
||||
|
||||
Generate an arithmetic array within the specified range:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
input_x = np.arange(0, 5, 1)
|
||||
print(input_x)
|
||||
|
||||
The result is as follows:
|
||||
|
||||
.. code-block::
|
||||
|
||||
[0 1 2 3 4]
|
||||
|
||||
|
||||
- Generate tensors with specific requirement
|
||||
|
||||
Generate a matrix where the lower elements are 1 and the upper elements are 0 on the given diagonal:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
input_x = np.tri(3, 3, 1)
|
||||
print(input_x)
|
||||
|
||||
The result is as follows:
|
||||
|
||||
.. code-block::
|
||||
|
||||
[[1. 1. 0.]
|
||||
[1. 1. 1.]
|
||||
[1. 1. 1.]]
|
||||
|
||||
|
||||
Another example, generate a 2-D matrix with a diagonal of 1 and other elements of 0:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
input_x = np.eye(2, 2)
|
||||
print(input_x)
|
||||
|
||||
The result is as follows:
|
||||
|
||||
.. code-block::
|
||||
|
||||
[[1. 0.]
|
||||
[0. 1.]]
|
||||
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: numpy
|
||||
:nosignatures:
|
||||
:template: classtemplate_inherited.rst
|
||||
|
||||
mindspore.numpy.arange
|
||||
mindspore.numpy.array
|
||||
mindspore.numpy.asarray
|
||||
mindspore.numpy.asfarray
|
||||
mindspore.numpy.bartlett
|
||||
mindspore.numpy.blackman
|
||||
mindspore.numpy.copy
|
||||
mindspore.numpy.diag
|
||||
mindspore.numpy.diag_indices
|
||||
mindspore.numpy.diagflat
|
||||
mindspore.numpy.diagonal
|
||||
mindspore.numpy.empty
|
||||
mindspore.numpy.empty_like
|
||||
mindspore.numpy.eye
|
||||
mindspore.numpy.full
|
||||
mindspore.numpy.full_like
|
||||
mindspore.numpy.geomspace
|
||||
mindspore.numpy.hamming
|
||||
mindspore.numpy.hanning
|
||||
mindspore.numpy.histogram_bin_edges
|
||||
mindspore.numpy.identity
|
||||
mindspore.numpy.indices
|
||||
mindspore.numpy.ix_
|
||||
mindspore.numpy.linspace
|
||||
mindspore.numpy.logspace
|
||||
mindspore.numpy.meshgrid
|
||||
mindspore.numpy.mgrid
|
||||
mindspore.numpy.ogrid
|
||||
mindspore.numpy.ones
|
||||
mindspore.numpy.ones_like
|
||||
mindspore.numpy.pad
|
||||
mindspore.numpy.rand
|
||||
mindspore.numpy.randint
|
||||
mindspore.numpy.randn
|
||||
mindspore.numpy.trace
|
||||
mindspore.numpy.tri
|
||||
mindspore.numpy.tril
|
||||
mindspore.numpy.tril_indices
|
||||
mindspore.numpy.tril_indices_from
|
||||
mindspore.numpy.triu
|
||||
mindspore.numpy.triu_indices
|
||||
mindspore.numpy.triu_indices_from
|
||||
mindspore.numpy.vander
|
||||
mindspore.numpy.zeros
|
||||
mindspore.numpy.zeros_like
|
||||
|
||||
Array Operation
|
||||
---------------
|
||||
|
||||
Array operations focus on tensor manipulation.
|
||||
|
||||
- Manipulate the shape of the tensor
|
||||
|
||||
For example, transpose a matrix:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
input_x = np.arange(10).reshape(5, 2)
|
||||
output = np.transpose(input_x)
|
||||
print(output)
|
||||
|
||||
The result is as follows:
|
||||
|
||||
.. code-block::
|
||||
|
||||
[[0 2 4 6 8]
|
||||
[1 3 5 7 9]]
|
||||
|
||||
|
||||
Another example, swap two axes:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
input_x = np.ones((1, 2, 3))
|
||||
output = np.swapaxes(input_x, 0, 1)
|
||||
print(output.shape)
|
||||
|
||||
The result is as follows:
|
||||
|
||||
.. code-block::
|
||||
|
||||
(2, 1, 3)
|
||||
|
||||
|
||||
- Tensor splitting
|
||||
|
||||
Divide the input tensor into multiple tensors equally, for example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
input_x = np.arange(9)
|
||||
output = np.split(input_x, 3)
|
||||
print(output)
|
||||
|
||||
The result is as follows:
|
||||
|
||||
.. code-block::
|
||||
|
||||
(Tensor(shape=[3], dtype=Int32, value= [0, 1, 2]), Tensor(shape=[3], dtype=Int32, value= [3, 4, 5]), Tensor(shape=[3], dtype=Int32, value= [6, 7, 8]))
|
||||
|
||||
- Tensor combination
|
||||
|
||||
Concatenate the two tensors according to the specified axis, for example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
input_x = np.arange(0, 5)
|
||||
input_y = np.arange(10, 15)
|
||||
output = np.concatenate((input_x, input_y), axis=0)
|
||||
print(output)
|
||||
|
||||
The result is as follows:
|
||||
|
||||
.. code-block::
|
||||
|
||||
[ 0 1 2 3 4 10 11 12 13 14]
|
||||
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: numpy
|
||||
:nosignatures:
|
||||
:template: classtemplate_inherited.rst
|
||||
|
||||
mindspore.numpy.append
|
||||
mindspore.numpy.apply_along_axis
|
||||
mindspore.numpy.apply_over_axes
|
||||
mindspore.numpy.array_split
|
||||
mindspore.numpy.array_str
|
||||
mindspore.numpy.atleast_1d
|
||||
mindspore.numpy.atleast_2d
|
||||
mindspore.numpy.atleast_3d
|
||||
mindspore.numpy.broadcast_arrays
|
||||
mindspore.numpy.broadcast_to
|
||||
mindspore.numpy.choose
|
||||
mindspore.numpy.column_stack
|
||||
mindspore.numpy.concatenate
|
||||
mindspore.numpy.dsplit
|
||||
mindspore.numpy.dstack
|
||||
mindspore.numpy.expand_dims
|
||||
mindspore.numpy.flip
|
||||
mindspore.numpy.fliplr
|
||||
mindspore.numpy.flipud
|
||||
mindspore.numpy.hsplit
|
||||
mindspore.numpy.hstack
|
||||
mindspore.numpy.moveaxis
|
||||
mindspore.numpy.piecewise
|
||||
mindspore.numpy.ravel
|
||||
mindspore.numpy.repeat
|
||||
mindspore.numpy.reshape
|
||||
mindspore.numpy.roll
|
||||
mindspore.numpy.rollaxis
|
||||
mindspore.numpy.rot90
|
||||
mindspore.numpy.select
|
||||
mindspore.numpy.size
|
||||
mindspore.numpy.split
|
||||
mindspore.numpy.squeeze
|
||||
mindspore.numpy.stack
|
||||
mindspore.numpy.swapaxes
|
||||
mindspore.numpy.take
|
||||
mindspore.numpy.take_along_axis
|
||||
mindspore.numpy.tile
|
||||
mindspore.numpy.transpose
|
||||
mindspore.numpy.unique
|
||||
mindspore.numpy.unravel_index
|
||||
mindspore.numpy.vsplit
|
||||
mindspore.numpy.vstack
|
||||
mindspore.numpy.where
|
||||
|
||||
Logic
|
||||
-----
|
||||
|
||||
Logic operations define computations related with boolean types.
|
||||
Examples of `equal` and `less` operations are as follows:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
input_x = np.arange(0, 5)
|
||||
input_y = np.arange(0, 10, 2)
|
||||
output = np.equal(input_x, input_y)
|
||||
print("output of equal:", output)
|
||||
output = np.less(input_x, input_y)
|
||||
print("output of less:", output)
|
||||
|
||||
The result is as follows:
|
||||
|
||||
.. code-block::
|
||||
|
||||
output of equal: [ True False False False False]
|
||||
output of less: [False True True True True]
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: numpy
|
||||
:nosignatures:
|
||||
:template: classtemplate_inherited.rst
|
||||
|
||||
mindspore.numpy.array_equal
|
||||
mindspore.numpy.array_equiv
|
||||
mindspore.numpy.equal
|
||||
mindspore.numpy.greater
|
||||
mindspore.numpy.greater_equal
|
||||
mindspore.numpy.in1d
|
||||
mindspore.numpy.isclose
|
||||
mindspore.numpy.isfinite
|
||||
mindspore.numpy.isin
|
||||
mindspore.numpy.isinf
|
||||
mindspore.numpy.isnan
|
||||
mindspore.numpy.isneginf
|
||||
mindspore.numpy.isposinf
|
||||
mindspore.numpy.isscalar
|
||||
mindspore.numpy.less
|
||||
mindspore.numpy.less_equal
|
||||
mindspore.numpy.logical_and
|
||||
mindspore.numpy.logical_not
|
||||
mindspore.numpy.logical_or
|
||||
mindspore.numpy.logical_xor
|
||||
mindspore.numpy.not_equal
|
||||
mindspore.numpy.signbit
|
||||
mindspore.numpy.sometrue
|
||||
|
||||
Math
|
||||
----
|
||||
|
||||
Math operations include basic and advanced math operations on tensors, and they have full support on Numpy broadcasting rules. Here are some examples:
|
||||
|
||||
- Sum two tensors
|
||||
|
||||
The following code implements the operation of adding two tensors of `input_x` and `input_y`:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
input_x = np.full((3, 2), [1, 2])
|
||||
input_y = np.full((3, 2), [3, 4])
|
||||
output = np.add(input_x, input_y)
|
||||
print(output)
|
||||
|
||||
The result is as follows:
|
||||
|
||||
.. code-block::
|
||||
|
||||
[[4 6]
|
||||
[4 6]
|
||||
[4 6]]
|
||||
|
||||
- Matrics multiplication
|
||||
|
||||
The following code implements the operation of multiplying two matrices `input_x` and `input_y`:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
input_x = np.arange(2*3).reshape(2, 3).astype('float32')
|
||||
input_y = np.arange(3*4).reshape(3, 4).astype('float32')
|
||||
output = np.matmul(input_x, input_y)
|
||||
print(output)
|
||||
|
||||
The result is as follows:
|
||||
|
||||
.. code-block::
|
||||
|
||||
[[20. 23. 26. 29.]
|
||||
[56. 68. 80. 92.]]
|
||||
|
||||
|
||||
- Take the average along a given axis
|
||||
|
||||
The following code implements the operation of averaging all the elements of `input_x`:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
input_x = np.arange(6).astype('float32')
|
||||
output = np.mean(input_x)
|
||||
print(output)
|
||||
|
||||
The result is as follows:
|
||||
|
||||
.. code-block::
|
||||
|
||||
2.5
|
||||
|
||||
|
||||
- Exponential arithmetic
|
||||
|
||||
The following code implements the operation of the natural constant `e` to the power of `input_x`:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
input_x = np.arange(5).astype('float32')
|
||||
output = np.exp(input_x)
|
||||
print(output)
|
||||
|
||||
The result is as follows:
|
||||
|
||||
.. code-block::
|
||||
|
||||
[ 1. 2.7182817 7.389056 20.085537 54.59815 ]
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: numpy
|
||||
:nosignatures:
|
||||
:template: classtemplate_inherited.rst
|
||||
|
||||
mindspore.numpy.absolute
|
||||
mindspore.numpy.add
|
||||
mindspore.numpy.amax
|
||||
mindspore.numpy.amin
|
||||
mindspore.numpy.arccos
|
||||
mindspore.numpy.arccosh
|
||||
mindspore.numpy.arcsin
|
||||
mindspore.numpy.arcsinh
|
||||
mindspore.numpy.arctan
|
||||
mindspore.numpy.arctan2
|
||||
mindspore.numpy.arctanh
|
||||
mindspore.numpy.argmax
|
||||
mindspore.numpy.argmin
|
||||
mindspore.numpy.around
|
||||
mindspore.numpy.average
|
||||
mindspore.numpy.bincount
|
||||
mindspore.numpy.bitwise_and
|
||||
mindspore.numpy.bitwise_or
|
||||
mindspore.numpy.bitwise_xor
|
||||
mindspore.numpy.cbrt
|
||||
mindspore.numpy.ceil
|
||||
mindspore.numpy.clip
|
||||
mindspore.numpy.convolve
|
||||
mindspore.numpy.copysign
|
||||
mindspore.numpy.corrcoef
|
||||
mindspore.numpy.correlate
|
||||
mindspore.numpy.cos
|
||||
mindspore.numpy.cosh
|
||||
mindspore.numpy.count_nonzero
|
||||
mindspore.numpy.cov
|
||||
mindspore.numpy.cross
|
||||
mindspore.numpy.cumprod
|
||||
mindspore.numpy.cumsum
|
||||
mindspore.numpy.deg2rad
|
||||
mindspore.numpy.diff
|
||||
mindspore.numpy.digitize
|
||||
mindspore.numpy.divide
|
||||
mindspore.numpy.divmod
|
||||
mindspore.numpy.dot
|
||||
mindspore.numpy.ediff1d
|
||||
mindspore.numpy.exp
|
||||
mindspore.numpy.exp2
|
||||
mindspore.numpy.expm1
|
||||
mindspore.numpy.fix
|
||||
mindspore.numpy.float_power
|
||||
mindspore.numpy.floor
|
||||
mindspore.numpy.floor_divide
|
||||
mindspore.numpy.fmod
|
||||
mindspore.numpy.gcd
|
||||
mindspore.numpy.gradient
|
||||
mindspore.numpy.heaviside
|
||||
mindspore.numpy.histogram
|
||||
mindspore.numpy.histogram2d
|
||||
mindspore.numpy.histogramdd
|
||||
mindspore.numpy.hypot
|
||||
mindspore.numpy.inner
|
||||
mindspore.numpy.interp
|
||||
mindspore.numpy.invert
|
||||
mindspore.numpy.kron
|
||||
mindspore.numpy.lcm
|
||||
mindspore.numpy.log
|
||||
mindspore.numpy.log10
|
||||
mindspore.numpy.log1p
|
||||
mindspore.numpy.log2
|
||||
mindspore.numpy.logaddexp
|
||||
mindspore.numpy.logaddexp2
|
||||
mindspore.numpy.matmul
|
||||
mindspore.numpy.matrix_power
|
||||
mindspore.numpy.maximum
|
||||
mindspore.numpy.mean
|
||||
mindspore.numpy.minimum
|
||||
mindspore.numpy.multi_dot
|
||||
mindspore.numpy.multiply
|
||||
mindspore.numpy.nancumsum
|
||||
mindspore.numpy.nanmax
|
||||
mindspore.numpy.nanmean
|
||||
mindspore.numpy.nanmin
|
||||
mindspore.numpy.nanstd
|
||||
mindspore.numpy.nansum
|
||||
mindspore.numpy.nanvar
|
||||
mindspore.numpy.negative
|
||||
mindspore.numpy.norm
|
||||
mindspore.numpy.outer
|
||||
mindspore.numpy.polyadd
|
||||
mindspore.numpy.polyder
|
||||
mindspore.numpy.polyint
|
||||
mindspore.numpy.polymul
|
||||
mindspore.numpy.polysub
|
||||
mindspore.numpy.polyval
|
||||
mindspore.numpy.positive
|
||||
mindspore.numpy.power
|
||||
mindspore.numpy.promote_types
|
||||
mindspore.numpy.ptp
|
||||
mindspore.numpy.rad2deg
|
||||
mindspore.numpy.radians
|
||||
mindspore.numpy.ravel_multi_index
|
||||
mindspore.numpy.reciprocal
|
||||
mindspore.numpy.remainder
|
||||
mindspore.numpy.result_type
|
||||
mindspore.numpy.rint
|
||||
mindspore.numpy.searchsorted
|
||||
mindspore.numpy.sign
|
||||
mindspore.numpy.sin
|
||||
mindspore.numpy.sinh
|
||||
mindspore.numpy.sqrt
|
||||
mindspore.numpy.square
|
||||
mindspore.numpy.std
|
||||
mindspore.numpy.subtract
|
||||
mindspore.numpy.sum
|
||||
mindspore.numpy.tan
|
||||
mindspore.numpy.tanh
|
||||
mindspore.numpy.tensordot
|
||||
mindspore.numpy.trapz
|
||||
mindspore.numpy.true_divide
|
||||
mindspore.numpy.trunc
|
||||
mindspore.numpy.unwrap
|
||||
mindspore.numpy.var
|
||||
|
||||
Interact With MindSpore Functions
|
||||
---------------------------------
|
||||
|
||||
Since `mindspore.numpy` directly wraps MindSpore tensors and operators, it has all the advantages and properties of MindSpore. In this section, we will briefly introduce how to employ MindSpore execution management and automatic differentiation in `mindspore.numpy` coding scenarios. These include:
|
||||
|
||||
- `ms_function`: for running codes in static graph mode for better efficiency.
|
||||
- `GradOperation`: for automatic gradient computation.
|
||||
- `mindspore.context`: for `mindspore.numpy` execution management.
|
||||
- `mindspore.nn.Cell`: for using `mindspore.numpy` interfaces in MindSpore Deep Learning Models.
|
||||
|
||||
The following are examples:
|
||||
|
||||
- Use ms_function to run code in static graph mode
|
||||
|
||||
Let's first see an example consisted of matrix multiplication and bias add, which is a typical process in Neural Networks:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import mindspore.numpy as np
|
||||
|
||||
x = np.arange(8).reshape(2, 4).astype('float32')
|
||||
w1 = np.ones((4, 8))
|
||||
b1 = np.zeros((8,))
|
||||
w2 = np.ones((8, 16))
|
||||
b2 = np.zeros((16,))
|
||||
w3 = np.ones((16, 4))
|
||||
b3 = np.zeros((4,))
|
||||
|
||||
def forward(x, w1, b1, w2, b2, w3, b3):
|
||||
x = np.dot(x, w1) + b1
|
||||
x = np.dot(x, w2) + b2
|
||||
x = np.dot(x, w3) + b3
|
||||
return x
|
||||
|
||||
print(forward(x, w1, b1, w2, b2, w3, b3))
|
||||
|
||||
The result is as follows:
|
||||
|
||||
.. code-block::
|
||||
|
||||
[[ 768. 768. 768. 768.]
|
||||
[2816. 2816. 2816. 2816.]]
|
||||
|
||||
|
||||
In this function, MindSpore dispatches each computing kernel to device separately. However, with the help of `ms_function`, we can compile all operations into a single static computing graph.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from mindspore import ms_function
|
||||
|
||||
forward_compiled = ms_function(forward)
|
||||
print(forward(x, w1, b1, w2, b2, w3, b3))
|
||||
|
||||
The result is as follows:
|
||||
|
||||
.. code-block::
|
||||
|
||||
[[ 768. 768. 768. 768.]
|
||||
[2816. 2816. 2816. 2816.]]
|
||||
|
||||
.. note::
|
||||
Currently, static graph cannot run in Python interactive mode and not all python types can be passed into functions decorated with `ms_function`. For details about how to use `ms_function`, see `API ms_function <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.ms_function.html>`_ .
|
||||
|
||||
- Use GradOperation to compute deratives
|
||||
|
||||
`GradOperation` can be used to take deratives from normal functions and functions decorated with `ms_function`. Take the previous example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from mindspore import ops
|
||||
|
||||
grad_all = ops.composite.GradOperation(get_all=True)
|
||||
print(grad_all(forward)(x, w1, b1, w2, b2, w3, b3))
|
||||
|
||||
The result is as follows:
|
||||
|
||||
.. code-block::
|
||||
|
||||
(Tensor(shape=[2, 4], dtype=Float32, value=
|
||||
[[ 5.12000000e+02, 5.12000000e+02, 5.12000000e+02, 5.12000000e+02],
|
||||
[ 5.12000000e+02, 5.12000000e+02, 5.12000000e+02, 5.12000000e+02]]),
|
||||
Tensor(shape=[4, 8], dtype=Float32, value=
|
||||
[[ 2.56000000e+02, 2.56000000e+02, 2.56000000e+02 ... 2.56000000e+02, 2.56000000e+02, 2.56000000e+02],
|
||||
[ 3.84000000e+02, 3.84000000e+02, 3.84000000e+02 ... 3.84000000e+02, 3.84000000e+02, 3.84000000e+02],
|
||||
[ 5.12000000e+02, 5.12000000e+02, 5.12000000e+02 ... 5.12000000e+02, 5.12000000e+02, 5.12000000e+02]
|
||||
[ 6.40000000e+02, 6.40000000e+02, 6.40000000e+02 ... 6.40000000e+02, 6.40000000e+02, 6.40000000e+02]]),
|
||||
...
|
||||
Tensor(shape=[4], dtype=Float32, value= [ 2.00000000e+00, 2.00000000e+00, 2.00000000e+00, 2.00000000e+00]))
|
||||
|
||||
To take the gradient of `ms_function` compiled functions, first we need to set the execution mode to static graph mode.
|
||||
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from mindspore import ms_function, context
|
||||
|
||||
context.set_context(mode=context.GRAPH_MODE)
|
||||
grad_all = ops.composite.GradOperation(get_all=True)
|
||||
print(grad_all(ms_function(forward))(x, w1, b1, w2, b2, w3, b3))
|
||||
|
||||
The result is as follows:
|
||||
|
||||
.. code-block::
|
||||
|
||||
(Tensor(shape=[2, 4], dtype=Float32, value=
|
||||
[[ 5.12000000e+02, 5.12000000e+02, 5.12000000e+02, 5.12000000e+02],
|
||||
[ 5.12000000e+02, 5.12000000e+02, 5.12000000e+02, 5.12000000e+02]]),
|
||||
Tensor(shape=[4, 8], dtype=Float32, value=
|
||||
[[ 2.56000000e+02, 2.56000000e+02, 2.56000000e+02 ... 2.56000000e+02, 2.56000000e+02, 2.56000000e+02],
|
||||
[ 3.84000000e+02, 3.84000000e+02, 3.84000000e+02 ... 3.84000000e+02, 3.84000000e+02, 3.84000000e+02],
|
||||
[ 5.12000000e+02, 5.12000000e+02, 5.12000000e+02 ... 5.12000000e+02, 5.12000000e+02, 5.12000000e+02]
|
||||
[ 6.40000000e+02, 6.40000000e+02, 6.40000000e+02 ... 6.40000000e+02, 6.40000000e+02, 6.40000000e+02]]),
|
||||
...
|
||||
Tensor(shape=[4], dtype=Float32, value= [ 2.00000000e+00, 2.00000000e+00, 2.00000000e+00, 2.00000000e+00]))
|
||||
|
||||
For more details, see `API GradOperation <https://www.mindspore.cn/docs/en/master/api_python/ops/mindspore.ops.GradOperation.html>`_ .
|
||||
|
||||
- Use mindspore.context to control execution mode
|
||||
|
||||
Most functions in `mindspore.numpy` can run in Graph Mode and PyNative Mode, and can run on CPU, GPU and Ascend. Like MindSpore, users can manage the execution mode using `mindspore.context`:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from mindspore import context
|
||||
|
||||
# Execucation in static graph mode
|
||||
context.set_context(mode=context.GRAPH_MODE)
|
||||
|
||||
# Execucation in PyNative mode
|
||||
context.set_context(mode=context.PYNATIVE_MODE)
|
||||
|
||||
# Execucation on CPU backend
|
||||
context.set_context(device_target="CPU")
|
||||
|
||||
# Execucation on GPU backend
|
||||
context.set_context(device_target="GPU")
|
||||
|
||||
# Execucation on Ascend backend
|
||||
context.set_context(device_target="Ascend")
|
||||
...
|
||||
|
||||
For more details, see `API mindspore.context <https://www.mindspore.cn/docs/en/master/api_python/mindspore.context.html>`_ .
|
||||
|
||||
- Use mindspore.numpy in MindSpore Deep Learning Models
|
||||
|
||||
`mindspore.numpy` interfaces can be used inside `nn.cell` blocks as well. For example, the above code can be modified to:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import mindspore.numpy as np
|
||||
from mindspore import context
|
||||
from mindspore.nn import Cell
|
||||
|
||||
context.set_context(mode=context.GRAPH_MODE)
|
||||
|
||||
x = np.arange(8).reshape(2, 4).astype('float32')
|
||||
w1 = np.ones((4, 8))
|
||||
b1 = np.zeros((8,))
|
||||
w2 = np.ones((8, 16))
|
||||
b2 = np.zeros((16,))
|
||||
w3 = np.ones((16, 4))
|
||||
b3 = np.zeros((4,))
|
||||
|
||||
class NeuralNetwork(Cell):
|
||||
def construct(self, x, w1, b1, w2, b2, w3, b3):
|
||||
x = np.dot(x, w1) + b1
|
||||
x = np.dot(x, w2) + b2
|
||||
x = np.dot(x, w3) + b3
|
||||
return x
|
||||
|
||||
net = NeuralNetwork()
|
||||
|
||||
print(net(x, w1, b1, w2, b2, w3, b3))
|
||||
|
||||
The result is as follows:
|
||||
|
||||
.. code-block::
|
||||
|
||||
[[ 768. 768. 768. 768.]
|
||||
[2816. 2816. 2816. 2816.]]
|
|
@ -0,0 +1,431 @@
|
|||
mindspore.ops.functional
|
||||
=============================
|
||||
|
||||
The functional operators are initialized Primitives and can be used directly as functions. An example of the use of the functional operator is as follows:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from mindspore import Tensor, ops
|
||||
from mindspore import dtype as mstype
|
||||
|
||||
input_x = Tensor(-1, mstype.int32)
|
||||
input_dict = {'x':1, 'y':2}
|
||||
|
||||
result_abs = ops.absolute(input_x)
|
||||
print(result_abs)
|
||||
|
||||
result_in_dict = ops.in_dict('x', input_dict)
|
||||
print(result_in_dict)
|
||||
|
||||
result_not_in_dict = ops.not_in_dict('x', input_dict)
|
||||
print(result_not_in_dict)
|
||||
|
||||
result_isconstant = ops.isconstant(input_x)
|
||||
print(result_isconstant)
|
||||
|
||||
result_typeof = ops.typeof(input_x)
|
||||
print(result_typeof)
|
||||
|
||||
# outputs:
|
||||
# 1
|
||||
# True
|
||||
# False
|
||||
# True
|
||||
# Tensor[Int32]
|
||||
|
||||
Neural Network Layer Operators
|
||||
------------------------------
|
||||
|
||||
Activation Functions
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.tanh
|
||||
|
||||
Mathematical Operators
|
||||
----------------------
|
||||
|
||||
Element-by-Element Operations
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.abs
|
||||
mindspore.ops.acos
|
||||
mindspore.ops.acosh
|
||||
mindspore.ops.add
|
||||
mindspore.ops.addn
|
||||
mindspore.ops.asin
|
||||
mindspore.ops.asinh
|
||||
mindspore.ops.atan
|
||||
mindspore.ops.atan2
|
||||
mindspore.ops.atanh
|
||||
mindspore.ops.bitwise_and
|
||||
mindspore.ops.bitwise_or
|
||||
mindspore.ops.bitwise_xor
|
||||
mindspore.ops.cos
|
||||
mindspore.ops.cosh
|
||||
mindspore.ops.div
|
||||
mindspore.ops.erf
|
||||
mindspore.ops.erfc
|
||||
mindspore.ops.exp
|
||||
mindspore.ops.expm1
|
||||
mindspore.ops.floor
|
||||
mindspore.ops.floor_div
|
||||
mindspore.ops.floor_mod
|
||||
mindspore.ops.invert
|
||||
mindspore.ops.log
|
||||
mindspore.ops.logical_and
|
||||
mindspore.ops.logical_not
|
||||
mindspore.ops.logical_or
|
||||
mindspore.ops.mul
|
||||
mindspore.ops.neg
|
||||
mindspore.ops.pow
|
||||
mindspore.ops.sin
|
||||
mindspore.ops.sinh
|
||||
mindspore.ops.sub
|
||||
mindspore.ops.tan
|
||||
|
||||
.. list-table::
|
||||
:widths: 50 50
|
||||
:header-rows: 1
|
||||
|
||||
* - functional
|
||||
- Description
|
||||
* - mindspore.ops.absolute
|
||||
- `absolute` will be deprecated in the future. Please use `mindspore.ops.abs` instead.
|
||||
* - mindspore.ops.floordiv
|
||||
- `floordiv` will be deprecated in the future. Please use `mindspore.ops.floor_div` instead.
|
||||
* - mindspore.ops.floormod
|
||||
- `floormod` will be deprecated in the future. Please use `mindspore.ops.floor_mod` instead.
|
||||
* - mindspore.ops.neg_tensor
|
||||
- `neg_tensor` will be deprecated in the future. Please use `mindspore.ops.neg` instead.
|
||||
* - mindspore.ops.pows
|
||||
- `pows` will be deprecated in the future. Please use `mindspore.ops.pow` instead.
|
||||
* - mindspore.ops.sqrt
|
||||
- Refer to :class:`mindspore.ops.Sqrt`.
|
||||
* - mindspore.ops.square
|
||||
- Refer to :class:`mindspore.ops.Square`.
|
||||
* - mindspore.ops.tensor_add
|
||||
- `tensor_add` will be deprecated in the future. Please use `mindspore.ops.add` instead.
|
||||
* - mindspore.ops.tensor_div
|
||||
- `tensor_div` will be deprecated in the future. Please use `mindspore.ops.div` instead.
|
||||
* - mindspore.ops.tensor_exp
|
||||
- `tensor_exp` will be deprecated in the future. Please use `mindspore.ops.exp` instead.
|
||||
* - mindspore.ops.tensor_expm1
|
||||
- `tensor_expm1` will be deprecated in the future. Please use `mindspore.ops.expm1` instead.
|
||||
* - mindspore.ops.tensor_floordiv
|
||||
- `tensor_floordiv` will be deprecated in the future. Please use `mindspore.ops.floor_div` instead.
|
||||
* - mindspore.ops.tensor_mod
|
||||
- `tensor_mod` will be deprecated in the future. Please use `mindspore.ops.floor_mod` instead.
|
||||
* - mindspore.ops.tensor_mul
|
||||
- `tensor_mul` will be deprecated in the future. Please use `mindspore.ops.mul` instead.
|
||||
* - mindspore.ops.tensor_pow
|
||||
- `tensor_pow` will be deprecated in the future. Please use `mindspore.ops.pow` instead.
|
||||
* - mindspore.ops.tensor_sub
|
||||
- `tensor_sub` will be deprecated in the future. Please use `mindspore.ops.sub` instead.
|
||||
|
||||
Reduction Operators
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. list-table::
|
||||
:widths: 50 50
|
||||
:header-rows: 1
|
||||
|
||||
* - functional
|
||||
- Description
|
||||
* - mindspore.ops.reduce_max
|
||||
- Refer to :class:`mindspore.ops.ReduceMax`.
|
||||
* - mindspore.ops.reduce_mean
|
||||
- Refer to :class:`mindspore.ops.ReduceMean`.
|
||||
* - mindspore.ops.reduce_min
|
||||
- Refer to :class:`mindspore.ops.ReduceMin`.
|
||||
* - mindspore.ops.reduce_prod
|
||||
- Refer to :class:`mindspore.ops.ReduceProd`.
|
||||
* - mindspore.ops.reduce_sum
|
||||
- Refer to :class:`mindspore.ops.ReduceSum`.
|
||||
|
||||
Comparison operators
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.equal
|
||||
mindspore.ops.ge
|
||||
mindspore.ops.gt
|
||||
mindspore.ops.isfinite
|
||||
mindspore.ops.isnan
|
||||
mindspore.ops.le
|
||||
mindspore.ops.less
|
||||
mindspore.ops.maximum
|
||||
mindspore.ops.minimum
|
||||
mindspore.ops.same_type_shape
|
||||
|
||||
.. list-table::
|
||||
:widths: 50 50
|
||||
:header-rows: 1
|
||||
|
||||
* - functional
|
||||
- Description
|
||||
* - mindspore.ops.check_bprop
|
||||
- Refer to :class:`mindspore.ops.CheckBprop`.
|
||||
* - mindspore.ops.isinstance\_
|
||||
- Refer to :class:`mindspore.ops.IsInstance`.
|
||||
* - mindspore.ops.issubclass\_
|
||||
- Refer to :class:`mindspore.ops.IsSubClass`.
|
||||
* - mindspore.ops.not_equal
|
||||
- `not_equal` will be deprecated in the future. Please use `mindspore.ops.ne` instead.
|
||||
* - mindspore.ops.tensor_ge
|
||||
- `tensor_ge` will be deprecated in the future. Please use `mindspore.ops.ge` instead.
|
||||
* - mindspore.ops.tensor_gt
|
||||
- `tensor_gt` will be deprecated in the future. Please use `mindspore.ops.gt` instead.
|
||||
* - mindspore.ops.tensor_le
|
||||
- `tensor_le` will be deprecated in the future. Please use `mindspore.ops.le` instead.
|
||||
* - mindspore.ops.tensor_lt
|
||||
- `tensor_lt` will be deprecated in the future. Please use `mindspore.ops.less` instead.
|
||||
|
||||
Linear Algebraic Operators
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.matmul
|
||||
|
||||
Tensor Operation Operators
|
||||
--------------------------
|
||||
|
||||
Tensor Building
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.eye
|
||||
mindspore.ops.fill
|
||||
mindspore.ops.ones
|
||||
mindspore.ops.ones_like
|
||||
mindspore.ops.zeros_like
|
||||
|
||||
Randomly Generating Operators
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.gamma
|
||||
mindspore.ops.multinomial
|
||||
mindspore.ops.poisson
|
||||
|
||||
Array Operation
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.expand_dims
|
||||
mindspore.ops.gather
|
||||
mindspore.ops.gather_d
|
||||
mindspore.ops.gather_nd
|
||||
mindspore.ops.rank
|
||||
mindspore.ops.reshape
|
||||
mindspore.ops.scatter_nd
|
||||
mindspore.ops.select
|
||||
mindspore.ops.shape
|
||||
mindspore.ops.size
|
||||
mindspore.ops.tile
|
||||
mindspore.ops.transpose
|
||||
mindspore.ops.unique
|
||||
|
||||
.. list-table::
|
||||
:widths: 50 50
|
||||
:header-rows: 1
|
||||
|
||||
* - functional
|
||||
- Description
|
||||
* - mindspore.ops.cast
|
||||
- Refer to :class:`mindspore.ops.Cast`.
|
||||
* - mindspore.ops.cumprod
|
||||
- Refer to :class:`mindspore.ops.CumProd`.
|
||||
* - mindspore.ops.cumsum
|
||||
- Refer to :class:`mindspore.ops.CumSum`.
|
||||
* - mindspore.ops.dtype
|
||||
- Refer to :class:`mindspore.ops.DType`.
|
||||
* - mindspore.ops.sort
|
||||
- Refer to :class:`mindspore.ops.Sort`.
|
||||
* - mindspore.ops.squeeze
|
||||
- Refer to :class:`mindspore.ops.Squeeze`.
|
||||
* - mindspore.ops.stack
|
||||
- Refer to :class:`mindspore.ops.Stack`.
|
||||
* - mindspore.ops.strided_slice
|
||||
- Refer to :class:`mindspore.ops.StridedSlice`.
|
||||
* - mindspore.ops.tensor_scatter_add
|
||||
- Refer to :class:`mindspore.ops.TensorScatterAdd`.
|
||||
* - mindspore.ops.tensor_scatter_update
|
||||
- Refer to :class:`mindspore.ops.TensorScatterUpdate`.
|
||||
* - mindspore.ops.tensor_slice
|
||||
- `tensor_slice` will be deprecated in the future. Please use `mindspore.ops.slice` instead.
|
||||
|
||||
Type Conversion
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.scalar_cast
|
||||
mindspore.ops.scalar_to_array
|
||||
mindspore.ops.scalar_to_tensor
|
||||
mindspore.ops.tuple_to_array
|
||||
|
||||
Parameter Operation Oprators
|
||||
----------------------------
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.assign
|
||||
mindspore.ops.assign_add
|
||||
mindspore.ops.assign_sub
|
||||
|
||||
.. list-table::
|
||||
:widths: 50 50
|
||||
:header-rows: 1
|
||||
|
||||
* - functional
|
||||
- Description
|
||||
* - mindspore.ops.scatter_nd_update
|
||||
- Refer to :class:`mindspore.ops.ScatterNdUpdate`.
|
||||
* - mindspore.ops.scatter_update
|
||||
- Refer to :class:`mindspore.ops.ScatterUpdate`.
|
||||
|
||||
Debugging Operators
|
||||
-------------------
|
||||
|
||||
.. list-table::
|
||||
:widths: 50 50
|
||||
:header-rows: 1
|
||||
|
||||
* - functional
|
||||
- Description
|
||||
* - mindspore.ops.print\_
|
||||
- Refer to :class:`mindspore.ops.Print`.
|
||||
|
||||
|
||||
Other Operators
|
||||
---------------
|
||||
.. list-table::
|
||||
:widths: 50 50
|
||||
:header-rows: 1
|
||||
|
||||
* - functional
|
||||
- Description
|
||||
* - mindspore.ops.bool_and
|
||||
- Calculate the result of logical AND operation. (Usage is the same as "and" in Python)
|
||||
* - mindspore.ops.bool_eq
|
||||
- Determine whether the Boolean values are equal. (Usage is the same as "==" in Python)
|
||||
* - mindspore.ops.bool_not
|
||||
- Calculate the result of logical NOT operation. (Usage is the same as "not" in Python)
|
||||
* - mindspore.ops.bool_or
|
||||
- Calculate the result of logical OR operation. (Usage is the same as "or" in Python)
|
||||
* - mindspore.ops.depend
|
||||
- Refer to :class:`mindspore.ops.Depend`.
|
||||
* - mindspore.ops.in_dict
|
||||
- Determine if a str in dict.
|
||||
* - mindspore.ops.is_not
|
||||
- Determine whether the input is not the same as the other one. (Usage is the same as "is not" in Python)
|
||||
* - mindspore.ops.is\_
|
||||
- Determine whether the input is the same as the other one. (Usage is the same as "is" in Python)
|
||||
* - mindspore.ops.isconstant
|
||||
- Determine whether the object is constant.
|
||||
* - mindspore.ops.not_in_dict
|
||||
- Determine whether the object is not in the dict.
|
||||
* - mindspore.ops.partial
|
||||
- Refer to :class:`mindspore.ops.Partial`.
|
||||
* - mindspore.ops.scalar_add
|
||||
- Get the sum of two numbers. (Usage is the same as "+" in Python)
|
||||
* - mindspore.ops.scalar_div
|
||||
- Get the quotient of dividing the first input number by the second input number. (Usage is the same as "/" in Python)
|
||||
* - mindspore.ops.scalar_eq
|
||||
- Determine whether two numbers are equal. (Usage is the same as "==" in Python)
|
||||
* - mindspore.ops.scalar_floordiv
|
||||
- Divide the first input number by the second input number and round down to the closest integer. (Usage is the same as "//" in Python)
|
||||
* - mindspore.ops.scalar_ge
|
||||
- Determine whether the number is greater than or equal to another number. (Usage is the same as ">=" in Python)
|
||||
* - mindspore.ops.scalar_gt
|
||||
- Determine whether the number is greater than another number. (Usage is the same as ">" in Python)
|
||||
* - mindspore.ops.scalar_le
|
||||
- Determine whether the number is less than or equal to another number. (Usage is the same as "<=" in Python)
|
||||
* - mindspore.ops.scalar_log
|
||||
- Get the natural logarithm of the input number.
|
||||
* - mindspore.ops.scalar_lt
|
||||
- Determine whether the number is less than another number. (Usage is the same as "<" in Python)
|
||||
* - mindspore.ops.scalar_mod
|
||||
- Get the remainder of dividing the first input number by the second input number. (Usage is the same as "%" in Python)
|
||||
* - mindspore.ops.scalar_mul
|
||||
- Get the product of the input two numbers. (Usage is the same as "*" in Python)
|
||||
* - mindspore.ops.scalar_ne
|
||||
- Determine whether two numbers are not equal. (Usage is the same as "!=" in Python)
|
||||
* - mindspore.ops.scalar_pow
|
||||
- Compute a number to the power of the second input number.
|
||||
* - mindspore.ops.scalar_sub
|
||||
- Subtract the second input number from the first input number. (Usage is the same as "-" in Python)
|
||||
* - mindspore.ops.scalar_uadd
|
||||
- Get the positive value of the input number.
|
||||
* - mindspore.ops.scalar_usub
|
||||
- Get the negative value of the input number.
|
||||
* - mindspore.ops.shape_mul
|
||||
- The input of shape_mul must be shape multiply elements in tuple(shape).
|
||||
* - mindspore.ops.stop_gradient
|
||||
- Disable update during back propagation. (`stop_gradient <https://www.mindspore.cn/tutorials/en/master/beginner/autograd.html#stopping-gradient>`_)
|
||||
* - mindspore.ops.string_concat
|
||||
- Concatenate two strings.
|
||||
* - mindspore.ops.string_eq
|
||||
- Determine if two strings are equal.
|
||||
* - mindspore.ops.typeof
|
||||
- Get type of object.
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.arange
|
||||
mindspore.ops.batch_dot
|
||||
mindspore.ops.clip_by_global_norm
|
||||
mindspore.ops.clip_by_value
|
||||
mindspore.ops.core
|
||||
mindspore.ops.count_nonzero
|
||||
mindspore.ops.cummin
|
||||
mindspore.ops.dot
|
||||
mindspore.ops.grad
|
||||
mindspore.ops.jvp
|
||||
mindspore.ops.laplace
|
||||
mindspore.ops.narrow
|
||||
mindspore.ops.normal
|
||||
mindspore.ops.repeat_elements
|
||||
mindspore.ops.sequence_mask
|
||||
mindspore.ops.tensor_dot
|
||||
mindspore.ops.uniform
|
||||
mindspore.ops.vjp
|
|
@ -0,0 +1,609 @@
|
|||
mindspore.ops
|
||||
=============
|
||||
|
||||
operators that can be used for constructor function of Cell
|
||||
|
||||
.. code-block::
|
||||
|
||||
import mindspore.ops as ops
|
||||
|
||||
Compared with the previous version, the added, deleted and supported platforms change information of `mindspore.ops` operators in MindSpore, please refer to the link `<https://gitee.com/mindspore/docs/blob/master/resource/api_updates/ops_api_updates.md>`_.
|
||||
|
||||
Operator Primitives
|
||||
-------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.Primitive
|
||||
mindspore.ops.PrimitiveWithCheck
|
||||
mindspore.ops.PrimitiveWithInfer
|
||||
|
||||
Decorators
|
||||
----------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.constexpr
|
||||
mindspore.ops.custom_info_register
|
||||
mindspore.ops.ms_hybrid
|
||||
mindspore.ops.op_info_register
|
||||
mindspore.ops.prim_attr_register
|
||||
|
||||
Neural Network Layer Operators
|
||||
------------------------------
|
||||
|
||||
Neural Network
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.AvgPool
|
||||
mindspore.ops.AvgPool3D
|
||||
mindspore.ops.BasicLSTMCell
|
||||
mindspore.ops.BatchNorm
|
||||
mindspore.ops.Conv2D
|
||||
mindspore.ops.Conv2DBackpropInput
|
||||
mindspore.ops.Conv2DTranspose
|
||||
mindspore.ops.Conv3D
|
||||
mindspore.ops.Conv3DTranspose
|
||||
mindspore.ops.CTCGreedyDecoder
|
||||
mindspore.ops.DepthwiseConv2dNative
|
||||
mindspore.ops.Dropout
|
||||
mindspore.ops.Dropout2D
|
||||
mindspore.ops.Dropout3D
|
||||
mindspore.ops.DropoutDoMask
|
||||
mindspore.ops.DropoutGenMask
|
||||
mindspore.ops.DynamicGRUV2
|
||||
mindspore.ops.DynamicRNN
|
||||
mindspore.ops.Flatten
|
||||
mindspore.ops.LayerNorm
|
||||
mindspore.ops.LRN
|
||||
mindspore.ops.LSTM
|
||||
mindspore.ops.MaxPool
|
||||
mindspore.ops.MaxPool3D
|
||||
mindspore.ops.MaxPoolWithArgmax
|
||||
mindspore.ops.MirrorPad
|
||||
mindspore.ops.Pad
|
||||
mindspore.ops.EmbeddingLookup
|
||||
mindspore.ops.Padding
|
||||
mindspore.ops.ResizeNearestNeighbor
|
||||
mindspore.ops.ResizeBilinear
|
||||
|
||||
Loss Function
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.BCEWithLogitsLoss
|
||||
mindspore.ops.BinaryCrossEntropy
|
||||
mindspore.ops.CTCLoss
|
||||
mindspore.ops.KLDivLoss
|
||||
mindspore.ops.L2Loss
|
||||
mindspore.ops.NLLLoss
|
||||
mindspore.ops.RNNTLoss
|
||||
mindspore.ops.SigmoidCrossEntropyWithLogits
|
||||
mindspore.ops.SmoothL1Loss
|
||||
mindspore.ops.SoftMarginLoss
|
||||
mindspore.ops.SoftmaxCrossEntropyWithLogits
|
||||
mindspore.ops.SparseSoftmaxCrossEntropyWithLogits
|
||||
|
||||
Activation Function
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.Elu
|
||||
mindspore.ops.FastGeLU
|
||||
mindspore.ops.GeLU
|
||||
mindspore.ops.HShrink
|
||||
mindspore.ops.HSigmoid
|
||||
mindspore.ops.HSwish
|
||||
mindspore.ops.LogSoftmax
|
||||
mindspore.ops.Mish
|
||||
mindspore.ops.PReLU
|
||||
mindspore.ops.ReLU
|
||||
mindspore.ops.ReLU6
|
||||
mindspore.ops.ReLUV2
|
||||
mindspore.ops.SeLU
|
||||
mindspore.ops.Sigmoid
|
||||
mindspore.ops.Softmax
|
||||
mindspore.ops.Softplus
|
||||
mindspore.ops.SoftShrink
|
||||
mindspore.ops.Softsign
|
||||
mindspore.ops.Tanh
|
||||
|
||||
Optimizer
|
||||
^^^^^^^^^
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.Adam
|
||||
mindspore.ops.AdamNoUpdateParam
|
||||
mindspore.ops.AdamWeightDecay
|
||||
mindspore.ops.AdaptiveAvgPool2D
|
||||
mindspore.ops.ApplyAdadelta
|
||||
mindspore.ops.ApplyAdagrad
|
||||
mindspore.ops.ApplyAdagradDA
|
||||
mindspore.ops.ApplyAdagradV2
|
||||
mindspore.ops.ApplyAdaMax
|
||||
mindspore.ops.ApplyAddSign
|
||||
mindspore.ops.ApplyCenteredRMSProp
|
||||
mindspore.ops.ApplyFtrl
|
||||
mindspore.ops.ApplyGradientDescent
|
||||
mindspore.ops.ApplyMomentum
|
||||
mindspore.ops.ApplyPowerSign
|
||||
mindspore.ops.ApplyProximalAdagrad
|
||||
mindspore.ops.ApplyProximalGradientDescent
|
||||
mindspore.ops.ApplyRMSProp
|
||||
mindspore.ops.FusedSparseAdam
|
||||
mindspore.ops.FusedSparseFtrl
|
||||
mindspore.ops.FusedSparseLazyAdam
|
||||
mindspore.ops.FusedSparseProximalAdagrad
|
||||
mindspore.ops.LARSUpdate
|
||||
mindspore.ops.SparseApplyAdagrad
|
||||
mindspore.ops.SparseApplyAdagradV2
|
||||
mindspore.ops.SparseApplyProximalAdagrad
|
||||
mindspore.ops.SGD
|
||||
mindspore.ops.SparseApplyFtrl
|
||||
mindspore.ops.SparseApplyFtrlV2
|
||||
|
||||
Distance Function
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.Cdist
|
||||
mindspore.ops.EditDistance
|
||||
mindspore.ops.LpNorm
|
||||
|
||||
Sampling Operator
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.ComputeAccidentalHits
|
||||
mindspore.ops.LogUniformCandidateSampler
|
||||
mindspore.ops.UniformCandidateSampler
|
||||
|
||||
Image Processing
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.BoundingBoxDecode
|
||||
mindspore.ops.BoundingBoxEncode
|
||||
mindspore.ops.CheckValid
|
||||
mindspore.ops.CropAndResize
|
||||
mindspore.ops.ExtractVolumePatches
|
||||
mindspore.ops.IOU
|
||||
mindspore.ops.L2Normalize
|
||||
mindspore.ops.NMSWithMask
|
||||
mindspore.ops.ROIAlign
|
||||
|
||||
Text Processing
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.NoRepeatNGram
|
||||
|
||||
Mathematical Operators
|
||||
----------------------
|
||||
|
||||
Element-by-Element Operation
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.Abs
|
||||
mindspore.ops.AccumulateNV2
|
||||
mindspore.ops.ACos
|
||||
mindspore.ops.Acosh
|
||||
mindspore.ops.Add
|
||||
mindspore.ops.Addcdiv
|
||||
mindspore.ops.Addcmul
|
||||
mindspore.ops.AddN
|
||||
mindspore.ops.Asin
|
||||
mindspore.ops.Asinh
|
||||
mindspore.ops.Atan
|
||||
mindspore.ops.Atan2
|
||||
mindspore.ops.Atanh
|
||||
mindspore.ops.BesselI0e
|
||||
mindspore.ops.BesselI1e
|
||||
mindspore.ops.BitwiseAnd
|
||||
mindspore.ops.BitwiseOr
|
||||
mindspore.ops.BitwiseXor
|
||||
mindspore.ops.Ceil
|
||||
mindspore.ops.Conj
|
||||
mindspore.ops.Cos
|
||||
mindspore.ops.Cosh
|
||||
mindspore.ops.Div
|
||||
mindspore.ops.DivNoNan
|
||||
mindspore.ops.Einsum
|
||||
mindspore.ops.Erf
|
||||
mindspore.ops.Erfc
|
||||
mindspore.ops.Erfinv
|
||||
mindspore.ops.Exp
|
||||
mindspore.ops.Expm1
|
||||
mindspore.ops.Floor
|
||||
mindspore.ops.FloorDiv
|
||||
mindspore.ops.FloorMod
|
||||
mindspore.ops.Imag
|
||||
mindspore.ops.Inv
|
||||
mindspore.ops.Invert
|
||||
mindspore.ops.Lerp
|
||||
mindspore.ops.Log
|
||||
mindspore.ops.Log1p
|
||||
mindspore.ops.LogicalAnd
|
||||
mindspore.ops.LogicalNot
|
||||
mindspore.ops.LogicalOr
|
||||
mindspore.ops.Mod
|
||||
mindspore.ops.Mul
|
||||
mindspore.ops.MulNoNan
|
||||
mindspore.ops.Neg
|
||||
mindspore.ops.Pow
|
||||
mindspore.ops.Real
|
||||
mindspore.ops.RealDiv
|
||||
mindspore.ops.Reciprocal
|
||||
mindspore.ops.Rint
|
||||
mindspore.ops.Round
|
||||
mindspore.ops.Rsqrt
|
||||
mindspore.ops.Sign
|
||||
mindspore.ops.Sin
|
||||
mindspore.ops.Sinh
|
||||
mindspore.ops.Sqrt
|
||||
mindspore.ops.Square
|
||||
mindspore.ops.SquaredDifference
|
||||
mindspore.ops.SquareSumAll
|
||||
mindspore.ops.Sub
|
||||
mindspore.ops.Tan
|
||||
mindspore.ops.TruncateDiv
|
||||
mindspore.ops.TruncateMod
|
||||
mindspore.ops.Xdivy
|
||||
mindspore.ops.Xlogy
|
||||
|
||||
|
||||
Reduction Operator
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.Argmax
|
||||
mindspore.ops.ArgMaxWithValue
|
||||
mindspore.ops.Argmin
|
||||
mindspore.ops.ArgMinWithValue
|
||||
mindspore.ops.ReduceAll
|
||||
mindspore.ops.ReduceAny
|
||||
mindspore.ops.ReduceMax
|
||||
mindspore.ops.ReduceMean
|
||||
mindspore.ops.ReduceMin
|
||||
mindspore.ops.ReduceProd
|
||||
mindspore.ops.ReduceSum
|
||||
|
||||
Comparison Operator
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.ApproximateEqual
|
||||
mindspore.ops.CheckBprop
|
||||
mindspore.ops.Equal
|
||||
mindspore.ops.EqualCount
|
||||
mindspore.ops.Greater
|
||||
mindspore.ops.GreaterEqual
|
||||
mindspore.ops.InTopK
|
||||
mindspore.ops.IsFinite
|
||||
mindspore.ops.IsInf
|
||||
mindspore.ops.IsInstance
|
||||
mindspore.ops.IsNan
|
||||
mindspore.ops.IsSubClass
|
||||
mindspore.ops.Less
|
||||
mindspore.ops.LessEqual
|
||||
mindspore.ops.Maximum
|
||||
mindspore.ops.Minimum
|
||||
mindspore.ops.NotEqual
|
||||
mindspore.ops.SameTypeShape
|
||||
mindspore.ops.TopK
|
||||
|
||||
Linear Algebraic Operator
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.BatchMatMul
|
||||
mindspore.ops.BiasAdd
|
||||
mindspore.ops.Ger
|
||||
mindspore.ops.MatMul
|
||||
mindspore.ops.MatrixInverse
|
||||
|
||||
Tensor Operation Opertor
|
||||
------------------------
|
||||
|
||||
Tensor Construction
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.Eps
|
||||
mindspore.ops.Eye
|
||||
mindspore.ops.Fill
|
||||
mindspore.ops.LinSpace
|
||||
mindspore.ops.OneHot
|
||||
mindspore.ops.Ones
|
||||
mindspore.ops.OnesLike
|
||||
mindspore.ops.Zeros
|
||||
mindspore.ops.ZerosLike
|
||||
|
||||
Random Generation Operator
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.Gamma
|
||||
mindspore.ops.Multinomial
|
||||
mindspore.ops.Poisson
|
||||
mindspore.ops.RandomCategorical
|
||||
mindspore.ops.RandomChoiceWithMask
|
||||
mindspore.ops.Randperm
|
||||
mindspore.ops.StandardLaplace
|
||||
mindspore.ops.StandardNormal
|
||||
mindspore.ops.UniformInt
|
||||
mindspore.ops.UniformReal
|
||||
|
||||
Array Operation
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.BatchToSpace
|
||||
mindspore.ops.BatchToSpaceND
|
||||
mindspore.ops.BroadcastTo
|
||||
mindspore.ops.Cast
|
||||
mindspore.ops.Concat
|
||||
mindspore.ops.CumProd
|
||||
mindspore.ops.CumSum
|
||||
mindspore.ops.DataFormatDimMap
|
||||
mindspore.ops.DepthToSpace
|
||||
mindspore.ops.DType
|
||||
mindspore.ops.DynamicShape
|
||||
mindspore.ops.ExpandDims
|
||||
mindspore.ops.FloatStatus
|
||||
mindspore.ops.Gather
|
||||
mindspore.ops.GatherD
|
||||
mindspore.ops.GatherNd
|
||||
mindspore.ops.HistogramFixedWidth
|
||||
mindspore.ops.Identity
|
||||
mindspore.ops.IndexAdd
|
||||
mindspore.ops.InplaceAdd
|
||||
mindspore.ops.InplaceSub
|
||||
mindspore.ops.InplaceUpdate
|
||||
mindspore.ops.InvertPermutation
|
||||
mindspore.ops.MaskedFill
|
||||
mindspore.ops.MaskedSelect
|
||||
mindspore.ops.Meshgrid
|
||||
mindspore.ops.ParallelConcat
|
||||
mindspore.ops.PopulationCount
|
||||
mindspore.ops.Rank
|
||||
mindspore.ops.Reshape
|
||||
mindspore.ops.ReverseSequence
|
||||
mindspore.ops.ReverseV2
|
||||
mindspore.ops.ScatterNd
|
||||
mindspore.ops.Select
|
||||
mindspore.ops.Shape
|
||||
mindspore.ops.Size
|
||||
mindspore.ops.Slice
|
||||
mindspore.ops.Sort
|
||||
mindspore.ops.SpaceToBatch
|
||||
mindspore.ops.SpaceToBatchND
|
||||
mindspore.ops.SpaceToDepth
|
||||
mindspore.ops.SparseGatherV2
|
||||
mindspore.ops.Split
|
||||
mindspore.ops.SplitV
|
||||
mindspore.ops.Squeeze
|
||||
mindspore.ops.Stack
|
||||
mindspore.ops.StridedSlice
|
||||
mindspore.ops.TensorScatterAdd
|
||||
mindspore.ops.TensorScatterMax
|
||||
mindspore.ops.TensorScatterMin
|
||||
mindspore.ops.TensorScatterSub
|
||||
mindspore.ops.TensorScatterUpdate
|
||||
mindspore.ops.TensorShape
|
||||
mindspore.ops.Tile
|
||||
mindspore.ops.Transpose
|
||||
mindspore.ops.Unique
|
||||
mindspore.ops.UniqueWithPad
|
||||
mindspore.ops.UnsortedSegmentMax
|
||||
mindspore.ops.UnsortedSegmentMin
|
||||
mindspore.ops.UnsortedSegmentProd
|
||||
mindspore.ops.UnsortedSegmentSum
|
||||
mindspore.ops.Unstack
|
||||
|
||||
Type Conversion
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.ScalarCast
|
||||
mindspore.ops.ScalarToArray
|
||||
mindspore.ops.ScalarToTensor
|
||||
mindspore.ops.TupleToArray
|
||||
|
||||
Parameter Operation Operator
|
||||
----------------------------
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.Assign
|
||||
mindspore.ops.AssignAdd
|
||||
mindspore.ops.AssignSub
|
||||
mindspore.ops.ScatterAdd
|
||||
mindspore.ops.ScatterDiv
|
||||
mindspore.ops.ScatterMax
|
||||
mindspore.ops.ScatterMin
|
||||
mindspore.ops.ScatterMul
|
||||
mindspore.ops.ScatterNdAdd
|
||||
mindspore.ops.ScatterNdSub
|
||||
mindspore.ops.ScatterNdUpdate
|
||||
mindspore.ops.ScatterNonAliasingAdd
|
||||
mindspore.ops.ScatterSub
|
||||
mindspore.ops.ScatterUpdate
|
||||
|
||||
Data Operation Operator
|
||||
-----------------------
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.GetNext
|
||||
|
||||
Communication Operator
|
||||
----------------------
|
||||
|
||||
Note that the APIs in the following list need to preset communication environment variables. For
|
||||
the Ascend devices, users need to prepare the rank table, set rank_id and device_id. Please see the `Ascend tutorial \
|
||||
<https://www.mindspore.cn/tutorials/experts/en/master/parallel/train_ascend.html#configuring-distributed-environment-variables>`_ for more details.
|
||||
For the GPU device, users need to prepare the host file and mpi, please see the `GPU tutorial \
|
||||
<https://www.mindspore.cn/tutorials/experts/en/master/parallel/train_gpu.html#preparation>`_.
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.AllGather
|
||||
mindspore.ops.AllReduce
|
||||
mindspore.ops.AlltoAll
|
||||
mindspore.ops.Broadcast
|
||||
mindspore.ops.NeighborExchange
|
||||
mindspore.ops.NeighborExchangeV2
|
||||
mindspore.ops.ReduceOp
|
||||
mindspore.ops.ReduceScatter
|
||||
|
||||
Debugging Operator
|
||||
------------------
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.HistogramSummary
|
||||
mindspore.ops.ImageSummary
|
||||
mindspore.ops.ScalarSummary
|
||||
mindspore.ops.TensorSummary
|
||||
mindspore.ops.Print
|
||||
mindspore.ops.NPUAllocFloatStatus
|
||||
mindspore.ops.NPUClearFloatStatus
|
||||
mindspore.ops.NPUGetFloatStatus
|
||||
|
||||
Sparse Operator
|
||||
---------------
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.SparseTensorDenseMatmul
|
||||
mindspore.ops.SparseToDense
|
||||
|
||||
Other Operators
|
||||
---------------
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.Depend
|
||||
mindspore.ops.GradOperation
|
||||
mindspore.ops.HookBackward
|
||||
mindspore.ops.HyperMap
|
||||
mindspore.ops.InsertGradientOf
|
||||
mindspore.ops.Map
|
||||
mindspore.ops.MultitypeFuncGraph
|
||||
mindspore.ops.Partial
|
||||
|
||||
Operator Information Registration
|
||||
---------------------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.AiCPURegOp
|
||||
mindspore.ops.CustomRegOp
|
||||
mindspore.ops.DataType
|
||||
mindspore.ops.TBERegOp
|
||||
mindspore.ops.get_vm_impl_fn
|
||||
|
||||
Customizing Operator
|
||||
--------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: ops
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ops.Custom
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
mindspore.parallel.nn
|
||||
======================
|
||||
|
||||
The import path of Transformer APIs have been modified from `mindspore.parallel.nn` to `mindspore.nn.transformer`, while the usage of these APIs stay unchanged. The original import path will retain one or two versions. You can view the changes using the examples described below
|
||||
|
||||
::
|
||||
|
||||
# r1.5
|
||||
from mindspore.parallel.nn import Transformer
|
||||
|
||||
# Current
|
||||
from mindspore.nn.transformer import Transformer
|
|
@ -0,0 +1,5 @@
|
|||
mindspore.parallel
|
||||
==================
|
||||
|
||||
.. automodule:: mindspore.parallel
|
||||
:members:
|
|
@ -0,0 +1,5 @@
|
|||
mindspore.profiler
|
||||
==================
|
||||
|
||||
.. automodule:: mindspore.profiler
|
||||
:members:
|
|
@ -0,0 +1,270 @@
|
|||
mindspore
|
||||
=========
|
||||
|
||||
Tensor
|
||||
------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: mindspore
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.Tensor
|
||||
mindspore.COOTensor
|
||||
mindspore.CSRTensor
|
||||
mindspore.RowTensor
|
||||
mindspore.SparseTensor
|
||||
|
||||
Parameter
|
||||
---------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: mindspore
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.Parameter
|
||||
mindspore.ParameterTuple
|
||||
|
||||
DataType
|
||||
--------
|
||||
|
||||
.. class:: mindspore.dtype
|
||||
|
||||
Create a data type object of MindSpore.
|
||||
|
||||
The actual path of ``dtype`` is ``/mindspore/common/dtype.py``.
|
||||
Run the following command to import the package:
|
||||
|
||||
.. code-block::
|
||||
|
||||
from mindspore import dtype as mstype
|
||||
|
||||
* **Numeric Type**
|
||||
|
||||
Currently, MindSpore supports ``Int`` type, ``Uint`` type, ``Float`` type and ``Complex`` type.
|
||||
The following table lists the details.
|
||||
|
||||
============================================== =============================
|
||||
Definition Description
|
||||
============================================== =============================
|
||||
``mindspore.int8`` , ``mindspore.byte`` 8-bit integer
|
||||
``mindspore.int16`` , ``mindspore.short`` 16-bit integer
|
||||
``mindspore.int32`` , ``mindspore.intc`` 32-bit integer
|
||||
``mindspore.int64`` , ``mindspore.intp`` 64-bit integer
|
||||
``mindspore.uint8`` , ``mindspore.ubyte`` unsigned 8-bit integer
|
||||
``mindspore.uint16`` , ``mindspore.ushort`` unsigned 16-bit integer
|
||||
``mindspore.uint32`` , ``mindspore.uintc`` unsigned 32-bit integer
|
||||
``mindspore.uint64`` , ``mindspore.uintp`` unsigned 64-bit integer
|
||||
``mindspore.float16`` , ``mindspore.half`` 16-bit floating-point number
|
||||
``mindspore.float32`` , ``mindspore.single`` 32-bit floating-point number
|
||||
``mindspore.float64`` , ``mindspore.double`` 64-bit floating-point number
|
||||
``mindspore.complex64`` 64-bit complex number
|
||||
``mindspore.complex128`` 128-bit complex number
|
||||
============================================== =============================
|
||||
|
||||
* **Other Type**
|
||||
|
||||
For other defined types, see the following table.
|
||||
|
||||
============================ =================
|
||||
Type Description
|
||||
============================ =================
|
||||
``tensor`` MindSpore's ``tensor`` type. Data format uses NCHW. For details, see `tensor <https://www.gitee.com/mindspore/mindspore/blob/master/mindspore/python/mindspore/common/tensor.py>`_.
|
||||
``bool_`` Boolean ``True`` or ``False``.
|
||||
``int_`` Integer scalar.
|
||||
``uint`` Unsigned integer scalar.
|
||||
``float_`` Floating-point scalar.
|
||||
``complex`` Complex scalar.
|
||||
``number`` Number, including ``int_`` , ``uint`` , ``float_`` , ``complex`` and ``bool_`` .
|
||||
``list_`` List constructed by ``tensor`` , such as ``List[T0,T1,...,Tn]`` , where the element ``Ti`` can be of different types.
|
||||
``tuple_`` Tuple constructed by ``tensor`` , such as ``Tuple[T0,T1,...,Tn]`` , where the element ``Ti`` can be of different types.
|
||||
``function`` Function. Return in two ways, when function is not None, returns Func directly, the other returns Func(args: List[T0,T1,...,Tn], retval: T) when function is None.
|
||||
``type_type`` Type definition of type.
|
||||
``type_none`` No matching return type, corresponding to the ``type(None)`` in Python.
|
||||
``symbolic_key`` The value of a variable is used as a key of the variable in ``env_type`` .
|
||||
``env_type`` Used to store the gradient of the free variable of a function, where the key is the ``symbolic_key`` of the free variable's node and the value is the gradient.
|
||||
============================ =================
|
||||
|
||||
* **Tree Topology**
|
||||
|
||||
The relationships of the above types are as follows:
|
||||
|
||||
.. code-block::
|
||||
|
||||
|
||||
└─────── number
|
||||
│ ├─── bool_
|
||||
│ ├─── int_
|
||||
│ │ ├─── int8, byte
|
||||
│ │ ├─── int16, short
|
||||
│ │ ├─── int32, intc
|
||||
│ │ └─── int64, intp
|
||||
│ ├─── uint
|
||||
│ │ ├─── uint8, ubyte
|
||||
│ │ ├─── uint16, ushort
|
||||
│ │ ├─── uint32, uintc
|
||||
│ │ └─── uint64, uintp
|
||||
│ ├─── float_
|
||||
│ │ ├─── float16
|
||||
│ │ ├─── float32
|
||||
│ │ └─── float64
|
||||
│ └─── complex
|
||||
│ ├─── complex64
|
||||
│ └─── complex128
|
||||
├─── tensor
|
||||
│ ├─── Array[Float32]
|
||||
│ └─── ...
|
||||
├─── list_
|
||||
│ ├─── List[Int32,Float32]
|
||||
│ └─── ...
|
||||
├─── tuple_
|
||||
│ ├─── Tuple[Int32,Float32]
|
||||
│ └─── ...
|
||||
├─── function
|
||||
│ ├─── Func
|
||||
│ ├─── Func[(Int32, Float32), Int32]
|
||||
│ └─── ...
|
||||
├─── type_type
|
||||
├─── type_none
|
||||
├─── symbolic_key
|
||||
└─── env_type
|
||||
|
||||
|
||||
.. autosummary::
|
||||
:toctree: mindspore
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.dtype_to_nptype
|
||||
mindspore.issubclass_
|
||||
mindspore.dtype_to_pytype
|
||||
mindspore.pytype_to_dtype
|
||||
mindspore.get_py_obj_dtype
|
||||
|
||||
Seed
|
||||
----
|
||||
|
||||
.. autosummary::
|
||||
:toctree: mindspore
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.set_seed
|
||||
mindspore.get_seed
|
||||
|
||||
Model
|
||||
-----
|
||||
|
||||
.. autosummary::
|
||||
:toctree: mindspore
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.Model
|
||||
|
||||
Dataset Helper
|
||||
---------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: mindspore
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.DatasetHelper
|
||||
mindspore.connect_network_with_dataset
|
||||
|
||||
Loss Scale Manager
|
||||
-------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: mindspore
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.LossScaleManager
|
||||
mindspore.FixedLossScaleManager
|
||||
mindspore.DynamicLossScaleManager
|
||||
|
||||
Serialization
|
||||
-------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: mindspore
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.save_checkpoint
|
||||
mindspore.load_checkpoint
|
||||
mindspore.load_param_into_net
|
||||
mindspore.export
|
||||
mindspore.load
|
||||
mindspore.parse_print
|
||||
mindspore.build_searched_strategy
|
||||
mindspore.merge_sliced_parameter
|
||||
mindspore.load_distributed_checkpoint
|
||||
mindspore.async_ckpt_thread_status
|
||||
mindspore.restore_group_info_list
|
||||
|
||||
JIT
|
||||
---
|
||||
|
||||
.. autosummary::
|
||||
:toctree: mindspore
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ms_function
|
||||
mindspore.ms_class
|
||||
|
||||
Log
|
||||
---
|
||||
|
||||
.. autosummary::
|
||||
:toctree: mindspore
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.get_level
|
||||
mindspore.get_log_config
|
||||
|
||||
Automatic Mixed Precision
|
||||
-------------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: mindspore
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.build_train_network
|
||||
|
||||
Installation Verification
|
||||
--------------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: mindspore
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.run_check
|
||||
|
||||
Debugging
|
||||
--------------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: mindspore
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.set_dump
|
||||
|
||||
Memory Recycle
|
||||
--------------------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: mindspore
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
||||
mindspore.ms_memory_recycle
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
mindspore.scipy
|
||||
===============
|
||||
|
||||
.. automodule:: mindspore.scipy
|
||||
|
||||
mindspore.scipy.linalg
|
||||
----------------------
|
||||
|
||||
.. automodule:: mindspore.scipy.linalg
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: scipy
|
||||
:nosignatures:
|
||||
:template: classtemplate_inherited.rst
|
||||
|
||||
mindspore.scipy.linalg.block_diag
|
||||
mindspore.scipy.linalg.cho_factor
|
||||
mindspore.scipy.linalg.cholesky
|
||||
mindspore.scipy.linalg.cho_solve
|
||||
mindspore.scipy.linalg.eigh
|
||||
mindspore.scipy.linalg.inv
|
||||
mindspore.scipy.linalg.lu
|
||||
mindspore.scipy.linalg.lu_factor
|
||||
mindspore.scipy.linalg.solve_triangular
|
||||
|
||||
mindspore.scipy.optimize
|
||||
------------------------
|
||||
|
||||
.. automodule:: mindspore.scipy.optimize
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: scipy
|
||||
:nosignatures:
|
||||
:template: classtemplate_inherited.rst
|
||||
|
||||
mindspore.scipy.optimize.line_search
|
||||
mindspore.scipy.optimize.minimize
|
||||
|
||||
mindspore.scipy.sparse.linalg
|
||||
-----------------------------
|
||||
|
||||
.. automodule:: mindspore.scipy.sparse.linalg
|
||||
|
||||
.. msplatformautosummary::
|
||||
:toctree: scipy
|
||||
:nosignatures:
|
||||
:template: classtemplate_inherited.rst
|
||||
|
||||
mindspore.scipy.sparse.linalg.cg
|
||||
mindspore.scipy.sparse.linalg.gmres
|
|
@ -0,0 +1,21 @@
|
|||
mindspore.train
|
||||
===============
|
||||
|
||||
mindspore.train.summary
|
||||
-----------------------
|
||||
|
||||
.. automodule:: mindspore.train.summary
|
||||
:members:
|
||||
|
||||
mindspore.train.callback
|
||||
------------------------
|
||||
|
||||
.. automodule:: mindspore.train.callback
|
||||
:exclude-members: FederatedLearningManager
|
||||
:members:
|
||||
|
||||
mindspore.train.train_thor
|
||||
--------------------------
|
||||
|
||||
.. automodule:: mindspore.train.train_thor
|
||||
:members:
|
|
@ -0,0 +1,47 @@
|
|||
.. py:method:: forward(value)
|
||||
|
||||
forward mapping, compute the value after mapping as :math:`Y = \exp(X)`.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of output after mapping.
|
||||
|
||||
.. py:method:: forward_log_jacobian(value)
|
||||
|
||||
compute the log value after mapping, namely :math:`\log(d\exp(x) / dx)`.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of forward mapping.
|
||||
|
||||
.. py:method:: inverse(value)
|
||||
|
||||
Inverse mapping, compute the value after inverse mapping as :math:`X = \log(Y)`.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value of output after mapping.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value to compute.
|
||||
|
||||
.. py:method:: inverse_log_jacobian(value)
|
||||
|
||||
Compute the log value of the inverse mapping, namely :math:`\log(d\log(x) / dx)`.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value of output after mapping.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of the inverse mapping.
|
|
@ -0,0 +1,65 @@
|
|||
.. py:method:: loc
|
||||
:property:
|
||||
|
||||
Return the loc parameter of the bijector.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the loc parameter of the bijector.
|
||||
|
||||
.. py:method:: scale
|
||||
:property:
|
||||
|
||||
Return the scale parameter of the bijector.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the scale parameter of the bijector.
|
||||
|
||||
.. py:method:: forward(value)
|
||||
|
||||
forward mapping, compute the value after mapping as :math:`Y = g(X)`.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value to compute.
|
||||
|
||||
.. py:method:: forward_log_jacobian(value)
|
||||
|
||||
compute the log value after mapping, namely :math:`\log(dg(x) / dx)`.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of forward mapping.
|
||||
|
||||
.. py:method:: inverse(value)
|
||||
|
||||
Inverse mapping, compute the value after inverse mapping as :math:`X = g(X)`.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value of output after mapping.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of output after mapping.
|
||||
|
||||
.. py:method:: inverse_log_jacobian(value)
|
||||
|
||||
Compute the log value of the inverse mapping, namely :math:`\log(dg^{-1}(x) / dx)`.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value of output after mapping.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of the inverse mapping.
|
|
@ -0,0 +1,53 @@
|
|||
.. py:method:: bijector
|
||||
:property:
|
||||
|
||||
Return base bijector.
|
||||
|
||||
.. py:method:: forward(x)
|
||||
|
||||
Compute the inverse mapping of underlying Bijector, namely :math:`Y = h(X) = g^{-1}(X)` .
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **x** (Tensor) - the value of output after mapping by the underlying bijector.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the inverse mapping of underlying Bijector.
|
||||
|
||||
.. py:method:: forward_log_jacobian(x)
|
||||
|
||||
Compute the log value of the inverse mapping of underlying Bijector :math:`\log dg^{-1}(x) / dx`.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **x** (Tensor) - the value of output after mapping by the underlying bijector.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of the inverse mapping of underlying Bijector.
|
||||
|
||||
.. py:method:: inverse(y)
|
||||
|
||||
Compute the forward mapping of underlying Bijector, namely :math:`Y = g(X)`.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **y** (Tensor) - the value to compute by the underlying bijector.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the forward mapping of underlying Bijector.
|
||||
|
||||
.. py:method:: inverse_log_jacobian(y)
|
||||
|
||||
Compute the log value of the forward mapping of underlying Bijector, namely :math:`Y = \log dg(x) / dx`.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **y** (Tensor) - the value to compute by the underlying bijector.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of forward mapping of underlying Bijector.
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
.. py:method:: power
|
||||
:property:
|
||||
|
||||
Return the power index.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the power index.
|
||||
|
||||
.. py:method:: forward(value)
|
||||
|
||||
forward mapping, compute the value after mapping as :math:`Y = g(X)`.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value to compute.
|
||||
|
||||
.. py:method:: forward_log_jacobian(value)
|
||||
|
||||
compute the log value after mapping, namely :math:`\log(dg(x) / dx)`.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of forward mapping.
|
||||
|
||||
.. py:method:: inverse(value)
|
||||
|
||||
Inverse mapping, compute the value after inverse mapping as :math:`X = g(value)`.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value of output after mapping.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of output after mapping.
|
||||
|
||||
.. py:method:: inverse_log_jacobian(value)
|
||||
|
||||
Compute the log value of the inverse mapping, namely :math:`\log(dg^{-1}(x) / dx)`.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value of output after mapping.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of the inverse mapping.
|
|
@ -0,0 +1,65 @@
|
|||
.. py:method:: shift
|
||||
:property:
|
||||
|
||||
Return the shift parameter of the bijector.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the shift parameter of the bijector.
|
||||
|
||||
.. py:method:: scale
|
||||
:property:
|
||||
|
||||
Return the scale parameter of the bijector.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the scale parameter of the bijector.
|
||||
|
||||
.. py:method:: forward(value)
|
||||
|
||||
forward mapping, compute the value after mapping as :math:`Y = g(X)`.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value to compute.
|
||||
|
||||
.. py:method:: forward_log_jacobian(value)
|
||||
|
||||
compute the log value after mapping, namely :math:`\log(dg(x) / dx)`.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of forward mapping.
|
||||
|
||||
.. py:method:: inverse(value)
|
||||
|
||||
Inverse mapping, compute the value after inverse mapping as :math:`X = g(value)`.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value of output after mapping.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of output after mapping.
|
||||
|
||||
.. py:method:: inverse_log_jacobian(value)
|
||||
|
||||
Compute the log value of the inverse mapping, namely :math:`\log(dg^{-1}(x) / dx)`.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value of output after mapping.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of the inverse mapping.
|
|
@ -0,0 +1,56 @@
|
|||
.. py:method:: sharpness
|
||||
:property:
|
||||
|
||||
Return the sharpness parameter of the distribution.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the sharpness parameter of the distribution.
|
||||
|
||||
.. py:method:: forward(value)
|
||||
|
||||
forward mapping, compute the value after mapping as :math:`Y = g(X)`.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value to compute.
|
||||
|
||||
.. py:method:: forward_log_jacobian(value)
|
||||
|
||||
compute the log value after mapping, namely :math:`\log(dg(x) / dx)`.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of forward mapping.
|
||||
|
||||
.. py:method:: inverse(value)
|
||||
|
||||
Inverse mapping, compute the value after inverse mapping as :math:`X = g(value)`.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value of output after mapping.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of output after mapping.
|
||||
|
||||
.. py:method:: inverse_log_jacobian(value)
|
||||
|
||||
Compute the log value of the inverse mapping, namely :math:`\log(dg^{-1}(x) / dx)`.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value of output after mapping.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of the inverse mapping.
|
|
@ -0,0 +1,187 @@
|
|||
.. py:method:: probs
|
||||
:property:
|
||||
|
||||
Return the probability of success, namely the output is 1.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the probability of success.
|
||||
|
||||
.. py:method:: cdf(value, probs1)
|
||||
|
||||
Compute the cumulatuve distribution function(CDF) of the given value.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **probs1** (Tensor) - the probability of success. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the cumulatuve distribution function for the given input.
|
||||
|
||||
.. py:method:: cross_entropy(dist, probs1_b, probs1_a)
|
||||
|
||||
Compute the cross entropy of two distribution
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **dist** (str) - the type of the other distribution.
|
||||
- **probs1_b** (Tensor) - the probability of success of the other distribution.
|
||||
- **probs1_a** (Tensor) - the probability of success. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the cross entropy.
|
||||
|
||||
.. py:method:: entropy(probs1)
|
||||
|
||||
Compute the value of the entropy.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **probs1** (Tensor) - the probability of success. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the entropy.
|
||||
|
||||
.. py:method:: kl_loss(dist, probs1_b, probs1_a)
|
||||
|
||||
Compute the value of the K-L loss between two distribution, namely KL(a||b).
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **dist** (str) - the type of the other distribution.
|
||||
- **probs1_b** (Tensor) - the probability of success of the other distribution.
|
||||
- **probs1_a** (Tensor) - the probability of success. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the K-L loss.
|
||||
|
||||
.. py:method:: log_cdf(value, probs1)
|
||||
|
||||
Compute the log value of the cumulatuve distribution function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **probs1** (Tensor) - the probability of success. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of the cumulatuve distribution function.
|
||||
|
||||
.. py:method:: log_prob(value, probs1)
|
||||
|
||||
the log value of the probability.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **probs1** (Tensor) - the probability of success. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of the probability.
|
||||
|
||||
.. py:method:: log_survival(value, probs1)
|
||||
|
||||
Compute the log value of the survival function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **probs1** (Tensor) - the probability of success. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the K-L loss.
|
||||
|
||||
.. py:method:: mean(probs1)
|
||||
|
||||
Compute the mean value of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **probs1** (Tensor) - the probability of success. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the mean of the distribution.
|
||||
|
||||
.. py:method:: mode(probs1)
|
||||
|
||||
Compute the mode value of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **probs1** (Tensor) - the probability of success. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the mode of the distribution.
|
||||
|
||||
.. py:method:: prob(value, probs1)
|
||||
|
||||
The probability of the given value. For the discrete distribution, it is the probability mass function(pmf).
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **probs1** (Tensor) - the probability of success. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the probability.
|
||||
|
||||
.. py:method:: sample(shape, probs1)
|
||||
|
||||
Generate samples.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **shape** (tuple) - the shape of the sample.
|
||||
- **probs1** (Tensor) - the probability of success. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the sample following the distribution.
|
||||
|
||||
.. py:method:: sd(probs1)
|
||||
|
||||
The standard deviation.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **probs1** (Tensor) - the probability of success. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the standard deviation of the distribution.
|
||||
|
||||
.. py:method:: survival_function(value, probs1)
|
||||
|
||||
Compute the value of the survival function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **probs1** (Tensor) - the probability of success. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the survival function.
|
||||
|
||||
.. py:method:: var(probs1)
|
||||
|
||||
Compute the variance of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **probs1** (Tensor) - the probability of success. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the variance of the distribution.
|
|
@ -0,0 +1,212 @@
|
|||
.. py:method:: concentration0
|
||||
:property:
|
||||
|
||||
Return concentration0, aka the beta parameter of the Beta distribution.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of concentration0.
|
||||
|
||||
.. py:method:: concentration1
|
||||
:property:
|
||||
|
||||
Return concentration1, aka the alpha parameter of the Beta distribution.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of concentration1.
|
||||
|
||||
.. py:method:: cdf(value, concentration1, concentration0)
|
||||
|
||||
Compute the cumulatuve distribution function(CDF) of the given value.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **concentration1** (Tensor) - the alpha parameter of the Beta distribution. Default value: None.
|
||||
- **concentration0** (Tensor) - the beta parameter of the Beta distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the cumulatuve distribution function for the given input.
|
||||
|
||||
.. py:method:: cross_entropy(dist, concentration1_b, concentration0_b, concentration1, concentration0)
|
||||
|
||||
Compute the cross entropy of two distribution
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **dist** (str) - the type of the other distribution.
|
||||
- **concentration1_b** (Tensor) - the alpha parameter of the other Beta distribution.
|
||||
- **concentration0_b** (Tensor) - the beta parameter of the other Beta distribution.
|
||||
- **concentration1** (Tensor) - the alpha parameter of the Beta distribution. Default value: None.
|
||||
- **concentration0** (Tensor) - the beta parameter of the Beta distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the cross entropy.
|
||||
|
||||
.. py:method:: entropy(concentration1, concentration0)
|
||||
|
||||
Compute the value of the entropy.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **concentration1** (Tensor) - the alpha parameter of the Beta distribution. Default value: None.
|
||||
- **concentration0** (Tensor) - the beta parameter of the Beta distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the entropy.
|
||||
|
||||
.. py:method:: kl_loss(dist, concentration1_b, concentration0_b, concentration1, concentration0)
|
||||
|
||||
Compute the value of the K-L loss between two distribution, namely KL(a||b).
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **dist** (str) - the type of the other distribution.
|
||||
- **concentration1_b** (Tensor) - the alpha parameter of the other Beta distribution.
|
||||
- **concentration0_b** (Tensor) - the beta parameter of the other Beta distribution.
|
||||
- **concentration1** (Tensor) - the alpha parameter of the Beta distribution. Default value: None.
|
||||
- **concentration0** (Tensor) - the beta parameter of the Beta distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the K-L loss.
|
||||
|
||||
.. py:method:: log_cdf(value, concentration1, concentration0)
|
||||
|
||||
Compute the log value of the cumulatuve distribution function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **concentration1** (Tensor) - the alpha parameter of the Beta distribution. Default value: None.
|
||||
- **concentration0** (Tensor) - the beta parameter of the Beta distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of the cumulatuve distribution function.
|
||||
|
||||
.. py:method:: log_prob(value, concentration1, concentration0)
|
||||
|
||||
the log value of the probability.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **concentration1** (Tensor) - the alpha parameter of the Beta distribution. Default value: None.
|
||||
- **concentration0** (Tensor) - the beta parameter of the Beta distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of the probability.
|
||||
|
||||
.. py:method:: log_survival(value, concentration1, concentration0)
|
||||
|
||||
Compute the log value of the survival function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **concentration1** (Tensor) - the alpha parameter of the Beta distribution. Default value: None.
|
||||
- **concentration0** (Tensor) - the beta parameter of the Beta distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the K-L loss.
|
||||
|
||||
.. py:method:: mean(concentration1, concentration0)
|
||||
|
||||
Compute the mean value of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **concentration1** (Tensor) - the alpha parameter of the Beta distribution. Default value: None.
|
||||
- **concentration0** (Tensor) - the beta parameter of the Beta distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the mean of the distribution.
|
||||
|
||||
.. py:method:: mode(concentration1, concentration0)
|
||||
|
||||
Compute the mode value of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **concentration1** (Tensor) - the alpha parameter of the Beta distribution. Default value: None.
|
||||
- **concentration0** (Tensor) - the beta parameter of the Beta distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the mode of the distribution.
|
||||
|
||||
.. py:method:: prob(value, concentration1, concentration0)
|
||||
|
||||
The probability of the given value. For the continuous distribution, it is the probability density function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **concentration1** (Tensor) - the alpha parameter of the Beta distribution. Default value: None.
|
||||
- **concentration0** (Tensor) - the beta parameter of the Beta distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the probability.
|
||||
|
||||
.. py:method:: sample(shape, concentration1, concentration0)
|
||||
|
||||
Generate samples.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **shape** (tuple) - the shape of the sample.
|
||||
- **concentration1** (Tensor) - the alpha parameter of the Beta distribution. Default value: None.
|
||||
- **concentration0** (Tensor) - the beta parameter of the Beta distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the sample following the distribution.
|
||||
|
||||
.. py:method:: sd(concentration1, concentration0)
|
||||
|
||||
The standard deviation.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **concentration1** (Tensor) - the alpha parameter of the Beta distribution. Default value: None.
|
||||
- **concentration0** (Tensor) - the beta parameter of the Beta distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the standard deviation of the distribution.
|
||||
|
||||
.. py:method:: survival_function(value, concentration1, concentration0)
|
||||
|
||||
Compute the value of the survival function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **concentration1** (Tensor) - the alpha parameter of the Beta distribution. Default value: None.
|
||||
- **concentration0** (Tensor) - the beta parameter of the Beta distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the survival function.
|
||||
|
||||
.. py:method:: var(concentration1, concentration0)
|
||||
|
||||
Compute the variance of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **concentration1** (Tensor) - the alpha parameter of the Beta distribution. Default value: None.
|
||||
- **concentration0** (Tensor) - the beta parameter of the Beta distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the variance of the distribution.
|
|
@ -0,0 +1,187 @@
|
|||
.. py:method:: probs
|
||||
:property:
|
||||
|
||||
Return the event probability.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the event probability.
|
||||
|
||||
.. py:method:: cdf(value, probs)
|
||||
|
||||
Compute the cumulatuve distribution function(CDF) of the given value.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **probs** (Tensor) - the event probability. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the cumulatuve distribution function for the given input.
|
||||
|
||||
.. py:method:: cross_entropy(dist, probs_b, probs)
|
||||
|
||||
Compute the cross entropy of two distribution
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **dist** (str) - the type of the other distribution.
|
||||
- **probs_b** (Tensor) - the event probability of the other distribution.
|
||||
- **probs** (Tensor) - the event probability. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the cross entropy.
|
||||
|
||||
.. py:method:: entropy(probs)
|
||||
|
||||
Compute the value of the entropy.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **probs** (Tensor) - the event probability. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the entropy.
|
||||
|
||||
.. py:method:: kl_loss(dist, probs_b, probs)
|
||||
|
||||
Compute the value of the K-L loss between two distribution, namely KL(a||b).
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **dist** (str) - the type of the other distribution.
|
||||
- **probs_b** (Tensor) - the event probability of the other distribution.
|
||||
- **probs** (Tensor) - the event probability. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the K-L loss.
|
||||
|
||||
.. py:method:: log_cdf(value, probs)
|
||||
|
||||
Compute the log value of the cumulatuve distribution function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **probs** (Tensor) - the event probability. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of the cumulatuve distribution function.
|
||||
|
||||
.. py:method:: log_prob(value, probs)
|
||||
|
||||
the log value of the probability.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **probs** (Tensor) - the event probability. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of the probability.
|
||||
|
||||
.. py:method:: log_survival(value, probs)
|
||||
|
||||
Compute the log value of the survival function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **probs** (Tensor) - the event probability. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the K-L loss.
|
||||
|
||||
.. py:method:: mean(probs)
|
||||
|
||||
Compute the mean value of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **probs** (Tensor) - the event probability. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the mean of the distribution.
|
||||
|
||||
.. py:method:: mode(probs)
|
||||
|
||||
Compute the mode value of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **probs** (Tensor) - the event probability. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the mode of the distribution.
|
||||
|
||||
.. py:method:: prob(value, probs)
|
||||
|
||||
The probability of the given value. For the discrete distribution, it is the probability mass function(pmf).
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **probs** (Tensor) - the event probability. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the probability.
|
||||
|
||||
.. py:method:: sample(shape, probs)
|
||||
|
||||
Generate samples.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **shape** (tuple) - the shape of the sample.
|
||||
- **probs** (Tensor) - the event probability. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the sample following the distribution.
|
||||
|
||||
.. py:method:: sd(probs)
|
||||
|
||||
The standard deviation.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **probs** (Tensor) - the event probability. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the standard deviation of the distribution.
|
||||
|
||||
.. py:method:: survival_function(value, probs)
|
||||
|
||||
Compute the value of the survival function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **probs** (Tensor) - the event probability. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the survival function.
|
||||
|
||||
.. py:method:: var(probs)
|
||||
|
||||
Compute the variance of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **probs** (Tensor) - the event probability. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the variance of the distribution.
|
|
@ -0,0 +1,187 @@
|
|||
.. py:method:: rate
|
||||
:property:
|
||||
|
||||
Return rate.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the rate of the distribution.
|
||||
|
||||
.. py:method:: cdf(value, rate)
|
||||
|
||||
Compute the cumulatuve distribution function(CDF) of the given value.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **rate** (Tensor) - the rate of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the cumulatuve distribution function for the given input.
|
||||
|
||||
.. py:method:: cross_entropy(dist, rate_b, rate)
|
||||
|
||||
Compute the cross entropy of two distribution
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **dist** (str) - the type of the other distribution.
|
||||
- **rate_b** (Tensor) - the rate of the other distribution.
|
||||
- **rate** (Tensor) - the rate of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the cross entropy.
|
||||
|
||||
.. py:method:: entropy(rate)
|
||||
|
||||
Compute the value of the entropy.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **rate** (Tensor) - the rate of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the entropy.
|
||||
|
||||
.. py:method:: kl_loss(dist, rate_b, rate)
|
||||
|
||||
Compute the value of the K-L loss between two distribution, namely KL(a||b).
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **dist** (str) - the type of the other distribution.
|
||||
- **rate_b** (Tensor) - the rate of the other distribution.
|
||||
- **rate** (Tensor) - the rate of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the K-L loss.
|
||||
|
||||
.. py:method:: log_cdf(value, rate)
|
||||
|
||||
Compute the log value of the cumulatuve distribution function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **rate** (Tensor) - the rate of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of the cumulatuve distribution function.
|
||||
|
||||
.. py:method:: log_prob(value, rate)
|
||||
|
||||
the log value of the probability.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **rate** (Tensor) - the rate of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of the probability.
|
||||
|
||||
.. py:method:: log_survival(value, rate)
|
||||
|
||||
Compute the log value of the survival function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **rate** (Tensor) - the rate of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the K-L loss.
|
||||
|
||||
.. py:method:: mean(rate)
|
||||
|
||||
Compute the mean value of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **rate** (Tensor) - the rate of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the mean of the distribution.
|
||||
|
||||
.. py:method:: mode(rate)
|
||||
|
||||
Compute the mode value of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **rate** (Tensor) - the rate of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the mode of the distribution.
|
||||
|
||||
.. py:method:: prob(value, rate)
|
||||
|
||||
The probability of the given value. For the continuous distribution, it is the probability density function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **rate** (Tensor) - the rate of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the probability.
|
||||
|
||||
.. py:method:: sample(shape, rate)
|
||||
|
||||
Generate samples.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **shape** (tuple) - the shape of the sample.
|
||||
- **rate** (Tensor) - the rate of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the sample following the distribution.
|
||||
|
||||
.. py:method:: sd(rate)
|
||||
|
||||
The standard deviation.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **rate** (Tensor) - the rate of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the standard deviation of the distribution.
|
||||
|
||||
.. py:method:: survival_function(value, rate)
|
||||
|
||||
Compute the value of the survival function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **rate** (Tensor) - the rate of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the survival function.
|
||||
|
||||
.. py:method:: var(rate)
|
||||
|
||||
Compute the variance of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **rate** (Tensor) - the rate of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the variance of the distribution.
|
|
@ -0,0 +1,212 @@
|
|||
.. py:method:: concentration
|
||||
:property:
|
||||
|
||||
Return the concentration, aka the alpha parameter, of the distribution.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, concentration.
|
||||
|
||||
.. py:method:: rate
|
||||
:property:
|
||||
|
||||
Return the rate, aka the beta parameter, of the distribution.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, rate.
|
||||
|
||||
.. py:method:: cdf(value, concentration, rate)
|
||||
|
||||
Compute the cumulatuve distribution function(CDF) of the given value.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **concentration** (Tensor) - the alpha parameter of the distribution. Default value: None.
|
||||
- **rate** (Tensor) - the beta parameter of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the cumulatuve distribution function for the given input.
|
||||
|
||||
.. py:method:: cross_entropy(dist, concentration_b, rate_b, concentration, rate)
|
||||
|
||||
Compute the cross entropy of two distribution
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **dist** (str) - the type of the other distribution.
|
||||
- **concentration_b** (Tensor) - the alpha parameter of the other distribution.
|
||||
- **rate_b** (Tensor) - the beta parameter of the other distribution.
|
||||
- **concentration** (Tensor) - the alpha parameter of the distribution. Default value: None.
|
||||
- **rate** (Tensor) - the beta parameter of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the cross entropy.
|
||||
|
||||
.. py:method:: entropy(concentration, rate)
|
||||
|
||||
Compute the value of the entropy.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **concentration** (Tensor) - the alpha parameter of the distribution. Default value: None.
|
||||
- **rate** (Tensor) - the beta parameter of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the entropy.
|
||||
|
||||
.. py:method:: kl_loss(dist, concentration_b, rate_b, concentration, rate)
|
||||
|
||||
Compute the value of the K-L loss between two distribution, namely KL(a||b).
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **dist** (str) - the type of the other distribution.
|
||||
- **concentration_b** (Tensor) - the alpha parameter of the other distribution.
|
||||
- **rate_b** (Tensor) - the beta parameter of the other distribution.
|
||||
- **concentration** (Tensor) - the alpha parameter of the distribution. Default value: None.
|
||||
- **rate** (Tensor) - the beta parameter of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the K-L loss.
|
||||
|
||||
.. py:method:: log_cdf(value, concentration, rate)
|
||||
|
||||
Compute the log value of the cumulatuve distribution function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **concentration** (Tensor) - the alpha parameter of the distribution. Default value: None.
|
||||
- **rate** (Tensor) - the beta parameter of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of the cumulatuve distribution function.
|
||||
|
||||
.. py:method:: log_prob(value, concentration, rate)
|
||||
|
||||
the log value of the probability.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **concentration** (Tensor) - the alpha parameter of the distribution. Default value: None.
|
||||
- **rate** (Tensor) - the beta parameter of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of the probability.
|
||||
|
||||
.. py:method:: log_survival(value, concentration, rate)
|
||||
|
||||
Compute the log value of the survival function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **concentration** (Tensor) - the alpha parameter of the distribution. Default value: None.
|
||||
- **rate** (Tensor) - the beta parameter of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the K-L loss.
|
||||
|
||||
.. py:method:: mean(concentration, rate)
|
||||
|
||||
Compute the mean value of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **concentration** (Tensor) - the alpha parameter of the distribution. Default value: None.
|
||||
- **rate** (Tensor) - the beta parameter of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the mean of the distribution.
|
||||
|
||||
.. py:method:: mode(concentration, rate)
|
||||
|
||||
Compute the mode value of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **concentration** (Tensor) - the alpha parameter of the distribution. Default value: None.
|
||||
- **rate** (Tensor) - the beta parameter of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the mode of the distribution.
|
||||
|
||||
.. py:method:: prob(value, concentration, rate)
|
||||
|
||||
The probability of the given value. For the continuous distribution, it is the probability density function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **concentration** (Tensor) - the alpha parameter of the distribution. Default value: None.
|
||||
- **rate** (Tensor) - the beta parameter of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the probability.
|
||||
|
||||
.. py:method:: sample(shape, concentration, rate)
|
||||
|
||||
Generate samples.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **shape** (tuple) - the shape of the sample.
|
||||
- **concentration** (Tensor) - the alpha parameter of the distribution. Default value: None.
|
||||
- **rate** (Tensor) - the beta parameter of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the sample following the distribution.
|
||||
|
||||
.. py:method:: sd(concentration, rate)
|
||||
|
||||
The standard deviation.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **concentration** (Tensor) - the alpha parameter of the distribution. Default value: None.
|
||||
- **rate** (Tensor) - the beta parameter of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the standard deviation of the distribution.
|
||||
|
||||
.. py:method:: survival_function(value, concentration, rate)
|
||||
|
||||
Compute the value of the survival function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **concentration** (Tensor) - the alpha parameter of the distribution. Default value: None.
|
||||
- **rate** (Tensor) - the beta parameter of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the survival function.
|
||||
|
||||
.. py:method:: var(concentration, rate)
|
||||
|
||||
Compute the variance of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **concentration** (Tensor) - the alpha parameter of the distribution. Default value: None.
|
||||
- **rate** (Tensor) - the beta parameter of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the variance of the distribution.
|
|
@ -0,0 +1,212 @@
|
|||
.. py:method:: loc
|
||||
:property:
|
||||
|
||||
Return the loc parameter of the distribution.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the loc parameter of the distribution.
|
||||
|
||||
.. py:method:: scale
|
||||
:property:
|
||||
|
||||
Return the scale parameter of the distribution.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the scale parameter of the distribution.
|
||||
|
||||
.. py:method:: cdf(value, loc, scale)
|
||||
|
||||
Compute the cumulatuve distribution function(CDF) of the given value.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **loc** (Tensor) - the loc parameter of the distribution. Default value: None.
|
||||
- **scale** (Tensor) - the scale parameter of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the cumulatuve distribution function for the given input.
|
||||
|
||||
.. py:method:: cross_entropy(dist, loc_b, scale_b, loc, scale)
|
||||
|
||||
Compute the cross entropy of two distribution
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **dist** (str) - the type of the other distribution.
|
||||
- **loc_b** (Tensor) - the loc parameter of the other distribution.
|
||||
- **scale_b** (Tensor) - the scale parameter of the other distribution.
|
||||
- **loc** (Tensor) - the loc parameter of the distribution. Default value: None.
|
||||
- **scale** (Tensor) - the scale parameter of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the cross entropy.
|
||||
|
||||
.. py:method:: entropy(loc, scale)
|
||||
|
||||
Compute the value of the entropy.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **loc** (Tensor) - the loc parameter of the distribution. Default value: None.
|
||||
- **scale** (Tensor) - the scale parameter of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the entropy.
|
||||
|
||||
.. py:method:: kl_loss(dist, loc_b, scale_b, loc, scale)
|
||||
|
||||
Compute the value of the K-L loss between two distribution, namely KL(a||b).
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **dist** (str) - the type of the other distribution.
|
||||
- **loc_b** (Tensor) - the loc parameter of the other distribution.
|
||||
- **scale_b** (Tensor) - the scale parameter of the other distribution.
|
||||
- **loc** (Tensor) - the loc parameter of the distribution. Default value: None.
|
||||
- **scale** (Tensor) - the scale parameter of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the K-L loss.
|
||||
|
||||
.. py:method:: log_cdf(value, loc, scale)
|
||||
|
||||
Compute the log value of the cumulatuve distribution function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **loc** (Tensor) - the loc parameter of the distribution. Default value: None.
|
||||
- **scale** (Tensor) - the scale parameter of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of the cumulatuve distribution function.
|
||||
|
||||
.. py:method:: log_prob(value, loc, scale)
|
||||
|
||||
the log value of the probability.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **loc** (Tensor) - the loc parameter of the distribution. Default value: None.
|
||||
- **scale** (Tensor) - the scale parameter of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of the probability.
|
||||
|
||||
.. py:method:: log_survival(value, loc, scale)
|
||||
|
||||
Compute the log value of the survival function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **loc** (Tensor) - the loc parameter of the distribution. Default value: None.
|
||||
- **scale** (Tensor) - the scale parameter of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the K-L loss.
|
||||
|
||||
.. py:method:: mean(loc, scale)
|
||||
|
||||
Compute the mean value of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **loc** (Tensor) - the loc parameter of the distribution. Default value: None.
|
||||
- **scale** (Tensor) - the scale parameter of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the mean of the distribution.
|
||||
|
||||
.. py:method:: mode(loc, scale)
|
||||
|
||||
Compute the mode value of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **loc** (Tensor) - the loc parameter of the distribution. Default value: None.
|
||||
- **scale** (Tensor) - the scale parameter of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the mode of the distribution.
|
||||
|
||||
.. py:method:: prob(value, loc, scale)
|
||||
|
||||
The probability of the given value. For the continuous distribution, it is the probability density function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **loc** (Tensor) - the loc parameter of the distribution. Default value: None.
|
||||
- **scale** (Tensor) - the scale parameter of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the probability.
|
||||
|
||||
.. py:method:: sample(shape, loc, scale)
|
||||
|
||||
Generate samples.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **shape** (tuple) - the shape of the sample.
|
||||
- **loc** (Tensor) - the loc parameter of the distribution. Default value: None.
|
||||
- **scale** (Tensor) - the scale parameter of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the sample following the distribution.
|
||||
|
||||
.. py:method:: sd(loc, scale)
|
||||
|
||||
The standard deviation.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **loc** (Tensor) - the loc parameter of the distribution. Default value: None.
|
||||
- **scale** (Tensor) - the scale parameter of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the standard deviation of the distribution.
|
||||
|
||||
.. py:method:: survival_function(value, loc, scale)
|
||||
|
||||
Compute the value of the survival function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **loc** (Tensor) - the loc parameter of the distribution. Default value: None.
|
||||
- **scale** (Tensor) - the scale parameter of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the survival function.
|
||||
|
||||
.. py:method:: var(loc, scale)
|
||||
|
||||
Compute the variance of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **loc** (Tensor) - the loc parameter of the distribution. Default value: None.
|
||||
- **scale** (Tensor) - the scale parameter of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the variance of the distribution.
|
|
@ -0,0 +1,187 @@
|
|||
.. py:method:: probs
|
||||
:property:
|
||||
|
||||
Return the probability of success.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the probability of success.
|
||||
|
||||
.. py:method:: cdf(value, probs)
|
||||
|
||||
Compute the cumulatuve distribution function(CDF) of the given value.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **probs** (Tensor) - the probability of success. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the cumulatuve distribution function for the given input.
|
||||
|
||||
.. py:method:: cross_entropy(dist, probs_b, probs)
|
||||
|
||||
Compute the cross entropy of two distribution
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **dist** (str) - the type of the other distribution.
|
||||
- **probs_b** (Tensor) - the probability of success of the other distribution.
|
||||
- **probs** (Tensor) - the probability of success. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the cross entropy.
|
||||
|
||||
.. py:method:: entropy(probs)
|
||||
|
||||
Compute the value of the entropy.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **probs** (Tensor) - the probability of success. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the entropy.
|
||||
|
||||
.. py:method:: kl_loss(dist, probs_b, probs)
|
||||
|
||||
Compute the value of the K-L loss between two distribution, namely KL(a||b).
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **dist** (str) - the type of the other distribution.
|
||||
- **probs_b** (Tensor) - the probability of success of the other distribution.
|
||||
- **probs** (Tensor) - the probability of success. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the K-L loss.
|
||||
|
||||
.. py:method:: log_cdf(value, probs)
|
||||
|
||||
Compute the log value of the cumulatuve distribution function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **probs** (Tensor) - the probability of success. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of the cumulatuve distribution function.
|
||||
|
||||
.. py:method:: log_prob(value, probs)
|
||||
|
||||
the log value of the probability.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **probs** (Tensor) - the probability of success. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of the probability.
|
||||
|
||||
.. py:method:: log_survival(value, probs)
|
||||
|
||||
Compute the log value of the survival function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **probs** (Tensor) - the probability of success. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the K-L loss.
|
||||
|
||||
.. py:method:: mean(probs)
|
||||
|
||||
Compute the mean value of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **probs** (Tensor) - the probability of success. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the mean of the distribution.
|
||||
|
||||
.. py:method:: mode(probs)
|
||||
|
||||
Compute the mode value of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **probs** (Tensor) - the probability of success. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the mode of the distribution.
|
||||
|
||||
.. py:method:: prob(value, probs)
|
||||
|
||||
The probability of the given value. For the discrete distribution, it is the probability mass function(pmf).
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **probs** (Tensor) - the probability of success. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the probability.
|
||||
|
||||
.. py:method:: sample(shape, probs)
|
||||
|
||||
Generate samples.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **shape** (tuple) - the shape of the sample.
|
||||
- **probs** (Tensor) - the probability of success. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the sample following the distribution.
|
||||
|
||||
.. py:method:: sd(probs)
|
||||
|
||||
The standard deviation.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **probs** (Tensor) - the probability of success. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the standard deviation of the distribution.
|
||||
|
||||
.. py:method:: survival_function(value, probs)
|
||||
|
||||
Compute the value of the survival function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **probs** (Tensor) - the probability of success. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the survival function.
|
||||
|
||||
.. py:method:: var(probs)
|
||||
|
||||
Compute the variance of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **probs** (Tensor) - the probability of success. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the variance of the distribution.
|
|
@ -0,0 +1,186 @@
|
|||
.. py:method:: mean
|
||||
:property:
|
||||
|
||||
Return the mean of the distribution.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the mean of the distribution.
|
||||
|
||||
.. py:method:: sd
|
||||
:property:
|
||||
|
||||
Return the standard deviation of the distribution.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the standard deviation of the distribution.
|
||||
|
||||
.. py:method:: cdf(value, mean, sd)
|
||||
|
||||
Compute the cumulatuve distribution function(CDF) of the given value.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **mean** (Tensor) - the mean of the distribution. Default value: None.
|
||||
- **sd** (Tensor) - the standard deviation of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the cumulatuve distribution function for the given input.
|
||||
|
||||
.. py:method:: cross_entropy(dist, mean_b, sd_b, mean, sd)
|
||||
|
||||
Compute the cross entropy of two distribution
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **dist** (str) - the type of the other distribution.
|
||||
- **mean_b** (Tensor) - the mean of the other distribution.
|
||||
- **sd_b** (Tensor) - the standard deviation of the other distribution.
|
||||
- **mean** (Tensor) - the mean of the distribution. Default value: None.
|
||||
- **sd** (Tensor) - the standard deviation of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the cross entropy.
|
||||
|
||||
.. py:method:: entropy(mean, sd)
|
||||
|
||||
Compute the value of the entropy.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **mean** (Tensor) - the mean of the distribution. Default value: None.
|
||||
- **sd** (Tensor) - the standard deviation of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the entropy.
|
||||
|
||||
.. py:method:: kl_loss(dist, mean_b, sd_b, mean, sd)
|
||||
|
||||
Compute the value of the K-L loss between two distribution, namely KL(a||b).
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **dist** (str) - the type of the other distribution.
|
||||
- **mean_b** (Tensor) - the mean of the other distribution.
|
||||
- **sd_b** (Tensor) - the standard deviation of the other distribution.
|
||||
- **mean** (Tensor) - the mean of the distribution. Default value: None.
|
||||
- **sd** (Tensor) - the standard deviation of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the K-L loss.
|
||||
|
||||
.. py:method:: log_cdf(value, mean, sd)
|
||||
|
||||
Compute the log value of the cumulatuve distribution function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **mean** (Tensor) - the mean of the distribution. Default value: None.
|
||||
- **sd** (Tensor) - the standard deviation of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of the cumulatuve distribution function.
|
||||
|
||||
.. py:method:: log_prob(value, mean, sd)
|
||||
|
||||
the log value of the probability.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **mean** (Tensor) - the mean of the distribution. Default value: None.
|
||||
- **sd** (Tensor) - the standard deviation of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of the probability.
|
||||
|
||||
.. py:method:: log_survival(value, mean, sd)
|
||||
|
||||
Compute the log value of the survival function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **mean** (Tensor) - the mean of the distribution. Default value: None.
|
||||
- **sd** (Tensor) - the standard deviation of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the K-L loss.
|
||||
|
||||
.. py:method:: mode(mean, sd)
|
||||
|
||||
Compute the mode value of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **mean** (Tensor) - the mean of the distribution. Default value: None.
|
||||
- **sd** (Tensor) - the standard deviation of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the mode of the distribution.
|
||||
|
||||
.. py:method:: prob(value, mean, sd)
|
||||
|
||||
The probability of the given value. For the continuous distribution, it is the probability density function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **mean** (Tensor) - the mean of the distribution. Default value: None.
|
||||
- **sd** (Tensor) - the standard deviation of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the probability.
|
||||
|
||||
.. py:method:: sample(shape, mean, sd)
|
||||
|
||||
Generate samples.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **shape** (tuple) - the shape of the sample.
|
||||
- **mean** (Tensor) - the mean of the distribution. Default value: None.
|
||||
- **sd** (Tensor) - the standard deviation of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the sample following the distribution.
|
||||
|
||||
.. py:method:: survival_function(value, mean, sd)
|
||||
|
||||
Compute the value of the survival function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **mean** (Tensor) - the mean of the distribution. Default value: None.
|
||||
- **sd** (Tensor) - the standard deviation of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the survival function.
|
||||
|
||||
.. py:method:: var(mean, sd)
|
||||
|
||||
Compute the variance of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **mean** (Tensor) - the mean of the distribution. Default value: None.
|
||||
- **sd** (Tensor) - the standard deviation of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the variance of the distribution.
|
|
@ -0,0 +1,147 @@
|
|||
.. py:method:: rate
|
||||
:property:
|
||||
|
||||
Return rate parameter.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the rate.
|
||||
|
||||
.. py:method:: cdf(value, rate)
|
||||
|
||||
Compute the cumulatuve distribution function(CDF) of the given value.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **rate** (Tensor) - the value of the rate. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the cumulatuve distribution function for the given input.
|
||||
|
||||
.. py:method:: log_cdf(value, rate)
|
||||
|
||||
Compute the log value of the cumulatuve distribution function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **rate** (Tensor) - the value of the rate. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of the cumulatuve distribution function.
|
||||
|
||||
.. py:method:: log_prob(value, rate)
|
||||
|
||||
the log value of the probability.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **rate** (Tensor) - the value of the rate. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of the probability.
|
||||
|
||||
.. py:method:: log_survival(value, rate)
|
||||
|
||||
Compute the log value of the survival function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **rate** (Tensor) - the value of the rate. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the K-L loss.
|
||||
|
||||
.. py:method:: mean(rate)
|
||||
|
||||
Compute the mean value of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **rate** (Tensor) - the value of the rate. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the mean of the distribution.
|
||||
|
||||
.. py:method:: mode(rate)
|
||||
|
||||
Compute the mode value of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **rate** (Tensor) - the value of the rate. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the mode of the distribution.
|
||||
|
||||
.. py:method:: prob(value, rate)
|
||||
|
||||
The probability of the given value. For the discrete distribution, it is the probability mass function(pmf).
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **rate** (Tensor) - the value of the rate. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the probability.
|
||||
|
||||
.. py:method:: sample(shape, rate)
|
||||
|
||||
Generate samples.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **shape** (tuple) - the shape of the tensor.
|
||||
- **rate** (Tensor) - the value of the rate. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the sample following the distribution.
|
||||
|
||||
.. py:method:: sd(rate)
|
||||
|
||||
The standard deviation.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **rate** (Tensor) - the value of the rate. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the standard deviation of the distribution.
|
||||
|
||||
.. py:method:: survival_function(value, rate)
|
||||
|
||||
Compute the value of the survival function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **rate** (Tensor) - the value of the rate. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the survival function.
|
||||
|
||||
.. py:method:: var(rate)
|
||||
|
||||
Compute the variance of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **rate** (Tensor) - the value of the rate. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the variance of the distribution.
|
|
@ -0,0 +1,127 @@
|
|||
.. py:method:: bijector
|
||||
:property:
|
||||
|
||||
Return the bijector.
|
||||
|
||||
**Returns**
|
||||
|
||||
Bijector, the bijector.
|
||||
|
||||
.. py:method:: distribution
|
||||
:property:
|
||||
|
||||
Return the distribution before transformation.
|
||||
|
||||
**Returns**
|
||||
|
||||
Distribution, the distribution before transformation.
|
||||
|
||||
.. py:method:: dtype
|
||||
:property:
|
||||
|
||||
Return the data type of distribution.
|
||||
|
||||
**Returns**
|
||||
|
||||
mindspore.dtype, the data type of distribution.
|
||||
|
||||
.. py:method:: is_linear_transformation
|
||||
:property:
|
||||
|
||||
Return whether the bijector is linear.
|
||||
|
||||
**Returns**
|
||||
|
||||
Bool, return True if the bijector is linear, otherwise return False.
|
||||
|
||||
.. py:method:: cdf(value)
|
||||
|
||||
Compute the cumulatuve distribution function(CDF) of the given value.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the cumulatuve distribution function for the given input.
|
||||
|
||||
.. py:method:: log_cdf(value)
|
||||
|
||||
Compute the log value of the cumulatuve distribution function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of the cumulatuve distribution function.
|
||||
|
||||
.. py:method:: log_prob(value)
|
||||
|
||||
the log value of the probability.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of the probability.
|
||||
|
||||
.. py:method:: log_survival(value)
|
||||
|
||||
Compute the log value of the survival function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the K-L loss.
|
||||
|
||||
.. py:method:: mean
|
||||
|
||||
Compute the mean value of the distribution.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the mean of the distribution.
|
||||
|
||||
.. py:method:: prob(value)
|
||||
|
||||
The probability of the given value.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the probability.
|
||||
|
||||
.. py:method:: sample(shape)
|
||||
|
||||
Generate samples.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **shape** (tuple) - the shape of the tensor.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the sample following the distribution.
|
||||
|
||||
.. py:method:: survival_function(value)
|
||||
|
||||
Compute the value of the survival function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the survival function.
|
|
@ -0,0 +1,212 @@
|
|||
.. py:method:: high
|
||||
:property:
|
||||
|
||||
Return the upper bound of the distribution.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the upper bound of the distribution.
|
||||
|
||||
.. py:method:: low
|
||||
:property:
|
||||
|
||||
Return the upper bound of the distribution.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the lower bound of the distribution.
|
||||
|
||||
.. py:method:: cdf(value, high, low)
|
||||
|
||||
Compute the cumulatuve distribution function(CDF) of the given value.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **high** (Tensor) - the upper bound of the distribution. Default value: None.
|
||||
- **low** (Tensor) - the lower bound of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the cumulatuve distribution function for the given input.
|
||||
|
||||
.. py:method:: cross_entropy(dist, high_b, low_b, high, low)
|
||||
|
||||
Compute the cross entropy of two distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **dist** (str) - the type of the other distribution.
|
||||
- **high_b** (Tensor) - the upper bound of the other distribution.
|
||||
- **low_b** (Tensor) - the lower bound of the other distribution.
|
||||
- **high** (Tensor) - the upper bound of the distribution. Default value: None.
|
||||
- **low** (Tensor) - the lower bound of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the cross entropy.
|
||||
|
||||
.. py:method:: entropy(high, low)
|
||||
|
||||
Compute the value of the entropy.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **high** (Tensor) - the upper bound of the distribution. Default value: None.
|
||||
- **low** (Tensor) - the lower bound of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the entropy.
|
||||
|
||||
.. py:method:: kl_loss(dist, high_b, low_b, high, low)
|
||||
|
||||
Compute the value of the K-L loss between two distribution, namely KL(a||b).
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **dist** (str) - the type of the other distribution.
|
||||
- **high_b** (Tensor) - the upper bound of the other distribution.
|
||||
- **low_b** (Tensor) - the lower bound of the other distribution.
|
||||
- **high** (Tensor) - the upper bound of the distribution. Default value: None.
|
||||
- **low** (Tensor) - the lower bound of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the K-L loss.
|
||||
|
||||
.. py:method:: log_cdf(value, high, low)
|
||||
|
||||
Compute the log value of the cumulatuve distribution function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **high** (Tensor) - the upper bound of the distribution. Default value: None.
|
||||
- **low** (Tensor) - the lower bound of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of the cumulatuve distribution function.
|
||||
|
||||
.. py:method:: log_prob(value, high, low)
|
||||
|
||||
the log value of the probability.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **high** (Tensor) - the upper bound of the distribution. Default value: None.
|
||||
- **low** (Tensor) - the lower bound of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the log value of the probability.
|
||||
|
||||
.. py:method:: log_survival(value, high, low)
|
||||
|
||||
Compute the log value of the survival function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **high** (Tensor) - the upper bound of the distribution. Default value: None.
|
||||
- **low** (Tensor) - the lower bound of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the K-L loss.
|
||||
|
||||
.. py:method:: mean(high, low)
|
||||
|
||||
Compute the mean value of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **high** (Tensor) - the upper bound of the distribution. Default value: None.
|
||||
- **low** (Tensor) - the lower bound of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the mean of the distribution.
|
||||
|
||||
.. py:method:: mode(high, low)
|
||||
|
||||
Compute the mode value of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **high** (Tensor) - the upper bound of the distribution. Default value: None.
|
||||
- **low** (Tensor) - the lower bound of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the mode of the distribution.
|
||||
|
||||
.. py:method:: prob(value, high, low)
|
||||
|
||||
The probability of the given value. For the continuous distribution, it is the probability density function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **high** (Tensor) - the upper bound of the distribution. Default value: None.
|
||||
- **low** (Tensor) - the lower bound of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the probability.
|
||||
|
||||
.. py:method:: sample(shape, high, low)
|
||||
|
||||
Generate samples.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **shape** (tuple) - the shape of the tensor.
|
||||
- **high** (Tensor) - the upper bound of the distribution. Default value: None.
|
||||
- **low** (Tensor) - the lower bound of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the sample following the distribution.
|
||||
|
||||
.. py:method:: sd(high, low)
|
||||
|
||||
The standard deviation.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **high** (Tensor) - the upper bound of the distribution. Default value: None.
|
||||
- **low** (Tensor) - the lower bound of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the standard deviation of the distribution.
|
||||
|
||||
.. py:method:: survival_function(value, high, low)
|
||||
|
||||
Compute the value of the survival function.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **value** (Tensor) - the value to compute.
|
||||
- **high** (Tensor) - the upper bound of the distribution. Default value: None.
|
||||
- **low** (Tensor) - the lower bound of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the value of the survival function.
|
||||
|
||||
.. py:method:: var(high, low)
|
||||
|
||||
Compute the variance of the distribution.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **high** (Tensor) - the upper bound of the distribution. Default value: None.
|
||||
- **low** (Tensor) - the lower bound of the distribution. Default value: None.
|
||||
|
||||
**Returns**
|
||||
|
||||
Tensor, the variance of the distribution.
|
|
@ -628,7 +628,7 @@ class VocabEmbedding(Cell):
|
|||
is specified. Default: 'normal'.
|
||||
|
||||
Inputs:
|
||||
**input_ids** (Tensor) - The tokenized inputs with datatype int32 with shape (batch_size, seq_length)
|
||||
- **input_ids** (Tensor) - The tokenized inputs with datatype int32 with shape (batch_size, seq_length)
|
||||
|
||||
Outputs:
|
||||
Tuple, a tuple contains (`output`, `embedding_table`)
|
||||
|
|
Loading…
Reference in New Issue