Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
84ac684c
提交
84ac684c
authored
2月 01, 2012
作者:
lamblin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #412 from lamblin/sparse_indexing
Sparse indexing
上级
41944823
7749fc6e
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
229 行增加
和
154 行删除
+229
-154
debugmode.py
theano/compile/debugmode.py
+10
-4
graph.py
theano/gof/graph.py
+5
-1
type.py
theano/gof/type.py
+3
-0
basic.py
theano/sparse/basic.py
+46
-26
test_basic.py
theano/sparse/tests/test_basic.py
+165
-123
没有找到文件。
theano/compile/debugmode.py
浏览文件 @
84ac684c
...
@@ -1330,11 +1330,16 @@ class _Linker(gof.link.LocalLinker):
...
@@ -1330,11 +1330,16 @@ class _Linker(gof.link.LocalLinker):
r_vals_initialized
=
[]
r_vals_initialized
=
[]
for
r
in
storage_map
:
for
r
in
storage_map
:
if
(
r
.
owner
is
None
):
if
(
r
.
owner
is
None
):
if
(
storage_map
[
r
][
0
]
is
None
):
raise
Exception
(
'Missing input'
,
r
)
if
not
r
.
type
.
is_valid_value
(
storage_map
[
r
][
0
]):
if
not
r
.
type
.
is_valid_value
(
storage_map
[
r
][
0
]):
# None may be a valid input value (for instance,
# for a Generic object). We only want to raise
# an error if it is not valid.
if
(
storage_map
[
r
][
0
]
is
None
):
raise
InvalidValueError
(
r
,
storage_map
[
r
][
0
],
hint
=
"Graph Input '
%
s' is missing"
%
str
(
r
))
raise
InvalidValueError
(
r
,
storage_map
[
r
][
0
],
raise
InvalidValueError
(
r
,
storage_map
[
r
][
0
],
hint
=
"Graph Input '
%
s' is missing"
%
str
(
r
))
hint
=
(
"Graph Input '
%
s' has invalid value "
"
%
s"
%
(
r
,
storage_map
[
r
][
0
])))
r_vals
[
r
]
=
storage_map
[
r
][
0
]
r_vals
[
r
]
=
storage_map
[
r
][
0
]
storage_map
[
r
][
0
]
=
None
storage_map
[
r
][
0
]
=
None
r_vals_initialized
.
append
(
r
)
r_vals_initialized
.
append
(
r
)
...
@@ -1577,7 +1582,8 @@ class _Linker(gof.link.LocalLinker):
...
@@ -1577,7 +1582,8 @@ class _Linker(gof.link.LocalLinker):
#print storage_map
#print storage_map
for
r
in
storage_map
:
for
r
in
storage_map
:
if
(
r
.
owner
is
None
):
if
(
r
.
owner
is
None
):
assert
storage_map
[
r
][
0
]
is
not
None
if
not
r
.
type
.
is_valid_value
(
None
):
assert
storage_map
[
r
][
0
]
is
not
None
###############
###############
...
...
theano/gof/graph.py
浏览文件 @
84ac684c
...
@@ -391,7 +391,11 @@ class Constant(Value):
...
@@ -391,7 +391,11 @@ class Constant(Value):
def
__str__
(
self
):
def
__str__
(
self
):
if
self
.
name
is
not
None
:
if
self
.
name
is
not
None
:
return
self
.
name
return
self
.
name
return
str
(
self
.
data
)
#+ "::" + str(self.type)
else
:
name
=
str
(
self
.
data
)
if
len
(
name
)
>
20
:
name
=
name
[:
10
]
+
'...'
+
name
[
-
10
]
return
'Constant{
%
s}'
%
name
def
clone
(
self
):
def
clone
(
self
):
"""
"""
We clone this object, but we don't clone the data to lower memory requirement
We clone this object, but we don't clone the data to lower memory requirement
...
...
theano/gof/type.py
浏览文件 @
84ac684c
...
@@ -423,4 +423,7 @@ class Generic(SingletonType):
...
@@ -423,4 +423,7 @@ class Generic(SingletonType):
Py_INCREF(py_
%(name)
s);
Py_INCREF(py_
%(name)
s);
"""
%
locals
()
"""
%
locals
()
def
__str__
(
self
):
return
self
.
__class__
.
__name__
generic
=
Generic
()
generic
=
Generic
()
theano/sparse/basic.py
浏览文件 @
84ac684c
...
@@ -188,13 +188,11 @@ class _sparse_py_operators:
...
@@ -188,13 +188,11 @@ class _sparse_py_operators:
if
not
isinstance
(
args
,
tuple
):
if
not
isinstance
(
args
,
tuple
):
args
=
args
,
args
=
args
,
scalar_var
=
tensor
.
iscalar
()
if
len
(
args
)
==
2
:
if
len
(
args
)
==
2
:
scalar_arg_1
=
(
numpy
.
isscalar
(
args
[
0
])
or
scalar_arg_1
=
(
numpy
.
isscalar
(
args
[
0
])
or
getattr
(
args
[
0
],
'type'
,
None
)
==
scalar_var
.
type
)
getattr
(
args
[
0
],
'type'
,
None
)
==
tensor
.
iscalar
)
scalar_arg_2
=
(
numpy
.
isscalar
(
args
[
1
])
or
scalar_arg_2
=
(
numpy
.
isscalar
(
args
[
1
])
or
getattr
(
args
[
1
],
'type'
,
None
)
==
scalar_var
.
type
)
getattr
(
args
[
1
],
'type'
,
None
)
==
tensor
.
iscalar
)
if
scalar_arg_1
and
scalar_arg_2
:
if
scalar_arg_1
and
scalar_arg_2
:
ret
=
get_item_scalar
(
self
,
args
)
ret
=
get_item_scalar
(
self
,
args
)
else
:
else
:
...
@@ -202,8 +200,8 @@ class _sparse_py_operators:
...
@@ -202,8 +200,8 @@ class _sparse_py_operators:
else
:
else
:
ret
=
get_item_2d
(
self
,
args
)
ret
=
get_item_2d
(
self
,
args
)
return
ret
return
ret
class
SparseVariable
(
gof
.
Variable
,
_sparse_py_operators
):
class
SparseVariable
(
gof
.
Variable
,
_sparse_py_operators
):
dtype
=
property
(
lambda
self
:
self
.
type
.
dtype
)
dtype
=
property
(
lambda
self
:
self
.
type
.
dtype
)
format
=
property
(
lambda
self
:
self
.
type
.
format
)
format
=
property
(
lambda
self
:
self
.
type
.
format
)
...
@@ -681,35 +679,57 @@ class GetItem2d(gof.op.Op):
...
@@ -681,35 +679,57 @@ class GetItem2d(gof.op.Op):
assert
len
(
index
)
in
[
1
,
2
]
assert
len
(
index
)
in
[
1
,
2
]
input_op
=
[
x
]
input_op
=
[
x
]
generic_None
=
theano
.
gof
.
Constant
(
theano
.
gof
.
generic
,
None
)
for
ind
in
index
:
for
ind
in
index
:
if
isinstance
(
ind
,
slice
):
if
isinstance
(
ind
,
slice
):
# in case of slice is written in theano variable
# in case of slice is written in theano variable
start
=
ind
.
start
start
=
ind
.
start
stop
=
ind
.
stop
stop
=
ind
.
stop
if
ind
.
step
is
not
None
:
# in case of slice is written in python int
raise
ValueError
((
if
isinstance
(
start
,
int
):
"Using a slice with non-default step when "
start
=
theano
.
tensor
.
constant
(
start
)
"indexing into a sparse matrix is not supported. "
),
if
isinstance
(
stop
,
int
):
ind
,
ind
.
step
)
stop
=
theano
.
tensor
.
constant
(
stop
)
# If start or stop are None, make them a Generic constant
#in case of indexing using python int
# Else, they should be converted to Tensor Variables of
#elif isinstance(ind,int):
# dimension 1 and int/uint dtype.
# start = theano.tensor.constant(ind)
if
start
is
None
:
# stop = start + 1
start
=
generic_None
#elif ind.ndim == 0:
else
:
# start = ind
if
not
isinstance
(
start
,
gof
.
Variable
):
# stop = ind + 1
start
=
tensor
.
as_tensor_variable
(
start
)
if
not
(
start
.
ndim
==
0
and
start
.
dtype
in
tensor
.
discrete_dtypes
):
else
:
raise
ValueError
((
raise
NotImplemented
(
"Impossible to index into a sparse matrix with "
"slice where start=
%
s"
%
start
),
start
.
ndim
,
start
.
dtype
)
if
stop
is
None
:
stop
=
generic_None
else
:
if
not
isinstance
(
stop
,
gof
.
Variable
):
stop
=
tensor
.
as_tensor_variable
(
stop
)
if
not
(
stop
.
ndim
==
0
and
stop
.
dtype
in
tensor
.
discrete_dtypes
):
raise
ValueError
((
"Impossible to index into a sparse matrix with "
"slice where stop=
%
s"
%
stop
),
stop
.
ndim
,
stop
.
dtype
)
elif
((
isinstance
(
ind
,
gof
.
Variable
)
and
getattr
(
ind
,
'ndim'
,
-
1
)
==
0
)
or
numpy
.
isscalar
(
ind
)):
raise
NotImplementedError
(
'Theano has no sparse vector'
+
'Theano has no sparse vector'
+
'Use X[a:b,c:d], X[a:b,c:c+1] or X[a:b] instead.'
)
'Use X[a:b,c:d], X[a:b,c:c+1] or X[a:b] instead.'
)
else
:
raise
ValueError
((
'Advanced indexing is not implemented for sparse '
'matrices. Argument not supported:
%
s'
%
ind
))
input_op
+=
[
start
,
stop
]
input_op
+=
[
start
,
stop
]
if
len
(
index
)
==
1
:
if
len
(
index
)
==
1
:
i
=
theano
.
gof
.
Constant
(
theano
.
gof
.
generic
,
None
)
input_op
+=
[
generic_None
,
generic_None
]
input_op
+=
[
i
,
i
]
return
gof
.
Apply
(
self
,
input_op
,
[
x
.
type
()])
return
gof
.
Apply
(
self
,
input_op
,
[
x
.
type
()])
...
@@ -765,7 +785,7 @@ class GetItemScalar(gof.op.Op):
...
@@ -765,7 +785,7 @@ class GetItemScalar(gof.op.Op):
def
perform
(
self
,
node
,
(
x
,
ind1
,
ind2
),
(
out
,
)):
def
perform
(
self
,
node
,
(
x
,
ind1
,
ind2
),
(
out
,
)):
assert
_is_sparse
(
x
)
assert
_is_sparse
(
x
)
out
[
0
]
=
x
[
ind1
,
ind2
]
out
[
0
]
=
theano
.
_asarray
(
x
[
ind1
,
ind2
],
x
.
dtype
)
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
__class__
.
__name__
return
self
.
__class__
.
__name__
...
...
theano/sparse/tests/test_basic.py
浏览文件 @
84ac684c
...
@@ -930,129 +930,171 @@ def test_size():
...
@@ -930,129 +930,171 @@ def test_size():
check
()
check
()
def
test_GetItem2D
():
class
Test_getitem
(
unittest
.
TestCase
):
sparse_formats
=
(
'csc'
,
'csr'
)
def
setUp
(
self
):
for
format
in
sparse_formats
:
self
.
rng
=
numpy
.
random
.
RandomState
(
utt
.
fetch_seed
())
x
=
theano
.
sparse
.
matrix
(
format
)
a
=
theano
.
tensor
.
iscalar
()
def
test_GetItem2D
(
self
):
b
=
theano
.
tensor
.
iscalar
()
sparse_formats
=
(
'csc'
,
'csr'
)
c
=
theano
.
tensor
.
iscalar
()
for
format
in
sparse_formats
:
d
=
theano
.
tensor
.
iscalar
()
x
=
theano
.
sparse
.
matrix
(
format
,
name
=
'x'
)
a
=
theano
.
tensor
.
iscalar
(
'a'
)
# index
b
=
theano
.
tensor
.
iscalar
(
'b'
)
m
=
1
c
=
theano
.
tensor
.
iscalar
(
'c'
)
n
=
5
d
=
theano
.
tensor
.
iscalar
(
'd'
)
p
=
10
q
=
15
# index
m
=
1
vx
=
as_sparse_format
(
numpy
.
random
.
binomial
(
1
,
0.5
,
(
100
,
100
)),
n
=
5
format
)
.
astype
(
theano
.
config
.
floatX
)
p
=
10
#mode_no_debug = theano.compile.mode.get_default_mode()
q
=
15
#if isinstance(mode_no_debug, theano.compile.DebugMode):
# mode_no_debug = 'FAST_RUN'
vx
=
as_sparse_format
(
self
.
rng
.
binomial
(
1
,
0.5
,
(
100
,
97
)),
f1
=
theano
.
function
([
x
,
a
,
b
,
c
,
d
],
x
[
a
:
b
,
c
:
d
])
format
)
.
astype
(
theano
.
config
.
floatX
)
r1
=
f1
(
vx
,
m
,
n
,
p
,
q
)
#mode_no_debug = theano.compile.mode.get_default_mode()
t1
=
vx
[
m
:
n
,
p
:
q
]
#if isinstance(mode_no_debug, theano.compile.DebugMode):
assert
r1
.
shape
==
t1
.
shape
# mode_no_debug = 'FAST_RUN'
assert
numpy
.
all
(
t1
.
toarray
()
==
r1
.
toarray
())
f1
=
theano
.
function
([
x
,
a
,
b
,
c
,
d
],
x
[
a
:
b
,
c
:
d
])
r1
=
f1
(
vx
,
m
,
n
,
p
,
q
)
""""
t1
=
vx
[
m
:
n
,
p
:
q
]
Important: based on a discussion with both Fred and James
assert
r1
.
shape
==
t1
.
shape
The following indexing methods is not supported because the rval
assert
numpy
.
all
(
t1
.
toarray
()
==
r1
.
toarray
())
would be a sparse matrix rather than a sparse vector, which is a
deviation from numpy indexing rule. This decision is made largely
""""
for keeping the consistency between numpy and theano.
Important: based on a discussion with both Fred and James
The following indexing methods is not supported because the rval
f2 = theano.function([x, a, b, c], x[a:b, c])
would be a sparse matrix rather than a sparse vector, which is a
r2 = f2(vx, m, n, p)
deviation from numpy indexing rule. This decision is made largely
t2 = vx[m:n, p]
for keeping the consistency between numpy and theano.
assert r2.shape == t2.shape
assert numpy.all(t2.toarray() == r2.toarray())
f2 = theano.function([x, a, b, c], x[a:b, c])
r2 = f2(vx, m, n, p)
f3 = theano.function([x, a, b, c], x[a, b:c])
t2 = vx[m:n, p]
r3 = f3(vx, m, n, p)
assert r2.shape == t2.shape
t3 = vx[m, n:p]
assert numpy.all(t2.toarray() == r2.toarray())
assert r3.shape == t3.shape
assert numpy.all(t3.toarray() == r3.toarray())
f3 = theano.function([x, a, b, c], x[a, b:c])
r3 = f3(vx, m, n, p)
f5 = theano.function([x], x[1:2,3])
t3 = vx[m, n:p]
r5 = f5(vx)
assert r3.shape == t3.shape
t5 = vx[1:2, 3]
assert numpy.all(t3.toarray() == r3.toarray())
assert r5.shape == t5.shape
assert numpy.all(r5.toarray() == t5.toarray())
f5 = theano.function([x], x[1:2,3])
r5 = f5(vx)
f7 = theano.function([x], x[50])
t5 = vx[1:2, 3]
r7 = f7(vx)
assert r5.shape == t5.shape
t7 = vx[50]
assert numpy.all(r5.toarray() == t5.toarray())
assert r7.shape == t7.shape
assert numpy.all(r7.toarray() == t7.toarray())
f7 = theano.function([x], x[50])
"""
r7 = f7(vx)
t7 = vx[50]
f4
=
theano
.
function
([
x
,
a
,
b
],
x
[
a
:
b
])
assert r7.shape == t7.shape
r4
=
f4
(
vx
,
m
,
n
)
assert numpy.all(r7.toarray() == t7.toarray())
t4
=
vx
[
m
:
n
]
"""
assert
r4
.
shape
==
t4
.
shape
assert
numpy
.
all
(
t4
.
toarray
()
==
r4
.
toarray
())
f4
=
theano
.
function
([
x
,
a
,
b
],
x
[
a
:
b
])
#-----------------------------------------------------------
r4
=
f4
(
vx
,
m
,
n
)
# test cases using int indexing instead of theano variable
t4
=
vx
[
m
:
n
]
assert
r4
.
shape
==
t4
.
shape
f6
=
theano
.
function
([
x
],
x
[
1
:
10
,
10
:
20
])
assert
numpy
.
all
(
t4
.
toarray
()
==
r4
.
toarray
())
r6
=
f6
(
vx
)
#-----------------------------------------------------------
t6
=
vx
[
1
:
10
,
10
:
20
]
# test cases using int indexing instead of theano variable
assert
r6
.
shape
==
t6
.
shape
assert
numpy
.
all
(
r6
.
toarray
()
==
t6
.
toarray
())
f6
=
theano
.
function
([
x
],
x
[
1
:
10
,
10
:
20
])
r6
=
f6
(
vx
)
#----------------------------------------------------------
t6
=
vx
[
1
:
10
,
10
:
20
]
# test cases with indexing both with theano variable and int
assert
r6
.
shape
==
t6
.
shape
f8
=
theano
.
function
([
x
,
a
,
b
],
x
[
a
:
b
,
10
:
20
])
assert
numpy
.
all
(
r6
.
toarray
()
==
t6
.
toarray
())
r8
=
f8
(
vx
,
m
,
n
)
t8
=
vx
[
m
:
n
,
10
:
20
]
#----------------------------------------------------------
assert
r8
.
shape
==
t8
.
shape
# test cases with indexing both with theano variable and int
assert
numpy
.
all
(
r8
.
toarray
()
==
t8
.
toarray
())
f8
=
theano
.
function
([
x
,
a
,
b
],
x
[
a
:
b
,
10
:
20
])
r8
=
f8
(
vx
,
m
,
n
)
f9
=
theano
.
function
([
x
,
a
,
b
],
x
[
1
:
a
,
1
:
b
])
t8
=
vx
[
m
:
n
,
10
:
20
]
r9
=
f9
(
vx
,
p
,
q
)
assert
r8
.
shape
==
t8
.
shape
t9
=
vx
[
1
:
p
,
1
:
q
]
assert
numpy
.
all
(
r8
.
toarray
()
==
t8
.
toarray
())
assert
r9
.
shape
==
t9
.
shape
assert
numpy
.
all
(
r9
.
toarray
()
==
t9
.
toarray
())
f9
=
theano
.
function
([
x
,
a
,
b
],
x
[
1
:
a
,
1
:
b
])
r9
=
f9
(
vx
,
p
,
q
)
t9
=
vx
[
1
:
p
,
1
:
q
]
def
test_GetItemScalar
():
assert
r9
.
shape
==
t9
.
shape
sparse_formats
=
(
'csc'
,
'csr'
)
assert
numpy
.
all
(
r9
.
toarray
()
==
t9
.
toarray
())
for
format
in
sparse_formats
:
x
=
theano
.
sparse
.
csc_matrix
(
'x'
)
#-----------------------------------------------------------
a
=
theano
.
tensor
.
iscalar
()
# Test mixing None and variables
b
=
theano
.
tensor
.
iscalar
()
f10
=
theano
.
function
([
x
,
a
,
b
],
x
[:
a
,
:
b
])
r10
=
f10
(
vx
,
p
,
q
)
m
=
50
t10
=
vx
[:
p
,
:
q
]
n
=
50
assert
r10
.
shape
==
t10
.
shape
assert
numpy
.
all
(
r10
.
toarray
()
==
t10
.
toarray
())
vx
=
as_sparse_format
(
numpy
.
random
.
binomial
(
1
,
0.5
,
(
100
,
100
)),
format
)
.
astype
(
theano
.
config
.
floatX
)
f11
=
theano
.
function
([
x
,
a
],
x
[:,
a
:])
r11
=
f11
(
vx
,
p
)
f1
=
theano
.
function
([
x
,
a
,
b
],
x
[
a
,
b
])
t11
=
vx
[:,
p
:]
r1
=
f1
(
vx
,
10
,
10
)
assert
r11
.
shape
==
t11
.
shape
t1
=
vx
[
10
,
10
]
assert
numpy
.
all
(
r11
.
toarray
()
==
t11
.
toarray
())
assert
r1
.
shape
==
t1
.
shape
assert
numpy
.
all
(
t1
==
r1
)
#------------------------------------------------------------
# Invalid things
f2
=
theano
.
function
([
x
,
a
],
x
[
50
,
a
])
# The syntax is a bit awkward because assertRaises forbids
r2
=
f2
(
vx
,
m
)
# the [] shortcut for getitem.
t2
=
vx
[
50
,
m
]
# x[a:b] is not accepted because we don't have sparse vectors
assert
r2
.
shape
==
t2
.
shape
self
.
assertRaises
(
NotImplementedError
,
assert
numpy
.
all
(
t2
==
r2
)
x
.
__getitem__
,
(
slice
(
a
,
b
),
c
))
f3
=
theano
.
function
([
x
,
a
],
x
[
a
,
50
])
# x[a:b:step, c:d] is not accepted because scipy silently drops
r3
=
f3
(
vx
,
m
)
# the step (!)
t3
=
vx
[
m
,
50
]
self
.
assertRaises
(
ValueError
,
assert
r3
.
shape
==
t3
.
shape
x
.
__getitem__
,
(
slice
(
a
,
b
,
-
1
),
slice
(
c
,
d
)))
assert
numpy
.
all
(
t3
==
r3
)
self
.
assertRaises
(
ValueError
,
x
.
__getitem__
,
(
slice
(
a
,
b
),
slice
(
c
,
d
,
2
)))
f4
=
theano
.
function
([
x
],
x
[
50
,
50
])
r4
=
f4
(
vx
)
# Advanced indexing is not supported
t4
=
vx
[
m
,
n
]
self
.
assertRaises
(
ValueError
,
assert
r3
.
shape
==
t3
.
shape
x
.
__getitem__
,
(
tensor
.
ivector
(
'l'
),
slice
(
a
,
b
)))
assert
numpy
.
all
(
t4
==
r4
)
# Indexing with random things is not supported either
self
.
assertRaises
(
ValueError
,
x
.
__getitem__
,
slice
(
tensor
.
fscalar
(
'f'
),
None
))
self
.
assertRaises
(
ValueError
,
x
.
__getitem__
,
(
slice
(
None
),
slice
([
1
,
3
,
4
],
None
)))
def
test_GetItemScalar
(
self
):
sparse_formats
=
(
'csc'
,
'csr'
)
for
format
in
sparse_formats
:
x
=
theano
.
sparse
.
csc_matrix
(
'x'
)
a
=
theano
.
tensor
.
iscalar
()
b
=
theano
.
tensor
.
iscalar
()
m
=
50
n
=
42
vx
=
as_sparse_format
(
self
.
rng
.
binomial
(
1
,
0.5
,
(
97
,
100
)),
format
)
.
astype
(
theano
.
config
.
floatX
)
f1
=
theano
.
function
([
x
,
a
,
b
],
x
[
a
,
b
])
r1
=
f1
(
vx
,
10
,
10
)
t1
=
vx
[
10
,
10
]
assert
r1
.
shape
==
t1
.
shape
assert
numpy
.
all
(
t1
==
r1
)
f2
=
theano
.
function
([
x
,
a
],
x
[
50
,
a
])
r2
=
f2
(
vx
,
m
)
t2
=
vx
[
50
,
m
]
assert
r2
.
shape
==
t2
.
shape
assert
numpy
.
all
(
t2
==
r2
)
f3
=
theano
.
function
([
x
,
a
],
x
[
a
,
50
])
r3
=
f3
(
vx
,
m
)
t3
=
vx
[
m
,
50
]
assert
r3
.
shape
==
t3
.
shape
assert
numpy
.
all
(
t3
==
r3
)
f4
=
theano
.
function
([
x
],
x
[
50
,
42
])
r4
=
f4
(
vx
)
t4
=
vx
[
m
,
n
]
assert
r3
.
shape
==
t3
.
shape
assert
numpy
.
all
(
t4
==
r4
)
import
theano.tensor.tests.test_sharedvar
import
theano.tensor.tests.test_sharedvar
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论