Avoid evaluating SaveSpec Tensors multiple times when executing eagerly
authorAllen Lavoie <allenl@google.com>
Thu, 29 Mar 2018 19:58:43 +0000 (12:58 -0700)
committerTensorFlower Gardener <gardener@tensorflow.org>
Thu, 29 Mar 2018 20:00:56 +0000 (13:00 -0700)
commitd9e5f2754cabd9680d5481464a4085e79856eb78
treeee1ee8e98a0ce29d69b6e25657f75ebad10c2597
parente58e4c754fa6145af2a411b940d8f7347a071b6f
Avoid evaluating SaveSpec Tensors multiple times when executing eagerly

The Saver now calls a SaveSpec callable once when saving and not at all when restoring. Previously saving evaluated the callable twice and restoring once (copying a variable's value each time).

Requires a dtype be passed to a SaveSpec if its tensor is callable.

PiperOrigin-RevId: 190972754
tensorflow/python/training/saver.py
tensorflow/python/training/saver_test.py