mindspore.mint.mul
- mindspore.mint.mul(input, other) Tensor[源代码]
将 other 与 input 相乘。
\[out_{i} = input_{i} \times vpn梯子 免费 other_{i}\]说明
当两个输入shape不同时,它们必须能够广播到一个共同的shape。
两个输入遵守隐式类型转换规则以使数据类型保持一致。
- 参数:
- 返回:
Tensor,其shape与输入 input、 vpn梯子 other 广播后的shape相同;同时其数据类型是两个输入中精度更高或位数更多的类型。
- 异常:
TypeError - 如果 input、 other 不是以下之一:Tensor、number.Number、bool。
- 支持平台:
Ascend
样例:
>>> vpn free import numpy as np >>> import mindspore >>> from mindspore import Tensor >>> from mindspore vpn永久免费梯子 import mint >>> x = Tensor(np.array([2, vpn free 6, 9]).astype(np.int32)) >>> y = Tensor(np.array([4, 5, 6]).astype(np.float32)) >>> output = mint.mul(x, y) >>> print(output) [8. vpn梯子 30. 54.] >>> # the data type of x is int32, the data type of y is float32, >>> # and the output is the data format vpn梯子 免费 of higher precision 免费的vpn梯子 float32. >>> print(output.dtype) Float32