Make first order gradient graphs more efficient (#5959)
authorThomas Viehmann <tv.code@beamnet.de>
Tue, 30 Jun 2020 15:48:44 +0000 (17:48 +0200)
committerGitHub <noreply@github.com>
Tue, 30 Jun 2020 15:48:44 +0000 (08:48 -0700)
commit717648370c386c8df03ca1f71120866806a7489d
tree7a72258459fa8c9783ee404df752e8932cda575a
parentbc22fb9dd9edaec263bcfa03290ad1d963ce3f56
Make first order gradient graphs more efficient (#5959)

Previously, nodes are visited as often as they are used and each time a
derivative is computed. Only at the leaves were the contributions of
everything added. This patch changes this to add at any node that is
used several times.
python/tvm/relay/testing/__init__.py
src/relay/transforms/gradient.cc
tests/python/relay/test_pass_gradient.py