Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
NiuTrans.Tensor
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
杨迪
NiuTrans.Tensor
Commits
f8c57160
Commit
f8c57160
authored
Dec 18, 2018
by
xiaotong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace XLink::ShowNetwork with XNet::SHowNetwork
parent
31d989e9
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
29 行增加
和
21 行删除
+29
-21
source/network/Main.cpp
+1
-1
source/network/XNet.cpp
+22
-0
source/network/XNet.h
+3
-0
source/sample/transformer/T2TTrainer.cpp
+2
-0
source/tensor/Main.cpp
+1
-1
source/tensor/XLink.cpp
+0
-15
source/tensor/XLink.h
+0
-4
没有找到文件。
source/network/Main.cpp
查看文件 @
f8c57160
...
@@ -89,7 +89,7 @@ void BackwardTest()
...
@@ -89,7 +89,7 @@ void BackwardTest()
c
=
DivDim
(
a
,
b
,
0
);
c
=
DivDim
(
a
,
b
,
0
);
c
.
Dump
(
stderr
,
"c:"
);
c
.
Dump
(
stderr
,
"c:"
);
XLink
::
ShowNetwork
(
stderr
,
&
c
);
//
XLink::ShowNetwork(stderr, &c);
net
.
Backward
(
c
);
net
.
Backward
(
c
);
...
...
source/network/XNet.cpp
查看文件 @
f8c57160
...
@@ -437,4 +437,25 @@ void XNet::ClearGrad(XTensor * node)
...
@@ -437,4 +437,25 @@ void XNet::ClearGrad(XTensor * node)
}
}
}
}
/*
show network topology
>> file - file to dump information
>> node - pointer to the node
*/
void
XNet
::
ShowNetwork
(
FILE
*
file
,
XTensor
*
node
)
{
XList
roots
(
1
);
roots
.
Add
(
node
);
Traverse
(
roots
);
XLink
::
ShowNode
(
file
,
node
);
/* go over nodes in its topological order */
for
(
int
i
=
nodes
.
count
-
1
;
i
>=
0
;
i
--
){
XTensor
*
n
=
(
XTensor
*
)
nodes
.
Get
(
i
);
XLink
::
ShowNode
(
file
,
n
);
}
}
}
}
\ No newline at end of file
source/network/XNet.h
查看文件 @
f8c57160
...
@@ -108,6 +108,9 @@ struct XNet
...
@@ -108,6 +108,9 @@ struct XNet
/* clear the graident information if the node is no use */
/* clear the graident information if the node is no use */
void
ClearGrad
(
XTensor
*
node
);
void
ClearGrad
(
XTensor
*
node
);
/* show network topology */
void
ShowNetwork
(
FILE
*
file
,
XTensor
*
node
);
};
};
/* we make a unique id for every tensor */
/* we make a unique id for every tensor */
...
...
source/sample/transformer/T2TTrainer.cpp
查看文件 @
f8c57160
...
@@ -213,6 +213,8 @@ void T2TTrainer::Train(const char * fn, const char * validFN, const char * model
...
@@ -213,6 +213,8 @@ void T2TTrainer::Train(const char * fn, const char * validFN, const char * model
ShowNTErrors
(
"Illegal model type!"
);
ShowNTErrors
(
"Illegal model type!"
);
}
}
net
.
ShowNetwork
(
stderr
,
&
output
);
/* back-propagation for obtaining gradients */
/* back-propagation for obtaining gradients */
if
(
labelSmoothingP
>
0
)
if
(
labelSmoothingP
>
0
)
LabelSmooth
(
&
gold
,
&
goldSmoothed
,
labelSmoothingP
);
LabelSmooth
(
&
gold
,
&
goldSmoothed
,
labelSmoothingP
);
...
...
source/tensor/Main.cpp
查看文件 @
f8c57160
...
@@ -126,7 +126,7 @@ void SmallTest()
...
@@ -126,7 +126,7 @@ void SmallTest()
d
=
a
+
b
+
c
.
Lin
(
0.5
F
);
d
=
a
+
b
+
c
.
Lin
(
0.5
F
);
XLink
::
CheckNetwork
(
&
d
);
XLink
::
CheckNetwork
(
&
d
);
XLink
::
ShowNetwork
(
stderr
,
&
d
);
//
XLink::ShowNetwork(stderr, &d);
a
.
Dump
(
stderr
,
"a:"
);
a
.
Dump
(
stderr
,
"a:"
);
b
.
Dump
(
stderr
,
"b:"
);
b
.
Dump
(
stderr
,
"b:"
);
...
...
source/tensor/XLink.cpp
查看文件 @
f8c57160
...
@@ -593,21 +593,6 @@ void XLink::CheckNetwork(XTensor * root)
...
@@ -593,21 +593,6 @@ void XLink::CheckNetwork(XTensor * root)
}
}
/*
/*
show the network encoded in a root node (tensor)
>> file - file to dump information
>> root - pointer to the root node
*/
void
XLink
::
ShowNetwork
(
FILE
*
file
,
XTensor
*
root
)
{
XLink
&
income
=
root
->
income
;
for
(
int
i
=
0
;
i
<
income
.
tailNum
;
i
++
){
XTensor
*
child
=
income
.
tails
[
i
];
ShowNetwork
(
file
,
child
);
}
}
/*
show a node
show a node
>> file - file to dump information
>> file - file to dump information
>> root - pointer to the node
>> root - pointer to the node
...
...
source/tensor/XLink.h
查看文件 @
f8c57160
...
@@ -178,10 +178,6 @@ struct XLink
...
@@ -178,10 +178,6 @@ struct XLink
static
static
void
CheckNetwork
(
XTensor
*
root
);
void
CheckNetwork
(
XTensor
*
root
);
/* show the network encoded in a root node (tensor) */
static
void
ShowNetwork
(
FILE
*
file
,
XTensor
*
root
);
/* show a node */
/* show a node */
static
static
void
ShowNode
(
FILE
*
file
,
XTensor
*
node
);
void
ShowNode
(
FILE
*
file
,
XTensor
*
node
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论