GradientTape¶
- class dragon.GradientTape(persistent=False)[source]¶
- Record the operations for auto differentiation. - You should enter a tape before the execution performed: - with dragon.eager_mode(): x = dragon.ones(shape=(2, 3)) with dragon.GradientTape() as tape: y = x + 1 print(tape.gradient(y, x)) # None, as ``x`` is not watched with dragon.GradientTape() as tape: tape.watch(x) y = x + 1 print(tape.gradient(y, x)) # Ok 
