Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
94aab099
提交
94aab099
authored
1月 07, 2013
作者:
Olivier Delalleau
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix for new name of scipy.linalg.blas.fblas
Also cleaned up duplicated / useless code at the same time. This fixes gh-1144.
上级
7b8d668f
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
24 行增加
和
26 行删除
+24
-26
blas.py
theano/tensor/blas.py
+15
-9
blas_scipy.py
theano/tensor/blas_scipy.py
+9
-17
没有找到文件。
theano/tensor/blas.py
浏览文件 @
94aab099
...
...
@@ -142,7 +142,7 @@ from theano.printing import pprint, FunctionPrinter, debugprint
from
theano.compile.mode
import
optdb
from
theano.gof.python25
import
all
,
any
import
theano.scalar
import
basic
as
T
from
theano.tensor
import
basic
as
T
from
theano.tensor.blas_headers
import
blas_header_text
from
theano.tensor.opt
import
local_dimshuffle_lift
...
...
@@ -150,16 +150,22 @@ _logger = logging.getLogger('theano.tensor.blas')
try
:
import
scipy.linalg.blas
_have_fblas
=
True
have_fblas
=
True
try
:
fblas
=
scipy
.
linalg
.
blas
.
fblas
except
AttributeError
:
# In more recent versions of Scipy, `scipy.linalg.blas.fblas` has been
# replaced with `scipy.linalg.blas`.
fblas
=
scipy
.
linalg
.
blas
_blas_gemv_fns
=
{
numpy
.
dtype
(
'float32'
):
scipy
.
linalg
.
blas
.
fblas
.
sgemv
,
numpy
.
dtype
(
'float64'
):
scipy
.
linalg
.
blas
.
fblas
.
dgemv
,
numpy
.
dtype
(
'complex64'
):
scipy
.
linalg
.
blas
.
fblas
.
cgemv
,
numpy
.
dtype
(
'complex128'
):
scipy
.
linalg
.
blas
.
fblas
.
zgemv
,
numpy
.
dtype
(
'float32'
):
fblas
.
sgemv
,
numpy
.
dtype
(
'float64'
):
fblas
.
dgemv
,
numpy
.
dtype
(
'complex64'
):
fblas
.
cgemv
,
numpy
.
dtype
(
'complex128'
):
fblas
.
zgemv
,
}
except
ImportError
,
e
:
_
have_fblas
=
False
_logger
.
warning
(
'Failed to import scipy.linalg.blas.
fblas.
'
have_fblas
=
False
_logger
.
warning
(
'Failed to import scipy.linalg.blas. '
'Falling back on slower implementations (
%
s)'
,
str
(
e
))
...
...
@@ -216,7 +222,7 @@ class Gemv(Op):
def
perform
(
self
,
node
,
inputs
,
out_storage
):
y
,
alpha
,
A
,
x
,
beta
=
inputs
if
_
have_fblas
and
y
.
shape
[
0
]
!=
0
and
x
.
shape
[
0
]
!=
0
:
if
have_fblas
and
y
.
shape
[
0
]
!=
0
and
x
.
shape
[
0
]
!=
0
:
gemv
=
_blas_gemv_fns
[
y
.
dtype
]
if
(
A
.
shape
[
0
]
!=
y
.
shape
[
0
]
or
A
.
shape
[
1
]
!=
x
.
shape
[
0
]):
...
...
theano/tensor/blas_scipy.py
浏览文件 @
94aab099
...
...
@@ -3,28 +3,20 @@ Implementations of BLAS Ops based on scipy's BLAS bindings.
"""
import
numpy
from
blas
import
Ger
,
ger
,
ger_destructive
from
blas
import
blas_optdb
,
optdb
,
local_optimizer
from
theano.tensor.blas
import
Ger
,
ger
,
ger_destructive
,
have_fblas
from
theano.tensor.
blas
import
blas_optdb
,
optdb
,
local_optimizer
from
theano.tensor.opt
import
in2out
try
:
import
scipy.linalg.blas
have_fblas
=
True
_blas_gemv_fns
=
{
numpy
.
dtype
(
'float32'
):
scipy
.
linalg
.
blas
.
fblas
.
sgemv
,
numpy
.
dtype
(
'float64'
):
scipy
.
linalg
.
blas
.
fblas
.
dgemv
,
numpy
.
dtype
(
'complex64'
):
scipy
.
linalg
.
blas
.
fblas
.
cgemv
,
numpy
.
dtype
(
'complex128'
):
scipy
.
linalg
.
blas
.
fblas
.
zgemv
,
}
if
have_fblas
:
from
theano.tensor.blas
import
fblas
_blas_ger_fns
=
{
numpy
.
dtype
(
'float32'
):
scipy
.
linalg
.
blas
.
fblas
.
sger
,
numpy
.
dtype
(
'float64'
):
scipy
.
linalg
.
blas
.
fblas
.
dger
,
numpy
.
dtype
(
'complex64'
):
scipy
.
linalg
.
blas
.
fblas
.
cgeru
,
numpy
.
dtype
(
'complex128'
):
scipy
.
linalg
.
blas
.
fblas
.
zgeru
,
numpy
.
dtype
(
'float32'
):
fblas
.
sger
,
numpy
.
dtype
(
'float64'
):
fblas
.
dger
,
numpy
.
dtype
(
'complex64'
):
fblas
.
cgeru
,
numpy
.
dtype
(
'complex128'
):
fblas
.
zgeru
,
}
except
ImportError
,
e
:
have_fblas
=
False
class
ScipyGer
(
Ger
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论