From 0fd1281ef8fd85f4fe1f1785b898ee4da06ddd04 Mon Sep 17 00:00:00 2001 From: Yi Liu Date: Fri, 22 Nov 2019 09:33:00 +0800 Subject: [PATCH] fix bug of issue #21259 (#21287) pass the argument `allow_out_of_range` of one_hot op to c++ back end. --- python/paddle/fluid/layers/nn.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index bbb3b9a3d23..f2ba117db14 100644 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -5244,16 +5244,16 @@ def one_hot(input, depth, allow_out_of_range=False): if in_dygraph_mode(): inputs = {'X': input} - attrs = {'depth': depth} + attrs = {'depth': depth, 'allow_out_of_range': allow_out_of_range} else: if not isinstance(depth, Variable): # user attribute inputs = {'X': input} - attrs = {'depth': depth} + attrs = {'depth': depth, 'allow_out_of_range': allow_out_of_range} else: depth.stop_gradient = True inputs = {'X': input, 'depth_tensor': depth} - attrs = {} + attrs = {'allow_out_of_range': allow_out_of_range} helper.append_op( type="one_hot", inputs=inputs, -- GitLab