You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

mindspore.nn.Vjp.rst 1.0 kB

123456789101112131415161718192021222324252627282930313233
  1. mindspore.nn.Vjp
  2. =================
  3. .. py:class:: mindspore.nn.Vjp(fn)
  4. ſɱȻ(vector-Jacobian product, VJP)VJPӦģʽԶ΢֡
  5. ****
  6. **fn** (Cell) - Cell磬ڽ벢Ԫ顣
  7. **룺**
  8. - **inputs** (Tensor) - Σ
  9. - **v** (Tensor or Tuple of Tensor) - ſɱȾ˵״һ¡
  10. ****
  11. 2Ԫ鹹ɵԪ顣
  12. - **net_output** (Tensor or Tuple of Tensor) -
  13. - **vjp** (Tensor or Tuple of Tensor) - ſɱȻĽ
  14. ****
  15. >>> from mindspore.nn import Vjp
  16. >>> class Net(nn.Cell):
  17. ... def construct(self, x, y):
  18. ... return x**3 + y
  19. >>> x = Tensor(np.array([[1, 2], [3, 4]]).astype(np.float32))
  20. >>> y = Tensor(np.array([[1, 2], [3, 4]]).astype(np.float32))
  21. >>> v = Tensor(np.array([[1, 1], [1, 1]]).astype(np.float32))
  22. >>> output = Vjp(Net())(x, y, v)