Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MindSpore
docs
提交
1a36f22d
D
docs
项目概览
MindSpore
/
docs
通知
5
Star
3
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
1a36f22d
编写于
7月 29, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
7月 29, 2020
浏览文件
操作
浏览文件
下载
差异文件
!518 add tensor visualization design document
Merge pull request !518 from wangshuide/wsd_tensor_visual_design
上级
12117747
04c047d8
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
95 addition
and
0 deletion
+95
-0
tutorials/source_zh_cn/design/mindinsight/images/tensor_histogram.png
...urce_zh_cn/design/mindinsight/images/tensor_histogram.png
+0
-0
tutorials/source_zh_cn/design/mindinsight/images/tensor_table.png
...s/source_zh_cn/design/mindinsight/images/tensor_table.png
+0
-0
tutorials/source_zh_cn/design/mindinsight/tensor_visual_design.md
...s/source_zh_cn/design/mindinsight/tensor_visual_design.md
+95
-0
未找到文件。
tutorials/source_zh_cn/design/mindinsight/images/tensor_histogram.png
0 → 100644
浏览文件 @
1a36f22d
60.1 KB
tutorials/source_zh_cn/design/mindinsight/images/tensor_table.png
0 → 100644
浏览文件 @
1a36f22d
84.3 KB
tutorials/source_zh_cn/design/mindinsight/tensor_visual_design.md
0 → 100644
浏览文件 @
1a36f22d
# 张量可视
<!-- TOC -->
-
[
张量可视
](
#张量可视
)
-
[
特性背景
](
#特性背景
)
-
[
总体设计
](
#总体设计
)
-
[
后端设计
](
#后端设计
)
-
[
前端设计
](
#前端设计
)
-
[
接口设计
](
#接口设计
)
-
[
文件接口设计
](
#文件接口设计
)
<!-- /TOC -->
## 特性背景
张量可视能够帮助用户直观查看训练过程中的Tensor值,既支持以直方图的形式呈现Tensor的变化趋势,也支持查看某次step的具体Tensor值。Tensor包括权重值、梯度值、激活值等。
## 总体设计
Tensor可视主要是解析由MindSpore的
`TensorSummary`
算子记录的Tensor数据生成的Summary文件,并把结果返回给前端展示。
MindInsight解析时会遵循proto文件(Google Protocol Buffer,是一种高效便捷的结构化数据存储方式)来解析Tensor数据,然后把数据缓存起来,在前端查询特定数据时将其返回供前端展示。
Tensor可视支持1-N维的Tensor以表格或直方图的形式展示,对于0维的Tensor,需要通过
`ScalarSummary`
来记录并在标量可视中展示。
在表格视图中,可以查询当前缓存中特定step的Tensor数据,后台通过切片操作使得用户单次可以查询任意0-2维的Tensor数据。
在直方图视图中,可以查询当前缓存中所有step的直方图数据。
### 后端设计
张量可视相关的类主要有
`TensorContainer`
、
`Histogram`
以及
`TensorProcessor`
类,其中
`TensorContainer`
用于保存Tensor的具体值、维度、数据类型、最大值、最小值、直方图等信息,这里的直方图引用了
`Histogram`
的数据。
`Histogram`
用于处理直方图相关的信息,包括保存桶个数,归一化缓存中所有step的直方图数据等。
`TensorProcessor`
用于处理与Tensor相关的HTTP请求,包括获取当前缓存中特定训练作业,特定tag有多少个step,每个step的Tensor统计信息,特定step的特定维度的Tensor数据(单次支持查询最多某两维的数据)以及特定tag的直方图数据。
### 前端设计

图1:表格展示
图1将用户所记录的张量以表格的形式展示,包含以下功能:
-
表格中白色方框显示当前展示的是哪个维度下的张量数据,其中冒号
`:`
表示当前维度的所有值,可以在方框输入对应的索引(和Python的索引含义一致,支持负值)或者
`:`
来查询特定维度的张量数据。
-
拖拽表格下方的空心圆圈可以查询特定步骤的张量数据。

图2:直方图展示
图2将用户所记录的张量以直方图的形式进行展示。
### 接口设计
在张量可视中,主要有文件接口和RESTful API接口,其中文件接口为
[
summary.proto
](
https://gitee.com/mindspore/mindspore/blob/master/mindspore/ccsrc/utils/summary.proto
)
文件,是MindInsight和MindSpore进行数据对接的接口。 RESTful API接口是MindInsight前后端进行数据交互的接口,是内部接口。
#### 文件接口设计
`summary.proto`
文件为总入口,其中张量的数据(TensorProto)存放在Summary的Value中,如下所示:
```
{
message Summary {
message Image {
// Dimensions of the image.
required int32 height = 1;
required int32 width = 2;
...
}
message Histogram {
message bucket{
// Counting number of values fallen in [left, left + width).
// For the rightmost bucket, the range is [left, left + width].
required double left = 1;
required double width = 2;
required int64 count = 3;
}
repeated bucket buckets = 1;
...
}
message Value {
// Tag name for the data.
required string tag = 1;
// Value associated with the tag.
oneof value {
float scalar_value = 3;
Image image = 4;
TensorProto tensor = 8;
Histogram histogram = 9;
}
}
// Set of values for the summary.
repeated Value value = 1;
}
```
而TensorProto的定义在
[
anf_ir.proto
](
https://gitee.com/mindspore/mindspore/blob/master/mindspore/ccsrc/utils/anf_ir.proto
)
文件中。
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录