Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
码匠许师傅
Tflite Micro
提交
b4a116f1
T
Tflite Micro
项目概览
码匠许师傅
/
Tflite Micro
11 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Tflite Micro
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
b4a116f1
编写于
6月 02, 2021
作者:
T
TFLM-bot
提交者:
GitHub
6月 02, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Automated sync from github.com/tensorflow/tensorflow (#116)
上级
8e2f711b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
78 addition
and
0 deletion
+78
-0
tensorflow/lite/kernels/internal/reference/space_to_depth.h
tensorflow/lite/kernels/internal/reference/space_to_depth.h
+78
-0
未找到文件。
tensorflow/lite/kernels/internal/reference/space_to_depth.h
0 → 100644
浏览文件 @
b4a116f1
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_SPACE_TO_DEPTH_H_
#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_SPACE_TO_DEPTH_H_
#include "tensorflow/lite/kernels/internal/types.h"
namespace
tflite
{
namespace
reference_ops
{
template
<
typename
T
>
inline
void
SpaceToDepth
(
const
tflite
::
SpaceToDepthParams
&
op_params
,
const
RuntimeShape
&
unextended_input_shape
,
const
T
*
input_data
,
const
RuntimeShape
&
unextended_output_shape
,
T
*
output_data
)
{
TFLITE_DCHECK_LE
(
unextended_input_shape
.
DimensionsCount
(),
4
);
TFLITE_DCHECK_LE
(
unextended_output_shape
.
DimensionsCount
(),
4
);
const
RuntimeShape
input_shape
=
RuntimeShape
::
ExtendedShape
(
4
,
unextended_input_shape
);
const
RuntimeShape
output_shape
=
RuntimeShape
::
ExtendedShape
(
4
,
unextended_output_shape
);
const
int
input_depth
=
input_shape
.
Dims
(
3
);
const
int
input_width
=
input_shape
.
Dims
(
2
);
const
int
input_height
=
input_shape
.
Dims
(
1
);
const
int
input_batch
=
input_shape
.
Dims
(
0
);
const
int
output_depth
=
output_shape
.
Dims
(
3
);
const
int
output_width
=
output_shape
.
Dims
(
2
);
const
int
output_height
=
output_shape
.
Dims
(
1
);
const
int
output_batch
=
output_shape
.
Dims
(
0
);
const
int32
block_size
=
op_params
.
block_size
;
TFLITE_DCHECK_EQ
(
input_width
,
output_width
*
block_size
);
TFLITE_DCHECK_EQ
(
input_height
,
output_height
*
block_size
);
TFLITE_DCHECK_EQ
(
input_depth
*
block_size
*
block_size
,
output_depth
);
TFLITE_DCHECK_EQ
(
input_batch
,
output_batch
);
for
(
int
in_b
=
0
;
in_b
<
input_batch
;
++
in_b
)
{
for
(
int
in_h
=
0
;
in_h
<
input_height
;
++
in_h
)
{
for
(
int
in_w
=
0
;
in_w
<
input_width
;
++
in_w
)
{
for
(
int
in_d
=
0
;
in_d
<
input_depth
;
++
in_d
)
{
const
int
out_d
=
in_d
+
((
in_h
%
block_size
)
*
block_size
+
in_w
%
block_size
)
*
input_depth
;
const
int
out_w
=
in_w
/
block_size
;
const
int
out_h
=
in_h
/
block_size
;
const
int
out_b
=
in_b
;
const
int
input_index
=
Offset
(
input_shape
,
in_b
,
in_h
,
in_w
,
in_d
);
const
int
output_index
=
Offset
(
output_shape
,
out_b
,
out_h
,
out_w
,
out_d
);
output_data
[
output_index
]
=
input_data
[
input_index
];
}
}
}
}
}
}
// namespace reference_ops
}
// namespace tflite
#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_SPACE_TO_DEPTH_H_
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录