Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
39a2b2d2
提交
39a2b2d2
authored
10月 11, 2016
作者:
notoraptor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added some simplifications.
上级
0cd7aa7b
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
10 行增加
和
14 行删除
+10
-14
alt_dgemm.c
theano/tensor/alt_dgemm.c
+3
-5
alt_sgemm.c
theano/tensor/alt_sgemm.c
+7
-9
没有找到文件。
theano/tensor/alt_dgemm.c
浏览文件 @
39a2b2d2
...
...
@@ -3,19 +3,17 @@ C Implementation of dgemm_ based on NumPy
Used instead of blas when Theano config flag blas.ldflags is empty.
**/
void
alt_double_scalar_matrix_product_in_place
(
double
scalar
,
double
*
matrix
,
int
size_to_compute
)
{
int
i
;
for
(
i
=
0
;
i
<
size_to_compute
;
++
i
)
{
for
(
int
i
=
0
;
i
<
size_to_compute
;
++
i
)
{
matrix
[
i
]
*=
scalar
;
}
}
void
alt_double_matrix_sum_in_place
(
double
*
A
,
double
*
B
,
double
*
out
,
int
size_to_compute
)
{
int
i
;
for
(
i
=
0
;
i
<
size_to_compute
;
++
i
)
{
for
(
int
i
=
0
;
i
<
size_to_compute
;
++
i
)
{
out
[
i
]
=
A
[
i
]
+
B
[
i
];
}
}
/* dgemm
* NB: See sgemm_ for same assumptions.
* NB: See sgemm_
(in alt_sgemm.c)
for same assumptions.
* */
void
dgemm_
(
char
*
TRANSA
,
char
*
TRANSB
,
const
int
*
M
,
const
int
*
N
,
const
int
*
K
,
...
...
theano/tensor/alt_sgemm.c
浏览文件 @
39a2b2d2
...
...
@@ -12,14 +12,12 @@ inline PyObject* alt_matrix_matrix_product2(PyObject* o1, PyObject* o2, PyObject
return
PyArray_MatrixProduct2
(
o1
,
o2
,
(
PyArrayObject
*
)
out
);
}
void
alt_scalar_matrix_product_in_place
(
float
scalar
,
float
*
matrix
,
int
size_to_compute
)
{
int
i
;
for
(
i
=
0
;
i
<
size_to_compute
;
++
i
)
{
for
(
int
i
=
0
;
i
<
size_to_compute
;
++
i
)
{
matrix
[
i
]
*=
scalar
;
}
}
void
alt_matrix_sum_in_place
(
float
*
A
,
float
*
B
,
float
*
out
,
int
size_to_compute
)
{
int
i
;
for
(
i
=
0
;
i
<
size_to_compute
;
++
i
)
{
for
(
int
i
=
0
;
i
<
size_to_compute
;
++
i
)
{
out
[
i
]
=
A
[
i
]
+
B
[
i
];
}
}
...
...
@@ -27,8 +25,8 @@ inline PyObject* alt_op(char* trans, PyArrayObject* matrix) {
return
(
*
trans
==
'N'
||
*
trans
==
'n'
)
?
(
PyObject
*
)
matrix
:
alt_transpose
(
matrix
);
}
/* sgemm
* We assume that none of these 13 pointers passed as arguments
are
null.
* NB: We can
optimize this function again (for example, when alpha == 0 and/or bet
a == 0).
* We assume that none of these 13 pointers passed as arguments
is
null.
* NB: We can
more optimize this function (for example, when alph
a == 0).
* */
void
sgemm_
(
char
*
TRANSA
,
char
*
TRANSB
,
const
int
*
M
,
const
int
*
N
,
const
int
*
K
,
...
...
@@ -40,9 +38,9 @@ void sgemm_(char* TRANSA, char* TRANSB,
if
(
C
==
NULL
)
return
;
/* Recall:
A is a *LDA by *ka matrix.
B is a *LDB by *kb matrix.
C is a *LDC By *N matrix.
*
A is a *LDA by *ka matrix.
*
B is a *LDB by *kb matrix.
*
C is a *LDC By *N matrix.
*/
int
ka
,
kb
;
if
(
*
TRANSA
==
'N'
||
*
TRANSA
==
'n'
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论