提交 04e168d0 authored 作者: Olivier Breuleux's avatar Olivier Breuleux

done with half of the part of advanced tutorial's first example that deals with C code

上级 5786d6bf
...@@ -4,3 +4,15 @@ ...@@ -4,3 +4,15 @@
======================= =======================
Compilation and Linking Compilation and Linking
======================= =======================
.. index::
single: Linker
.. _linker:
Linker
======
WRITEME
...@@ -245,11 +245,9 @@ operators (well, pending revision of this tutorial, I guess): ...@@ -245,11 +245,9 @@ operators (well, pending revision of this tutorial, I guess):
class BinaryDoubleOp(gof.Op): class BinaryDoubleOp(gof.Op):
def __init__(self, name, fn, gradfnx, gradfny): def __init__(self, name, fn):
self.name = name self.name = name
self.fn = fn self.fn = fn
self.gradfnx = gradfnx
self.gradfny = gradfny
def make_node(self, x, y): def make_node(self, x, y):
if isinstance(x, (int, float)): if isinstance(x, (int, float)):
......
...@@ -319,6 +319,7 @@ class Tensor(Type): ...@@ -319,6 +319,7 @@ class Tensor(Type):
return """ return """
Py_XDECREF(py_%(name)s); Py_XDECREF(py_%(name)s);
if (!%(name)s) { if (!%(name)s) {
Py_XINCREF(Py_None);
py_%(name)s = Py_None; py_%(name)s = Py_None;
} }
else if ((void*)py_%(name)s != (void*)%(name)s) { else if ((void*)py_%(name)s != (void*)%(name)s) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论