Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Oneflow-Inc
oneflow
提交
067cafce
O
oneflow
项目概览
Oneflow-Inc
/
oneflow
上一次同步 接近 3 年
通知
13
Star
2733
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oneflow
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
067cafce
编写于
7月 17, 2020
作者:
J
Juncheng
提交者:
GitHub
7月 17, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix data loader mut_dptr to dptr (#3222)
Co-authored-by:
N
OuYang Yu
<
xuanjiuye@gmail.com
>
上级
e6b18b1f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
7 addition
and
7 deletion
+7
-7
oneflow/customized/kernels/image_preprocess_kernels.cpp
oneflow/customized/kernels/image_preprocess_kernels.cpp
+4
-4
oneflow/customized/kernels/ofrecord_decoder_kernels.cpp
oneflow/customized/kernels/ofrecord_decoder_kernels.cpp
+3
-3
未找到文件。
oneflow/customized/kernels/image_preprocess_kernels.cpp
浏览文件 @
067cafce
...
@@ -38,7 +38,7 @@ class ResizeToStaticShapeKernel final : public user_op::OpKernel {
...
@@ -38,7 +38,7 @@ class ResizeToStaticShapeKernel final : public user_op::OpKernel {
int64_t
record_num
=
in_blob
->
shape
().
At
(
0
);
int64_t
record_num
=
in_blob
->
shape
().
At
(
0
);
CHECK_GT
(
record_num
,
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
>
();
uint8_t
*
out_dptr
=
out_blob
->
mut_dptr
<
uint8_t
>
();
const
ShapeView
&
out_shape
=
out_blob
->
shape
();
const
ShapeView
&
out_shape
=
out_blob
->
shape
();
CHECK
(
out_shape
.
NumAxes
()
==
4
);
// {N, H, W, C}
CHECK
(
out_shape
.
NumAxes
()
==
4
);
// {N, H, W, C}
...
@@ -52,7 +52,7 @@ class ResizeToStaticShapeKernel final : public user_op::OpKernel {
...
@@ -52,7 +52,7 @@ class ResizeToStaticShapeKernel final : public user_op::OpKernel {
int
opencv_inter_type
=
GetOpencvInterp
(
interp_type
);
int
opencv_inter_type
=
GetOpencvInterp
(
interp_type
);
MultiThreadLoop
(
record_num
,
[
&
](
size_t
i
)
{
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
;
uint8_t
*
dptr
=
out_dptr
+
one_sample_elem_cnt
*
i
;
const
Shape
&
in_shape
=
buffer
->
shape
();
const
Shape
&
in_shape
=
buffer
->
shape
();
CHECK
(
in_shape
.
NumAxes
()
==
3
);
// {H, W, C}
CHECK
(
in_shape
.
NumAxes
()
==
3
);
// {H, W, C}
...
@@ -85,12 +85,12 @@ class ResizeShorterToTensorBufferKernel final : public user_op::OpKernel {
...
@@ -85,12 +85,12 @@ class ResizeShorterToTensorBufferKernel final : public user_op::OpKernel {
int64_t
record_num
=
in_blob
->
shape
().
At
(
0
);
int64_t
record_num
=
in_blob
->
shape
().
At
(
0
);
CHECK_GT
(
record_num
,
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
>
();
TensorBuffer
*
out_buffers
=
out_blob
->
mut_dptr
<
TensorBuffer
>
();
int64_t
resize_shorter
=
ctx
->
Attr
<
int64_t
>
(
"resize_shorter"
);
int64_t
resize_shorter
=
ctx
->
Attr
<
int64_t
>
(
"resize_shorter"
);
MultiThreadLoop
(
record_num
,
[
&
](
size_t
i
)
{
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
;
TensorBuffer
*
out_buffer
=
out_buffers
+
i
;
const
Shape
&
in_shape
=
in_buffer
->
shape
();
const
Shape
&
in_shape
=
in_buffer
->
shape
();
CHECK_EQ
(
in_shape
.
NumAxes
(),
3
);
// {H, W, C}
CHECK_EQ
(
in_shape
.
NumAxes
(),
3
);
// {H, W, C}
...
...
oneflow/customized/kernels/ofrecord_decoder_kernels.cpp
浏览文件 @
067cafce
...
@@ -68,7 +68,7 @@ class OFRecordRawDecoderKernel final : public user_op::OpKernel {
...
@@ -68,7 +68,7 @@ class OFRecordRawDecoderKernel final : public user_op::OpKernel {
int64_t
record_num
=
in_blob
->
shape
().
At
(
0
);
int64_t
record_num
=
in_blob
->
shape
().
At
(
0
);
int64_t
sample_elem_cnt
=
out_blob
->
shape
().
Count
(
1
);
int64_t
sample_elem_cnt
=
out_blob
->
shape
().
Count
(
1
);
CHECK
(
record_num
>
0
);
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
>
();
T
*
out_dptr
=
out_blob
->
mut_dptr
<
T
>
();
const
std
::
string
&
name
=
ctx
->
Attr
<
std
::
string
>
(
"name"
);
const
std
::
string
&
name
=
ctx
->
Attr
<
std
::
string
>
(
"name"
);
...
@@ -219,7 +219,7 @@ class OFRecordImageDecoderRandomCropKernel final : public user_op::OpKernel {
...
@@ -219,7 +219,7 @@ class OFRecordImageDecoderRandomCropKernel final : public user_op::OpKernel {
CHECK
(
record_num
>
0
);
CHECK
(
record_num
>
0
);
user_op
::
Tensor
*
in_blob
=
ctx
->
Tensor4ArgNameAndIndex
(
"in"
,
0
);
user_op
::
Tensor
*
in_blob
=
ctx
->
Tensor4ArgNameAndIndex
(
"in"
,
0
);
CHECK_EQ
(
out_blob
->
shape
(),
in_blob
->
shape
());
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
>
();
TensorBuffer
*
buffers
=
out_blob
->
mut_dptr
<
TensorBuffer
>
();
const
std
::
string
&
name
=
ctx
->
Attr
<
std
::
string
>
(
"name"
);
const
std
::
string
&
name
=
ctx
->
Attr
<
std
::
string
>
(
"name"
);
const
std
::
string
&
color_space
=
ctx
->
Attr
<
std
::
string
>
(
"color_space"
);
const
std
::
string
&
color_space
=
ctx
->
Attr
<
std
::
string
>
(
"color_space"
);
...
@@ -252,7 +252,7 @@ class OFRecordImageDecoderKernel final : public user_op::OpKernel {
...
@@ -252,7 +252,7 @@ class OFRecordImageDecoderKernel final : public user_op::OpKernel {
CHECK
(
record_num
>
0
);
CHECK
(
record_num
>
0
);
user_op
::
Tensor
*
in_blob
=
ctx
->
Tensor4ArgNameAndIndex
(
"in"
,
0
);
user_op
::
Tensor
*
in_blob
=
ctx
->
Tensor4ArgNameAndIndex
(
"in"
,
0
);
CHECK_EQ
(
out_blob
->
shape
(),
in_blob
->
shape
());
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
>
();
TensorBuffer
*
buffers
=
out_blob
->
mut_dptr
<
TensorBuffer
>
();
const
std
::
string
&
name
=
ctx
->
Attr
<
std
::
string
>
(
"name"
);
const
std
::
string
&
name
=
ctx
->
Attr
<
std
::
string
>
(
"name"
);
const
std
::
string
&
color_space
=
ctx
->
Attr
<
std
::
string
>
(
"color_space"
);
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录