Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
a1d277bc
提交
a1d277bc
authored
11月 10, 2020
作者:
Brandon T. Willard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow NumPy-only arguments to theano.tensor.dot
上级
6d39faaf
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
17 行增加
和
0 行删除
+17
-0
test_basic.py
tests/tensor/test_basic.py
+10
-0
basic.py
theano/tensor/basic.py
+7
-0
没有找到文件。
tests/tensor/test_basic.py
浏览文件 @
a1d277bc
...
@@ -71,6 +71,7 @@ from tests.tensor.utils import (
...
@@ -71,6 +71,7 @@ from tests.tensor.utils import (
from
theano
import
change_flags
,
compile
,
config
,
function
,
gof
,
shared
from
theano
import
change_flags
,
compile
,
config
,
function
,
gof
,
shared
from
theano.compile
import
DeepCopyOp
from
theano.compile
import
DeepCopyOp
from
theano.compile.mode
import
get_default_mode
from
theano.compile.mode
import
get_default_mode
from
theano.gof.graph
import
Variable
from
theano.scalar
import
autocast_float
,
autocast_float_as
from
theano.scalar
import
autocast_float
,
autocast_float_as
from
theano.tensor
import
(
from
theano.tensor
import
(
Alloc
,
Alloc
,
...
@@ -3648,6 +3649,15 @@ class TestMatinv:
...
@@ -3648,6 +3649,15 @@ class TestMatinv:
assert_almost_equal
(
ssd
,
myssd
)
assert_almost_equal
(
ssd
,
myssd
)
def
test_dot_numpy_inputs
():
"""Test the `theano.tensor.dot` interface function with NumPy inputs."""
a
=
np
.
ones
(
2
)
b
=
np
.
ones
(
2
)
res
=
tt
.
dot
(
a
,
b
)
assert
isinstance
(
res
,
Variable
)
assert
isinstance
(
res
.
owner
.
op
,
Dot
)
class
TestDot
:
class
TestDot
:
def
setup_method
(
self
):
def
setup_method
(
self
):
utt
.
seed_rng
()
utt
.
seed_rng
()
...
...
theano/tensor/basic.py
浏览文件 @
a1d277bc
...
@@ -6311,6 +6311,13 @@ def dot(l, r):
...
@@ -6311,6 +6311,13 @@ def dot(l, r):
This is designed to work with both sparse and dense tensors types.
This is designed to work with both sparse and dense tensors types.
"""
"""
if
not
isinstance
(
l
,
Variable
):
l
=
as_tensor_variable
(
l
)
if
not
isinstance
(
r
,
Variable
):
r
=
as_tensor_variable
(
r
)
try
:
try
:
res
=
l
.
__dot__
(
r
)
res
=
l
.
__dot__
(
r
)
if
res
is
NotImplemented
:
if
res
is
NotImplemented
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论