mindsponge.common.vecs_sub
- mindsponge.common.vecs_sub(v1, v2)[源代码]
对两个向量执行减法操作。
- 参数:
v1 (Tuple) - 输入向量1
其中x, y, z为标量或Tensor,若为Tensor其shape相同。v2 (Tuple) - 输入向量2,tuple长度为3,其中每个元素shape与v1相同。
- 返回:
Tuple,长度为3,
,其中x’, y’, z’为Tensor,且shape与v1相同。- 支持平台:
Ascend
GPU
CPU
样例:
>>> import numpy as np >>> from mindspore import Tensor >>> from mindspore import dtype as mstype >>> from mindsponge.common.geometry import vecs_sub >>> x= Tensor(np.ones(256), mstype.float32) >>> y= Tensor(np.ones(256), mstype.float32) >>> z= Tensor(np.ones(256), mstype.float32) >>> result=vecs_sub((x,y,z),(x,y,z)) >>> print(len(result)) >>> print(result[0].shape) >>> print(result[1].shape) >>> print(result[2].shape) 3 (256,) (256,) (256,)