未验证 提交 067cafce 编写于 作者: J Juncheng 提交者: GitHub

fix data loader mut_dptr to dptr (#3222)

Co-authored-by: NOuYang Yu <xuanjiuye@gmail.com>
上级 e6b18b1f
......@@ -38,7 +38,7 @@ class ResizeToStaticShapeKernel final : public user_op::OpKernel {
int64_t record_num = in_blob->shape().At(0);
CHECK_GT(record_num, 0);
TensorBuffer* buffers = in_blob->mut_dptr<TensorBuffer>();
const TensorBuffer* buffers = in_blob->dptr<TensorBuffer>();
uint8_t* out_dptr = out_blob->mut_dptr<uint8_t>();
const ShapeView& out_shape = out_blob->shape();
CHECK(out_shape.NumAxes() == 4); // {N, H, W, C}
......@@ -52,7 +52,7 @@ class ResizeToStaticShapeKernel final : public user_op::OpKernel {
int opencv_inter_type = GetOpencvInterp(interp_type);
MultiThreadLoop(record_num, [&](size_t i) {
TensorBuffer* buffer = buffers + i;
const TensorBuffer* buffer = buffers + i;
uint8_t* dptr = out_dptr + one_sample_elem_cnt * i;
const Shape& in_shape = buffer->shape();
CHECK(in_shape.NumAxes() == 3); // {H, W, C}
......@@ -85,12 +85,12 @@ class ResizeShorterToTensorBufferKernel final : public user_op::OpKernel {
int64_t record_num = in_blob->shape().At(0);
CHECK_GT(record_num, 0);
TensorBuffer* in_buffers = in_blob->mut_dptr<TensorBuffer>();
const TensorBuffer* in_buffers = in_blob->dptr<TensorBuffer>();
TensorBuffer* out_buffers = out_blob->mut_dptr<TensorBuffer>();
int64_t resize_shorter = ctx->Attr<int64_t>("resize_shorter");
MultiThreadLoop(record_num, [&](size_t i) {
TensorBuffer* in_buffer = in_buffers + i;
const TensorBuffer* in_buffer = in_buffers + i;
TensorBuffer* out_buffer = out_buffers + i;
const Shape& in_shape = in_buffer->shape();
CHECK_EQ(in_shape.NumAxes(), 3); // {H, W, C}
......
......@@ -68,7 +68,7 @@ class OFRecordRawDecoderKernel final : public user_op::OpKernel {
int64_t record_num = in_blob->shape().At(0);
int64_t sample_elem_cnt = out_blob->shape().Count(1);
CHECK(record_num > 0);
OFRecord* records = in_blob->mut_dptr<OFRecord>();
const OFRecord* records = in_blob->dptr<OFRecord>();
T* out_dptr = out_blob->mut_dptr<T>();
const std::string& name = ctx->Attr<std::string>("name");
......@@ -219,7 +219,7 @@ class OFRecordImageDecoderRandomCropKernel final : public user_op::OpKernel {
CHECK(record_num > 0);
user_op::Tensor* in_blob = ctx->Tensor4ArgNameAndIndex("in", 0);
CHECK_EQ(out_blob->shape(), in_blob->shape());
OFRecord* records = in_blob->mut_dptr<OFRecord>();
const OFRecord* records = in_blob->dptr<OFRecord>();
TensorBuffer* buffers = out_blob->mut_dptr<TensorBuffer>();
const std::string& name = ctx->Attr<std::string>("name");
const std::string& color_space = ctx->Attr<std::string>("color_space");
......@@ -252,7 +252,7 @@ class OFRecordImageDecoderKernel final : public user_op::OpKernel {
CHECK(record_num > 0);
user_op::Tensor* in_blob = ctx->Tensor4ArgNameAndIndex("in", 0);
CHECK_EQ(out_blob->shape(), in_blob->shape());
OFRecord* records = in_blob->mut_dptr<OFRecord>();
const OFRecord* records = in_blob->dptr<OFRecord>();
TensorBuffer* buffers = out_blob->mut_dptr<TensorBuffer>();
const std::string& name = ctx->Attr<std::string>("name");
const std::string& color_space = ctx->Attr<std::string>("color_space");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册