Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
25dec06f
提交
25dec06f
authored
6月 02, 2014
作者:
Hengjean
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added check input parameters for all c_extract.
上级
2beab0e4
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
7 行增加
和
7 行删除
+7
-7
cc.py
theano/gof/cc.py
+2
-2
type.py
theano/gof/type.py
+1
-1
type.py
theano/sandbox/gpuarray/type.py
+1
-1
basic.py
theano/scalar/basic.py
+1
-1
test_tutorial.py
theano/tests/test_tutorial.py
+2
-2
没有找到文件。
theano/gof/cc.py
浏览文件 @
25dec06f
...
@@ -329,7 +329,7 @@ def get_c_extract(r, name, sub):
...
@@ -329,7 +329,7 @@ def get_c_extract(r, name, sub):
c_extract
=
r
.
type
.
c_extract
(
name
,
sub
,
c_extract
=
r
.
type
.
c_extract
(
name
,
sub
,
getattr
(
r
.
owner
.
op
,
'check_input'
,
True
))
getattr
(
r
.
owner
.
op
,
'check_input'
,
True
))
else
:
else
:
c_extract
=
r
.
type
.
c_extract
(
name
,
sub
)
c_extract
=
r
.
type
.
c_extract
(
name
,
sub
,
True
)
pre
=
"""
pre
=
"""
py_
%(name)
s = PyList_GET_ITEM(storage_
%(name)
s, 0);
py_
%(name)
s = PyList_GET_ITEM(storage_
%(name)
s, 0);
...
@@ -344,7 +344,7 @@ def get_c_extract_out(r, name, sub):
...
@@ -344,7 +344,7 @@ def get_c_extract_out(r, name, sub):
c_extract
=
r
.
type
.
c_extract
(
name
,
sub
,
c_extract
=
r
.
type
.
c_extract
(
name
,
sub
,
getattr
(
r
.
owner
.
op
,
'check_input'
,
True
))
getattr
(
r
.
owner
.
op
,
'check_input'
,
True
))
else
:
else
:
c_extract
=
r
.
type
.
c_extract
(
name
,
sub
)
c_extract
=
r
.
type
.
c_extract
(
name
,
sub
,
True
)
pre
=
"""
pre
=
"""
py_
%(name)
s = PyList_GET_ITEM(storage_
%(name)
s, 0);
py_
%(name)
s = PyList_GET_ITEM(storage_
%(name)
s, 0);
...
...
theano/gof/type.py
浏览文件 @
25dec06f
...
@@ -96,7 +96,7 @@ class CLinkerType(CLinkerObject):
...
@@ -96,7 +96,7 @@ class CLinkerType(CLinkerObject):
"""
"""
raise
MethodNotDefined
(
"c_init"
,
type
(
self
),
self
.
__class__
.
__name__
)
raise
MethodNotDefined
(
"c_init"
,
type
(
self
),
self
.
__class__
.
__name__
)
def
c_extract
(
self
,
name
,
sub
):
def
c_extract
(
self
,
name
,
sub
,
check_input
=
True
):
"""Required: Return c code to extract a PyObject * instance.
"""Required: Return c code to extract a PyObject * instance.
The code returned from this function must be templated using
The code returned from this function must be templated using
...
...
theano/sandbox/gpuarray/type.py
浏览文件 @
25dec06f
...
@@ -163,7 +163,7 @@ class GpuArrayType(Type):
...
@@ -163,7 +163,7 @@ class GpuArrayType(Type):
def
c_init
(
self
,
name
,
sub
):
def
c_init
(
self
,
name
,
sub
):
return
"
%
s = NULL;"
%
(
name
,)
return
"
%
s = NULL;"
%
(
name
,)
def
c_extract
(
self
,
name
,
sub
):
def
c_extract
(
self
,
name
,
sub
,
check_input
=
True
):
# TODO I don't check broadcast stuff for now.
# TODO I don't check broadcast stuff for now.
return
"""
return
"""
%(name)
s = NULL;
%(name)
s = NULL;
...
...
theano/scalar/basic.py
浏览文件 @
25dec06f
...
@@ -266,7 +266,7 @@ class Scalar(Type):
...
@@ -266,7 +266,7 @@ class Scalar(Type):
%(name)
s = 0;
%(name)
s = 0;
"""
%
locals
()
"""
%
locals
()
def
c_extract
(
self
,
name
,
sub
):
def
c_extract
(
self
,
name
,
sub
,
check_input
=
True
):
specs
=
self
.
dtype_specs
()
specs
=
self
.
dtype_specs
()
return
"""
return
"""
if (!PyObject_TypeCheck(py_
%(name)
s, &
%(pyarr_type)
s))
if (!PyObject_TypeCheck(py_
%(name)
s, &
%(pyarr_type)
s))
...
...
theano/tests/test_tutorial.py
浏览文件 @
25dec06f
...
@@ -247,7 +247,7 @@ class T_extending(unittest.TestCase):
...
@@ -247,7 +247,7 @@ class T_extending(unittest.TestCase):
def
c_extract
(
name
,
sub
):
def
c_extract
(
name
,
sub
,
check_input
=
True
):
return
"""
return
"""
if (!PyFloat_Check(py_
%(name)
s)) {
if (!PyFloat_Check(py_
%(name)
s)) {
PyErr_SetString(PyExc_TypeError, "expected a float");
PyErr_SetString(PyExc_TypeError, "expected a float");
...
@@ -308,7 +308,7 @@ class T_extending(unittest.TestCase):
...
@@ -308,7 +308,7 @@ class T_extending(unittest.TestCase):
%(name)
s = 0.0;
%(name)
s = 0.0;
"""
%
dict
(
name
=
name
)
"""
%
dict
(
name
=
name
)
def
c_extract
(
self
,
name
,
sub
):
def
c_extract
(
self
,
name
,
sub
,
check_input
=
True
):
return
"""
return
"""
if (!PyFloat_Check(py_
%(name)
s)) {
if (!PyFloat_Check(py_
%(name)
s)) {
PyErr_SetString(PyExc_TypeError, "expected a float");
PyErr_SetString(PyExc_TypeError, "expected a float");
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论