Skip to content

Cast Operator#5149

Merged
reyoung merged 4 commits intoPaddlePaddle:developfrom
reyoung:feature/tensor_apply_visitor
Oct 28, 2017
Merged

Cast Operator#5149
reyoung merged 4 commits intoPaddlePaddle:developfrom
reyoung:feature/tensor_apply_visitor

Conversation

@reyoung
Copy link
Collaborator

@reyoung reyoung commented Oct 27, 2017

Fix #5178

Cast input variable to other data type
@reyoung reyoung changed the title [WIP] Cast Operator Oct 27, 2017
@reyoung reyoung requested review from JiayiFeng and QiJune October 27, 2017 19:39
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"));
Copy link
Member

Choose a reason for hiding this comment

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

Please shared lod also

auto* in = context.Input<framework::Tensor>("X");
auto* out = context.Output<framework::Tensor>("Out");
framework::VisitDataType(
(framework::DataType)context.Attr<int>("out_data_type"),
Copy link
Member

Choose a reason for hiding this comment

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

static_cast<framework::DataType>(...)

Copy link
Member

@QiJune QiJune 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 b84e822 into PaddlePaddle:develop Oct 28, 2017
@reyoung reyoung deleted the feature/tensor_apply_visitor branch December 26, 2017 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants