-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Cast Operator #5149
Cast Operator #5149
Conversation
Cast input variable to other data type
PADDLE_ENFORCE(context->HasInput("X"), "The input of cast op must be set"); | ||
PADDLE_ENFORCE(context->HasOutput("Out"), | ||
"The output of cast op must be set"); | ||
context->SetOutputDim("Out", context->GetInputDim("X")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please shared lod also
paddle/operators/cast_op.h
Outdated
auto* in = context.Input<framework::Tensor>("X"); | ||
auto* out = context.Output<framework::Tensor>("Out"); | ||
framework::VisitDataType( | ||
(framework::DataType)context.Attr<int>("out_data_type"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static_cast<framework::DataType>(...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fix #5178