Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
5e516c42
提交
5e516c42
authored
2月 17, 2013
作者:
abalkin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Porting to py3k: use 'six'; import theano now works.
上级
e2749272
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
59 行增加
和
14 行删除
+59
-14
setup.py
setup.py
+1
-1
debugmode.py
theano/compile/debugmode.py
+3
-2
configparser.py
theano/configparser.py
+3
-1
cmodule.py
theano/gof/cmodule.py
+4
-3
compiledir.py
theano/gof/compiledir.py
+1
-1
lazylinker_c.c.txt
theano/gof/lazylinker_c.c.txt
+42
-4
lazylinker_c.py
theano/gof/lazylinker_c.py
+2
-1
basic_scipy.py
theano/scalar/basic_scipy.py
+3
-1
没有找到文件。
setup.py
浏览文件 @
5e516c42
...
@@ -177,7 +177,7 @@ def do_setup():
...
@@ -177,7 +177,7 @@ def do_setup():
license
=
LICENSE
,
license
=
LICENSE
,
platforms
=
PLATFORMS
,
platforms
=
PLATFORMS
,
packages
=
find_packages
(),
packages
=
find_packages
(),
install_requires
=
[
'numpy>=1.5.0'
,
'scipy>=0.7.2'
],
install_requires
=
[
'numpy>=1.5.0'
,
'scipy>=0.7.2'
,
'six>=1.2.0'
],
package_data
=
{
package_data
=
{
''
:
[
'*.txt'
,
'*.rst'
,
'*.cu'
,
'*.cuh'
,
'*.c'
,
'*.sh'
,
''
:
[
'*.txt'
,
'*.rst'
,
'*.cu'
,
'*.cuh'
,
'*.c'
,
'*.sh'
,
'ChangeLog'
],
'ChangeLog'
],
...
...
theano/compile/debugmode.py
浏览文件 @
5e516c42
...
@@ -10,6 +10,7 @@ from itertools import izip
...
@@ -10,6 +10,7 @@ from itertools import izip
from
StringIO
import
StringIO
from
StringIO
import
StringIO
import
numpy
import
numpy
import
six
import
theano
import
theano
from
theano
import
gof
from
theano
import
gof
...
@@ -1563,8 +1564,8 @@ class _VariableEquivalenceTracker(object):
...
@@ -1563,8 +1564,8 @@ class _VariableEquivalenceTracker(object):
#List of default version of make thunk.
#List of default version of make thunk.
#This is needed to know if the user overrided it.
#This is needed to know if the user overrided it.
#The GpuOp will be added here when theano.sandbox.cuda is imported.
#The GpuOp will be added here when theano.sandbox.cuda is imported.
default_make_thunk
=
[
theano
.
gof
.
Op
.
make_thunk
.
im_func
,
default_make_thunk
=
[
six
.
get_unbound_function
(
theano
.
gof
.
Op
.
make_thunk
)
,
theano
.
gof
.
OpenMPOp
.
make_thunk
.
im_func
]
six
.
get_unbound_function
(
theano
.
gof
.
OpenMPOp
.
make_thunk
)
]
class
_Linker
(
gof
.
link
.
LocalLinker
):
class
_Linker
(
gof
.
link
.
LocalLinker
):
...
...
theano/configparser.py
浏览文件 @
5e516c42
...
@@ -6,7 +6,9 @@ import logging
...
@@ -6,7 +6,9 @@ import logging
import
os
import
os
import
sys
import
sys
import
warnings
import
warnings
import
ConfigParser
from
six.moves
import
configparser
as
ConfigParser
import
StringIO
import
StringIO
import
theano
import
theano
...
...
theano/gof/cmodule.py
浏览文件 @
5e516c42
...
@@ -13,6 +13,7 @@ import subprocess
...
@@ -13,6 +13,7 @@ import subprocess
import
sys
import
sys
import
tempfile
import
tempfile
import
time
import
time
from
six
import
b
import
distutils.sysconfig
import
distutils.sysconfig
...
@@ -1572,7 +1573,7 @@ class GCC_compiler(object):
...
@@ -1572,7 +1573,7 @@ class GCC_compiler(object):
lib_dirs
.
append
(
python_lib
)
lib_dirs
.
append
(
python_lib
)
cppfilename
=
os
.
path
.
join
(
location
,
'mod.cpp'
)
cppfilename
=
os
.
path
.
join
(
location
,
'mod.cpp'
)
cppfile
=
file
(
cppfilename
,
'w'
)
cppfile
=
open
(
cppfilename
,
'w'
)
_logger
.
debug
(
'Writing module C++ code to
%
s'
,
cppfilename
)
_logger
.
debug
(
'Writing module C++ code to
%
s'
,
cppfilename
)
...
@@ -1630,14 +1631,14 @@ class GCC_compiler(object):
...
@@ -1630,14 +1631,14 @@ class GCC_compiler(object):
# prints the exception, having '\n' in the text makes it more
# prints the exception, having '\n' in the text makes it more
# difficult to read.
# difficult to read.
raise
Exception
(
'Compilation failed (return status=
%
s):
%
s'
%
raise
Exception
(
'Compilation failed (return status=
%
s):
%
s'
%
(
status
,
compile_stderr
.
replace
(
'
\n
'
,
'. '
)))
(
status
,
compile_stderr
.
replace
(
b
(
'
\n
'
),
b
(
'. '
)
)))
elif
config
.
cmodule
.
compilation_warning
and
compile_stderr
:
elif
config
.
cmodule
.
compilation_warning
and
compile_stderr
:
# Print errors just below the command line.
# Print errors just below the command line.
print
compile_stderr
print
compile_stderr
if
py_module
:
if
py_module
:
#touch the __init__ file
#touch the __init__ file
file
(
os
.
path
.
join
(
location
,
"__init__.py"
),
'w'
)
.
close
()
open
(
os
.
path
.
join
(
location
,
"__init__.py"
),
'w'
)
.
close
()
return
dlimport
(
lib_filename
)
return
dlimport
(
lib_filename
)
...
...
theano/gof/compiledir.py
浏览文件 @
5e516c42
...
@@ -27,7 +27,7 @@ try:
...
@@ -27,7 +27,7 @@ try:
stdin
=
dummy_in
.
fileno
(),
stdin
=
dummy_in
.
fileno
(),
stderr
=
dummy_err
.
fileno
())
stderr
=
dummy_err
.
fileno
())
p
.
wait
()
p
.
wait
()
gcc_version_str
=
p
.
stdout
.
readline
()
.
strip
()
gcc_version_str
=
p
.
stdout
.
readline
()
.
strip
()
.
decode
()
except
OSError
:
except
OSError
:
# Typically means gcc cannot be found.
# Typically means gcc cannot be found.
gcc_version_str
=
'GCC_NOT_FOUND'
gcc_version_str
=
'GCC_NOT_FOUND'
...
...
theano/gof/lazylinker_c.c.txt
浏览文件 @
5e516c42
...
@@ -13,6 +13,17 @@ typedef int Py_ssize_t;
...
@@ -13,6 +13,17 @@ typedef int Py_ssize_t;
#define PyNumber_AsSsize_t(ob, exc) PyInt_AsLong(ob)
#define PyNumber_AsSsize_t(ob, exc) PyInt_AsLong(ob)
#endif
#endif
#if PY_VERSION_HEX >= 0x03000000
#include "numpy/npy_3kcompat.h"
#define PyCObject_AsVoidPtr NpyCapsule_AsVoidPtr
#define PyCObject_GetDesc NpyCapsule_GetDesc
#define PyCObject_Check NpyCapsule_Check
#endif
#ifndef Py_TYPE
#define Py_TYPE(obj) obj->ob_type
#endif
/**
/**
TODO:
TODO:
...
@@ -172,7 +183,7 @@ CLazyLinker_dealloc(PyObject* _self)
...
@@ -172,7 +183,7 @@ CLazyLinker_dealloc(PyObject* _self)
Py_XDECREF(self->call_times);
Py_XDECREF(self->call_times);
Py_XDECREF(self->call_counts);
Py_XDECREF(self->call_counts);
Py_XDECREF(self->pre_call_clear);
Py_XDECREF(self->pre_call_clear);
self->ob_type
->tp_free((PyObject*)self);
Py_TYPE(self)
->tp_free((PyObject*)self);
}
}
static PyObject *
static PyObject *
CLazyLinker_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
CLazyLinker_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
...
@@ -937,8 +948,12 @@ static PyMemberDef CLazyLinker_members[] = {
...
@@ -937,8 +948,12 @@ static PyMemberDef CLazyLinker_members[] = {
};
};
static PyTypeObject lazylinker_ext_CLazyLinkerType = {
static PyTypeObject lazylinker_ext_CLazyLinkerType = {
#if defined(NPY_PY3K)
PyVarObject_HEAD_INIT(NULL, 0)
#else
PyObject_HEAD_INIT(NULL)
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
0, /*ob_size*/
#endif
"lazylinker_ext.CLazyLinker", /*tp_name*/
"lazylinker_ext.CLazyLinker", /*tp_name*/
sizeof(CLazyLinker), /*tp_basicsize*/
sizeof(CLazyLinker), /*tp_basicsize*/
0, /*tp_itemsize*/
0, /*tp_itemsize*/
...
@@ -992,19 +1007,42 @@ static PyMethodDef lazylinker_ext_methods[] = {
...
@@ -992,19 +1007,42 @@ static PyMethodDef lazylinker_ext_methods[] = {
#ifndef PyMODINIT_FUNC /* declarations for DLL import/export */
#ifndef PyMODINIT_FUNC /* declarations for DLL import/export */
#define PyMODINIT_FUNC void
#define PyMODINIT_FUNC void
#endif
#endif
#if defined(NPY_PY3K)
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"lazylinker_ext",
NULL,
-1,
lazylinker_ext_methods,
NULL,
NULL,
NULL,
NULL
};
#endif
#if defined(NPY_PY3K)
#define RETVAL m
PyObject *PyInit_lazylinker_ext(void) {
#else
PyMODINIT_FUNC
PyMODINIT_FUNC
initlazylinker_ext(void)
initlazylinker_ext(void)
{
{
#endif
PyObject* m;
PyObject* m;
lazylinker_ext_CLazyLinkerType.tp_new = PyType_GenericNew;
lazylinker_ext_CLazyLinkerType.tp_new = PyType_GenericNew;
if (PyType_Ready(&lazylinker_ext_CLazyLinkerType) < 0)
if (PyType_Ready(&lazylinker_ext_CLazyLinkerType) < 0)
return;
return RETVAL;
#if defined(NPY_PY3K)
m = PyModule_Create(&moduledef);
#else
m = Py_InitModule3("lazylinker_ext", lazylinker_ext_methods,
m = Py_InitModule3("lazylinker_ext", lazylinker_ext_methods,
"Example module that creates an extension type.");
"Example module that creates an extension type.");
#endif
Py_INCREF(&lazylinker_ext_CLazyLinkerType);
Py_INCREF(&lazylinker_ext_CLazyLinkerType);
PyModule_AddObject(m, "CLazyLinker", (PyObject *)&lazylinker_ext_CLazyLinkerType);
PyModule_AddObject(m, "CLazyLinker", (PyObject *)&lazylinker_ext_CLazyLinkerType);
return RETVAL;
}
}
theano/gof/lazylinker_c.py
浏览文件 @
5e516c42
import
errno
import
errno
import
os
,
logging
,
sys
import
os
,
logging
,
sys
from
six.moves
import
reload_module
as
reload
import
theano
import
theano
from
theano
import
config
from
theano
import
config
...
@@ -45,7 +46,7 @@ try:
...
@@ -45,7 +46,7 @@ try:
assert
os
.
path
.
isdir
(
location
)
assert
os
.
path
.
isdir
(
location
)
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
location
,
'__init__.py'
)):
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
location
,
'__init__.py'
)):
file
(
os
.
path
.
join
(
location
,
'__init__.py'
),
'w'
)
.
close
()
open
(
os
.
path
.
join
(
location
,
'__init__.py'
),
'w'
)
.
close
()
_need_reload
=
False
_need_reload
=
False
if
force_compile
:
if
force_compile
:
...
...
theano/scalar/basic_scipy.py
浏览文件 @
5e516c42
...
@@ -13,7 +13,9 @@ imported_scipy_special = False
...
@@ -13,7 +13,9 @@ imported_scipy_special = False
try
:
try
:
import
scipy.special
import
scipy.special
imported_scipy_special
=
True
imported_scipy_special
=
True
except
ImportError
:
# Importing scipy.special may raise ValueError.
# See http://projects.scipy.org/scipy/ticket/1739
except
(
ImportError
,
ValueError
):
pass
pass
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论