Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion python/paddle/autograd/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from .py_layer import PyLayerContext as FunctionCtx # noqa: F401
from .py_layer import (
PyLayerContext as FunctionCtx, # noqa: F401
once_differentiable, # noqa: F401
)
5 changes: 5 additions & 0 deletions test/legacy_test/test_autograd_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,11 @@ def backward(ctx, grad_a, grad_b):
b.sum().backward()
self.assertEqual(x.grad, paddle.ones([1], dtype="float64"))

def test_once_differentiable_compatibility(self):
pyLayerObj = paddle.autograd.py_layer.once_differentiable
functionObj = paddle.autograd.function.once_differentiable
self.assertEqual(pyLayerObj, functionObj)


if __name__ == '__main__':
unittest.main()
Loading