Skip to content

Conversation

@qingqing01
Copy link
Contributor

Fix #4215

@lcy-seso
Copy link
Contributor

Copy link
Collaborator

@reyoung reyoung left a comment

Choose a reason for hiding this comment

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

I do not think bool is needed because it could be simulated by int.


auto dims = ctx.Input<Tensor>("X")->dims();
ctx.Output<LoDTensor>("Out")->Resize(dims);
if (ctx.Attr<int>("is_training") == 1) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually, zero is false, and non-zero is true.

AddAttr<AttrType>("dropout_prob", "Probability of setting units to zero.")
.SetDefault(.5f);
// TODO(xinghai-sun): use bool for is_training after bool is supported.
AddAttr<int>("is_training", "Whether in training phase.").SetDefault(1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

SetDefault(true)

@reyoung
Copy link
Collaborator

reyoung commented Sep 20, 2017

Please reference #4239

reyoung
reyoung previously approved these changes Sep 21, 2017
Copy link
Contributor

@lcy-seso lcy-seso left a comment

Choose a reason for hiding this comment

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

LGTM, thank you.

@qingqing01 qingqing01 merged commit d35417e into PaddlePaddle:develop Sep 22, 2017
@qingqing01 qingqing01 deleted the attr_bool branch November 14, 2019 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants