Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is layer's interface standard in Python API ? #8370

Closed
qingqing01 opened this issue Feb 11, 2018 · 5 comments
Closed

What is layer's interface standard in Python API ? #8370

qingqing01 opened this issue Feb 11, 2018 · 5 comments
Assignees

Comments

@qingqing01
Copy link
Contributor

qingqing01 commented Feb 11, 2018

  1. About the name:

Some interfaces have the name, some not.

def pool2d(input,
pool_size,
pool_type,
pool_stride=None,
pool_padding=None,
global_pooling=False,
use_cudnn=True,
name=None):

def conv2d(input,
num_filters,
filter_size,
stride=None,
padding=None,
groups=None,
param_attr=None,
bias_attr=None,
use_cudnn=True,
act=None):

  1. About kwargs

Some interfaces have the **kwargs, some not.

def cos_sim(X, Y, **kwargs):
"""
This function performs the cosine similarity between two tensors
X and Y and returns that as the output.
"""

def crf_decoding(input, param_attr, label=None):
helper = LayerHelper('crf_decoding', **locals())

@qingqing01 qingqing01 changed the title What is layers' interface standard in Python API ? What is layer's interface standard in Python API ? Feb 11, 2018
@JiayiFeng
Copy link
Collaborator

JiayiFeng commented Feb 11, 2018

I think we shall avoid using **kwargs in user interfaces. It makes users confused about what arguments are required exactly.

Can anyone show me any examples the **kwargs is necessary?

@qingqing01
Copy link
Contributor Author

I think we shall avoid using **kwargs in user interfaces. It makes users confused about what arguments are required exactly.

I agree with you.

@reyoung
Copy link
Collaborator

reyoung commented Feb 12, 2018

name

I was wishing the layer with the same name shared the same parameters. However, it seems that we have not implemented this feature.

We can give an easier way for two layers share the same parameters, and remove the name parameter.

**kwargs

I think we shall avoid using **kwargs in user interfaces. It makes users confused about what arguments are required exactly.
Can anyone show me any examples the **kwargs is necessary?

It because we pass the program to each layer function before. Now we change program to global variables. It is no need to use **kwargs.

@JiayiFeng
Copy link
Collaborator

Please notice that **kwargss in layer interfaces has been removed by #8405 .

@abhinavarora
Copy link
Contributor

@reyoung I was thinking that we should keep the name everywhere. What I see in the layer_helper.py that we prefix the names of the parameters with the name that is provided. I think this is very useful for debugging deep learning algorithms. For example, your model might have lots of fc layers. By giving name to layer, it is very easy to only concentrate on the parameter that you want to debug. Similarly, this will also be very useful once PaddleBoard for visualization is ready. You can visualize params from any particular layer easily if you know the name. What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants