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