From 777a281a4fa00b8975ae85aa0fbec39a0cac4ac0 Mon Sep 17 00:00:00 2001 From: Yu Yang Date: Mon, 26 Feb 2018 10:48:53 +0800 Subject: [PATCH] Fix CI and enhance gitignore --- .gitignore | 1 - python/paddle/fluid/.gitignore | 1 + python/paddle/fluid/layers/layer_function_generator.py | 8 ++++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index fe0d13f4d9e..2badc3bdaa5 100644 --- a/.gitignore +++ b/.gitignore @@ -27,7 +27,6 @@ third_party/ cmake-build-* # generated while compiling -python/paddle/v2/fluid/core.so paddle/pybind/pybind.h CMakeFiles cmake_install.cmake diff --git a/python/paddle/fluid/.gitignore b/python/paddle/fluid/.gitignore index 2ff540d5764..80c1cf3fcb8 100644 --- a/python/paddle/fluid/.gitignore +++ b/python/paddle/fluid/.gitignore @@ -1 +1,2 @@ proto +core.so diff --git a/python/paddle/fluid/layers/layer_function_generator.py b/python/paddle/fluid/layers/layer_function_generator.py index 16a401dc7bf..bd79022a0c3 100644 --- a/python/paddle/fluid/layers/layer_function_generator.py +++ b/python/paddle/fluid/layers/layer_function_generator.py @@ -130,7 +130,7 @@ def generate_layer_fn(op_type): o_name = not_intermediate_outputs[0].name intermediate_output_names = [output.name for output in intermediate_outputs] - def infer_and_check_dtype(op_proto, **kwargs): + def infer_and_check_dtype(op_proto, *args, **kwargs): """ This function performs the sanity check for dtype and instance type. @@ -141,6 +141,10 @@ def generate_layer_fn(op_type): val = kwargs.pop(name, []) if not isinstance(val, list) and not isinstance(val, tuple): val = [val] + if len(val) == 0: + val = [args[0]] + args = args[1:] + for each in val: if not isinstance(each, Variable): raise ValueError("input of {0} must be variable".format( @@ -158,7 +162,7 @@ def generate_layer_fn(op_type): def func(*args, **kwargs): helper = LayerHelper(op_type, **kwargs) - dtype = infer_and_check_dtype(op_proto, **kwargs) + dtype = infer_and_check_dtype(op_proto, *args, **kwargs) inputs = dict() for ipt in op_proto.inputs: -- GitLab