From 2582fecaf730f2a1eb00f35a520c6f29689b7a55 Mon Sep 17 00:00:00 2001 From: tensor-tang Date: Fri, 21 Sep 2018 10:45:41 +0800 Subject: [PATCH] fix dtype --- paddle/fluid/API.spec | 32 +++++++++---------- .../fluid/layers/layer_function_generator.py | 7 ++-- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/paddle/fluid/API.spec b/paddle/fluid/API.spec index aadf3c3945..b65f890c39 100644 --- a/paddle/fluid/API.spec +++ b/paddle/fluid/API.spec @@ -267,22 +267,22 @@ paddle.fluid.layers.pow ArgSpec(args=[], varargs='args', keywords='kwargs', defa paddle.fluid.layers.stanh ArgSpec(args=[], varargs='args', keywords='kwargs', defaults=None) paddle.fluid.layers.hard_sigmoid ArgSpec(args=[], varargs='args', keywords='kwargs', defaults=None) paddle.fluid.layers.swish ArgSpec(args=[], varargs='args', keywords='kwargs', defaults=None) -paddle.fluid.layers.sigmoid ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None) -paddle.fluid.layers.logsigmoid ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None) -paddle.fluid.layers.exp ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None) -paddle.fluid.layers.tanh ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None) -paddle.fluid.layers.tanh_shrink ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None) -paddle.fluid.layers.sqrt ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None) -paddle.fluid.layers.abs ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None) -paddle.fluid.layers.ceil ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None) -paddle.fluid.layers.floor ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None) -paddle.fluid.layers.cos ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None) -paddle.fluid.layers.sin ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None) -paddle.fluid.layers.round ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None) -paddle.fluid.layers.reciprocal ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None) -paddle.fluid.layers.square ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None) -paddle.fluid.layers.softplus ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None) -paddle.fluid.layers.softsign ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None) +paddle.fluid.layers.sigmoid ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=None) +paddle.fluid.layers.logsigmoid ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=None) +paddle.fluid.layers.exp ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=None) +paddle.fluid.layers.tanh ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=None) +paddle.fluid.layers.tanh_shrink ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=None) +paddle.fluid.layers.sqrt ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=None) +paddle.fluid.layers.abs ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=None) +paddle.fluid.layers.ceil ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=None) +paddle.fluid.layers.floor ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=None) +paddle.fluid.layers.cos ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=None) +paddle.fluid.layers.sin ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=None) +paddle.fluid.layers.round ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=None) +paddle.fluid.layers.reciprocal ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=None) +paddle.fluid.layers.square ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=None) +paddle.fluid.layers.softplus ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=None) +paddle.fluid.layers.softsign ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=None) paddle.fluid.layers.uniform_random ArgSpec(args=['shape', 'dtype', 'min', 'max', 'seed'], varargs=None, keywords=None, defaults=(None, None, None, None)) paddle.fluid.layers.hard_shrink ArgSpec(args=['x', 'threshold'], varargs=None, keywords=None, defaults=(None,)) paddle.fluid.layers.cumsum ArgSpec(args=['x', 'axis', 'exclusive', 'reverse'], varargs=None, keywords=None, defaults=(None, None, None)) diff --git a/python/paddle/fluid/layers/layer_function_generator.py b/python/paddle/fluid/layers/layer_function_generator.py index 0f7a4a076a..707de171cf 100644 --- a/python/paddle/fluid/layers/layer_function_generator.py +++ b/python/paddle/fluid/layers/layer_function_generator.py @@ -220,11 +220,10 @@ def generate_layer_fn_noattr(op_type): """ op_proto = OpProtoHolder.instance().get_op_proto(op_type) - def func(x): + def func(x, name=None): helper = LayerHelper(op_type, **locals()) - output = helper.create_tmp_variable(dtype=helper.input_dtype()) - helper.append_op( - type=op_type, inputs={"X": [x]}, outputs={"Out": [output]}) + output = helper.create_tmp_variable(dtype=x.dtype) + helper.append_op(type=op_type, inputs={"X": x}, outputs={"Out": output}) return output func.__name__ = op_type -- GitLab