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

Support uniform api and sigmoid api in new AD #46960

Merged
merged 7 commits into from
Oct 19, 2022

Conversation

Charles-hit
Copy link
Contributor

@Charles-hit Charles-hit commented Oct 12, 2022

PR types

New features

PR changes

OPs

Describe

Add uniform_random_p autograd primitive op and support orig2prim for paddle original uniform_random op and sigmoidop.

@paddle-bot
Copy link

paddle-bot bot commented Oct 12, 2022

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

max_value = op.attr('max')
seed = op.attr('seed')
dtype = convert_np_dtype_to_dtype_(
convert_dtype(INT_DTYPE_2_STRING[op.attr('dtype')]))
Copy link
Contributor

Choose a reason for hiding this comment

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

paddle.dtype(op.attr('dtype'))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

seed,
shape=op.attr('shape'),
shape_t=None,
shape_tl=None)
Copy link
Contributor

Choose a reason for hiding this comment

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

此处不用写三个分支,shape_tl/shape_t不存在同时不为None的情况,直接返回就行

    return uniform_random(dtype,
                          min_value,
                          max_value,
                          seed,
                          shape=op.attr('shape'),
                          shape_t=shape_t,
                          shape_tl=shape_tl)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

@JiabinYang JiabinYang left a comment

Choose a reason for hiding this comment

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

some comments

class UniformRandomPrimOpShapeInference : public framework::InferShapeBase {
public:
void operator()(framework::InferShapeContext *ctx) const override {
// framework::InferShapeVarPtr y_var_ptr = ctx->GetOutputVarPtrs("Y")[0];
Copy link
Contributor

Choose a reason for hiding this comment

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

remove useless code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

class UniformRandomPrimOpMaker : public framework::OpProtoAndCheckerMaker {
public:
void Make() override {
AddInput("ShapeTensor",
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this cause dynamic shape error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes,it has been deleted.

@Charles-hit Charles-hit changed the title Support uniform api in new AD Support uniform api and sigmoid api in new AD Oct 14, 2022
Copy link
Contributor

@cxxly cxxly left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@JiabinYang JiabinYang left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@XiaoguangHu01 XiaoguangHu01 left a comment

Choose a reason for hiding this comment

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

LGTM

@JiabinYang JiabinYang merged commit af4bded into PaddlePaddle:develop Oct 19, 2022
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.

4 participants