From c645d23519294c8009cf2a22f5fae131c9693634 Mon Sep 17 00:00:00 2001 From: liuwei1031 <46661762+liuwei1031@users.noreply.github.com> Date: Fri, 17 Apr 2020 15:52:42 +0800 Subject: [PATCH] improve efficiency of dot op in dygraph mode (#23856) * improve efficiency of dot op in dygraph mode * add comments for dot op for dygraph behavior --- python/paddle/tensor/linalg.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/python/paddle/tensor/linalg.py b/python/paddle/tensor/linalg.py index 2403dc76699..c3ccb43e90f 100644 --- a/python/paddle/tensor/linalg.py +++ b/python/paddle/tensor/linalg.py @@ -440,6 +440,11 @@ def dot(x, y, name=None): """ op_type = 'dot' + # skip var type check in dygraph mode to improve efficiency + if in_dygraph_mode(): + op = getattr(core.ops, op_type) + return op(x, y) + assert x is not None, 'x cannot be None in {}'.format(op_type) assert y is not None, 'y cannot be None in {}'.format(op_type) -- GitLab