Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
5deab31d
提交
5deab31d
authored
10月 02, 2008
作者:
Olivier Breuleux
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
pre-cleanup klass
上级
ac62de29
全部展开
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
7 行增加
和
2 行删除
+7
-2
link.py
gof/link.py
+5
-0
klass.py
sandbox/klass.py
+0
-0
tensor.py
tensor.py
+2
-2
没有找到文件。
gof/link.py
浏览文件 @
5deab31d
...
@@ -112,6 +112,8 @@ class Linker(object):
...
@@ -112,6 +112,8 @@ class Linker(object):
class
Container
(
object
):
class
Container
(
object
):
def
__init__
(
self
,
r
,
storage
,
readonly
=
False
,
strict
=
False
,
name
=
None
):
def
__init__
(
self
,
r
,
storage
,
readonly
=
False
,
strict
=
False
,
name
=
None
):
if
not
isinstance
(
storage
,
list
)
or
not
len
(
storage
)
>=
1
:
raise
TypeError
(
"storage must be a list of length at least one"
)
#self.r = r
#self.r = r
if
isinstance
(
r
,
Type
):
if
isinstance
(
r
,
Type
):
self
.
type
=
r
self
.
type
=
r
...
@@ -127,6 +129,9 @@ class Container(object):
...
@@ -127,6 +129,9 @@ class Container(object):
if
self
.
readonly
:
if
self
.
readonly
:
raise
Exception
(
"Cannot set readonly storage:
%
s"
%
self
.
name
)
raise
Exception
(
"Cannot set readonly storage:
%
s"
%
self
.
name
)
try
:
try
:
if
value
is
None
:
self
.
storage
[
0
]
=
None
return
if
self
.
strict
:
if
self
.
strict
:
self
.
storage
[
0
]
=
self
.
type
.
filter
(
value
,
strict
=
True
)
self
.
storage
[
0
]
=
self
.
type
.
filter
(
value
,
strict
=
True
)
else
:
else
:
...
...
sandbox/klass.py
0 → 100644
浏览文件 @
5deab31d
差异被折叠。
点击展开。
tensor.py
浏览文件 @
5deab31d
...
@@ -1212,7 +1212,7 @@ class Subtensor(Op):
...
@@ -1212,7 +1212,7 @@ class Subtensor(Op):
def
__init__
(
self
,
idx_list
):
def
__init__
(
self
,
idx_list
):
def
convert
(
entry
,
slice_ok
=
True
):
def
convert
(
entry
,
slice_ok
=
True
):
scal_types
=
[
scal
.
int64
,
scal
.
int32
,
scal
.
int16
,
scal
.
int8
]
scal_types
=
[
scal
.
int64
,
scal
.
int32
,
scal
.
int16
,
scal
.
int8
]
tensor_types
=
[
bscalar
,
iscalar
,
lscalar
]
tensor_types
=
[
bscalar
,
iscalar
,
lscalar
]
if
isinstance
(
entry
,
gof
.
Result
)
and
entry
.
type
in
scal_types
:
if
isinstance
(
entry
,
gof
.
Result
)
and
entry
.
type
in
scal_types
:
return
entry
.
type
return
entry
.
type
...
@@ -2059,7 +2059,7 @@ def grad(cost, wrt, g_cost=None):
...
@@ -2059,7 +2059,7 @@ def grad(cost, wrt, g_cost=None):
Tensor
(
dtype
=
p
.
type
.
dtype
,
broadcastable
=
[]),
Tensor
(
dtype
=
p
.
type
.
dtype
,
broadcastable
=
[]),
numpy
.
asarray
(
0
,
dtype
=
p
.
type
.
dtype
))
numpy
.
asarray
(
0
,
dtype
=
p
.
type
.
dtype
))
if
isinstance
(
wrt
,
list
):
if
isinstance
(
wrt
,
(
list
,
tuple
)
):
return
[
gmap
.
get
(
p
,
zero
(
p
))
for
p
in
wrt
]
return
[
gmap
.
get
(
p
,
zero
(
p
))
for
p
in
wrt
]
else
:
else
:
return
gmap
.
get
(
wrt
,
zero
(
wrt
))
return
gmap
.
get
(
wrt
,
zero
(
wrt
))
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论