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

Remove main_program and startup_program as the paramter of layer function #6655

Merged
merged 7 commits into from
Dec 19, 2017

Conversation

reyoung
Copy link
Collaborator

@reyoung reyoung commented Dec 15, 2017

Fix #6458

@reyoung reyoung changed the title [WIP] TriggerCI, do not need review now. Remove main_program and startup_program as the paramter of layer function Dec 16, 2017
@reyoung reyoung requested a review from JiayiFeng December 16, 2017 05:28
@@ -165,28 +156,23 @@ def __init__(self,
label=label,
chunk_scheme=chunk_scheme,
num_chunk_types=num_chunk_types,
excluded_chunk_types=excluded_chunk_types,
**kwargs)
excluded_chunk_types=excluded_chunk_types, )
Copy link
Collaborator

@JiayiFeng JiayiFeng Dec 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line 153:

kwargs = {'main_program': main_program}

should also be removed. I can not comment on unchanged line so I leave it here.

layers.sums(
input=[self.num_infer_chunks, num_infer_chunks],
out=self.num_infer_chunks,
**kwargs)
out=self.num_infer_chunks, )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not remove , ?

return default_main_program()
else:
return prog
return default_main_program()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we can change the default program, I think it's improper to keep calling it default.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe just main_program() is cool. It could be done in the following PR

avg_cost = layers.mean(x=cost)

sgd_optimizer = optimizer.SGDOptimizer(learning_rate=0.001)
sgd_optimizer.minimize(avg_cost, init_program)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this init_program?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove init_program of optimizers in the following PR.

Copy link
Collaborator

@JiayiFeng JiayiFeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@reyoung reyoung merged commit 7901f06 into PaddlePaddle:develop Dec 19, 2017
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

Successfully merging this pull request may close these issues.

2 participants