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.
|
- import numpy as np
-
- import megengine as mge
- from megengine import autodiff as ad
-
-
- def test_attach_in_with_block():
- a = mge.Parameter([1.0])
- g = ad.GradManager()
- with g:
- b = a * 3
- g.attach(b)
- c = b + 1
- g.backward(c)
- assert int(b.grad.numpy()) == 1
|