megengine.functional.sub

sub(x, y)[源代码]

Element-wise sub.

实际案例

import numpy as np
from megengine import tensor
import megengine.functional as F

x = tensor(np.arange(1, 7, dtype=np.float32).reshape(2, 3))
y = tensor(np.arange(0, 6, dtype=np.float32).reshape(2, 3))
out = F.sub(x, y)
print(out.numpy())

Outputs:

[[1. 1. 1.]
 [1. 1. 1.]]