提交 7129c649 编写于 作者: J juncaipeng

Add fp32 to uint8 cast, test=develop

上级 4d68af14
...@@ -83,6 +83,11 @@ void CastCompute::Run() { ...@@ -83,6 +83,11 @@ void CastCompute::Run() {
int64_t* out_data = param.Out->mutable_data<int64_t>(); int64_t* out_data = param.Out->mutable_data<int64_t>();
std::transform( std::transform(
x_data_begin, x_data_end, out_data, TransOp<int32_t, int64_t>); x_data_begin, x_data_end, out_data, TransOp<int32_t, int64_t>);
} else if (param.in_dtype == 5 && param.out_dtype == 20) { // FP32 -> UINT8
const float* x_data_begin = param.X->data<float>();
const float* x_data_end = x_data_begin + param.X->numel();
uint8_t* out_data = param.Out->mutable_data<uint8_t>();
std::transform(x_data_begin, x_data_end, out_data, TransOp<float, uint8_t>);
} else { } else {
LOG(FATAL) << "other has not been implemented transform with dtype" LOG(FATAL) << "other has not been implemented transform with dtype"
<< param.in_dtype << " X, dtype" << param.out_dtype << " Out"; << param.in_dtype << " X, dtype" << param.out_dtype << " Out";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册