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
116dfee7
Commit
116dfee7
authored
Jul 04, 2018
by
xiaotong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add XLink
parent
8eb004f7
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
121 行增加
和
12 行删除
+121
-12
XLink.cpp
+30
-0
XLink.h
+66
-0
source/XBLAS.h
+2
-3
source/XTensor.h
+23
-9
没有找到文件。
XLink.cpp
0 → 100644
查看文件 @
116dfee7
/* NiuTrans.Tensor - an open-source tensor library
* Copyright (C) 2018, Natural Language Processing Lab, Northestern University.
* 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.
*/
/*
* some public functions are defined here
* $Created by: XIAO Tong (xiaotong@mail.neu.edu.cn) 2018-07-04
*
*/
#include <stdio.h>
#include "XLink.h"
namespace
nts
{
// namespace nts(NiuTrans.Tensor)
}
// namespace nts(NiuTrans.Tensor)
XLink.h
0 → 100644
查看文件 @
116dfee7
/* NiuTrans.Tensor - an open-source tensor library
* Copyright (C) 2018, Natural Language Processing Lab, Northestern University.
* 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.
*/
/*
* some public functions are defined here
* $Created by: XIAO Tong (xiaotong@mail.neu.edu.cn) 2018-07-04
*
*/
#include <stdio.h>
#include "XGlobal.h"
#include "XTensor.h"
#ifndef __XLINK_H__
#define __XLINK_H__
namespace
nts
{
// namespace nts(NiuTrans.Tensor)
/* cross reference */
struct
XTensor
;
/*
This defines the link among tensors in networks. XLink can be
cast as a hyperedge in a graph. when we compute on tensors, we actually create a
network where nodes are tensors and edges the connections among them. Each connection is
a hyperedge whose head is the output tensor and tails are input tensors. E.g,
c = a + b
represents a network with three nodes (a, b and c) and a hyperedge that links a and b (tails) to c (head).
+ (=c)
/ \
a b
for c, we have a incoming edge (a, b) -> c
for a, we also have a edge c -> a in the reverse order (in a view of acyclic directed graphs)
*/
struct
XLink
{
/* head of the hyperedge */
XTensor
*
head
;
/* tails of the hyperedge ∂*/
XTensor
*
tails
[];
XLink
(){};
~
XLink
(){};
};
}
// namespace nts(NiuTrans.Tensor)
#endif // __XLINK_H__
source/XBLAS.h
查看文件 @
116dfee7
...
...
@@ -12,7 +12,7 @@
* 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.
* limitations under the License.
b
*/
/*
...
...
@@ -206,4 +206,4 @@ extern void UnloadBLAS();
}
/* end of the nts (NiuTrans.Tensor) namespace */
#endif
\ No newline at end of file
#endif
source/XTensor.h
查看文件 @
116dfee7
...
...
@@ -21,7 +21,7 @@
*
* $Created by: XIAO Tong (xiaotong@mail.neu.edu.cn) 2017-07-31
* I'm working while most of the students are enjoying their holidays :(
* $Update by: LI Yinqiao (li.yin.qiao.2012@hotmail.com) 2017-11-18 bug fixes
* $Update
d
by: LI Yinqiao (li.yin.qiao.2012@hotmail.com) 2017-11-18 bug fixes
*
*/
...
...
@@ -36,10 +36,14 @@
#include "XList.h"
#include "XDataType.h"
#include "XMem.h"
#include "XLink.h"
/* the nts (NiuTrans.Tensor) namespace */
namespace
nts
{
/* cross reference */
struct
XLink
;
/* define the maximum number of dimensions in a tensor */
#define MAX_TENSOR_DIM_NUM 6
#define USE_BATCHED_STRIDED_MAT_MUL
...
...
@@ -47,9 +51,7 @@ namespace nts{
#define MIN_TENSOR_SPLIT_LIST_NUM 1024
#define MIN_TENSOR_CAT_NUM 8
/*
computation flags
*/
/* computation flags */
#define UNSAFE_BUT_FAST_MEM
#define FAST_MATRIX
...
...
@@ -59,7 +61,6 @@ is the parent class of XMatrix.
*/
struct
XTensor
{
public
:
/* memory pool */
XMem
*
mem
;
...
...
@@ -129,11 +130,24 @@ public:
/* indicates whether the tensor is initialized or not */
bool
isInit
;
/*
the link used to form networks. Note that when we compute on tensors, we actually create a
network where nodes are tensors and edges the connections among them. Each connection is
a hyperedge whose head is the output tensor and tails are input tensors. E.g,
c = a + b
represents a network with three nodes (a, b and c) and a hyperedge that links a and b (tails) to c (head).
Here "income" keeps which nodes (tensors) are used to form the current node (tensor).
*/
XLink
*
income
;
/* It keeps which nodes (tensors) we go to from the current node (tensor). */
XLink
*
outgo
;
/***********************************************
********************
XTensor untilities
*/
public
:
/
********************
XTensor untilities
*******************
*/
/* constructor */
XTensor
();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论