From 900003273931a3a250855c8ce176b48d20f6a0df Mon Sep 17 00:00:00 2001 From: zengzitao Date: Tue, 5 Jul 2022 08:58:34 +0800 Subject: [PATCH] fix gather docs on master --- .../api_python/mindspore/mindspore.Tensor.rst | 2 +- mindspore/python/mindspore/common/tensor.py | 25 ++++++------------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/docs/api/api_python/mindspore/mindspore.Tensor.rst b/docs/api/api_python/mindspore/mindspore.Tensor.rst index ed04d42ec13..f5cebaaad26 100644 --- a/docs/api/api_python/mindspore/mindspore.Tensor.rst +++ b/docs/api/api_python/mindspore/mindspore.Tensor.rst @@ -500,7 +500,7 @@ mindspore.Tensor .. py:method:: gather(input_indices, axis) - 返回指定 `axis` 上 `input_indices` 的元素对应的输入Tensor切片。为了方便描述,对于输入Tensor记为 `input_params`。 + 返回指定 `axis` 上 `input_indices` 的元素对应的输入Tensor切片,输入Tensor的形状是 :math:`(x_1, x_2, ..., x_R)`。为了方便描述,对于输入Tensor记为 `input_params`。 .. note:: 1. input_indices 的值必须在 `[0, input_params.shape[axis])` 的范围内,结果未定义超出范围。 diff --git a/mindspore/python/mindspore/common/tensor.py b/mindspore/python/mindspore/common/tensor.py index b59810829a7..45de53fbf37 100644 --- a/mindspore/python/mindspore/common/tensor.py +++ b/mindspore/python/mindspore/common/tensor.py @@ -1184,7 +1184,6 @@ class Tensor(Tensor_): tensor_operator_registry.get('__sub__')(input_x, input_y) ), tolerance) - def matrix_determinant(self): """ Computes the determinant of one or more square matrices. @@ -3277,19 +3276,13 @@ class Tensor(Tensor_): The shape of input tensor is :math:`(x_1, x_2, ..., x_R)`. For convenience, define it as `input_params`, the variable `input_params` refers to input tensor. - The following figure shows the calculation process of Gather commonly: - - .. image:: Gather.png - - where params represents the input `input_params`, and indices represents the index to be sliced `input_indices`. - - .. note:: + Note: 1.The value of `input_indices` must be in the range of `[0, input_param.shape[axis])`, the result - is undefined out of range. + is undefined out of range. 2.The data type of `input_params` cannot be - `bool_ `_ on Ascend - platform currently. + `bool_ `_ on Ascend + platform currently. Args: input_indices (Tensor): Index tensor to be sliced, the shape of tensor is :math:`(y_1, y_2, ..., y_S)`. @@ -4301,7 +4294,6 @@ class Tensor(Tensor_): validator.check_is_int(seed2, 'seed2') return tensor_operator_registry.get('standard_laplace')(seed=seed, seed2=seed2)(self.shape) - def xlogy(self, y): r""" Computes the first input tensor multiplied by the logarithm of second input tensor element-wise. @@ -4345,7 +4337,6 @@ class Tensor(Tensor_): """ return tensor_operator_registry.get("xlogy")()(self, y) - def erf(self): r""" Computes the Gauss error function of self tensor element-wise. @@ -4371,7 +4362,6 @@ class Tensor(Tensor_): """ return tensor_operator_registry.get("erf")()(self) - def erfc(self): r""" Computes the complementary error function of self tensor element-wise. @@ -4657,8 +4647,8 @@ class COOTensor(COOTensor_): ``GPU`` """ shape = Tensor(self.shape) - res_indices, res_values, _ = tensor_operator_registry.get("coalesce")(self.indices.transpose(), \ - self.values, shape) + res_indices, res_values, _ = tensor_operator_registry.get("coalesce")(self.indices.transpose(), + self.values, shape) return COOTensor(res_indices.transpose(), res_values, self.shape) def to_csr(self): @@ -5026,7 +5016,7 @@ class CSRTensor(CSRTensor_): [1. 2.]] """ validator.check_value_type('dense_matrix', dense_matrix, (Tensor_,), 'CSRTensor.mm') - return tensor_operator_registry.get("csr_mm")()(self.indptr, self.indices, self.values, \ + return tensor_operator_registry.get("csr_mm")()(self.indptr, self.indices, self.values, self.shape, dense_matrix) def sum(self, axis): @@ -5141,4 +5131,5 @@ def _check_astype_and_convert(dtype): f" but got '{dtype}'.") return dtype + tensor_operator_registry.register('vm_compare', _vm_compare)