Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
22d04f87
提交
22d04f87
authored
3月 10, 2017
作者:
notoraptor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Extend CLinkerType with new abstract method `c_element_type()`.
Implement this new method into: - Scalar - TensorType - GpuArrayType
上级
6548e5cc
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
22 行增加
和
0 行删除
+22
-0
type.py
theano/gof/type.py
+13
-0
type.py
theano/gpuarray/type.py
+3
-0
basic.py
theano/scalar/basic.py
+3
-0
type.py
theano/tensor/type.py
+3
-0
没有找到文件。
theano/gof/type.py
浏览文件 @
22d04f87
...
...
@@ -35,6 +35,19 @@ class CLinkerType(CLinkerObject):
"""
def
c_element_type
(
self
):
"""
Optional: Return the name of the primitive C type of items into variables
handled by this type.
e.g:
- For ``TensorType(dtype='int64', ...)``: should return ``"npy_int64"``.
- For ``GpuArrayType(dtype='int32', ...)``: should return ``"ga_int"``.
"""
return
''
def
c_is_simple
(
self
):
"""
Optional: Return True for small or builtin C types.
...
...
theano/gpuarray/type.py
浏览文件 @
22d04f87
...
...
@@ -430,6 +430,9 @@ class GpuArrayType(Type):
else
:
return
np
.
dtype
(
self
.
dtype
)
.
itemsize
def
c_element_type
(
self
):
return
pygpu
.
gpuarray
.
dtype_to_ctype
(
self
.
dtype
)
def
c_declare
(
self
,
name
,
sub
,
check_input
=
True
):
return
"""
PyGpuArrayObject *
%(name)
s;
...
...
theano/scalar/basic.py
浏览文件 @
22d04f87
...
...
@@ -349,6 +349,9 @@ class Scalar(Type):
return
True
return
abs
(
diff
)
<=
(
abs
(
a
)
*
tolerance
)
+
(
abs
(
b
)
*
tolerance
)
def
c_element_type
(
self
):
return
self
.
dtype_specs
()[
1
]
def
c_headers
(
self
,
c_compiler
):
l
=
[
'<math.h>'
]
# These includes are needed by Scalar and TensorType,
...
...
theano/tensor/type.py
浏览文件 @
22d04f87
...
...
@@ -375,6 +375,9 @@ class TensorType(Type):
return
str
(
self
)
# "TensorType{%s, %s}" % (str(self.dtype), str(self.broadcastable))
def
c_element_type
(
self
):
return
self
.
dtype_specs
()[
1
]
def
c_declare
(
self
,
name
,
sub
,
check_input
=
True
):
"""
Override `CLinkerType.c_declare`.
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论