提交 625e298a authored 作者: Olivier Breuleux's avatar Olivier Breuleux

finished porting the ops

上级 8c211535
...@@ -34,7 +34,14 @@ class _test_TensorOps(unittest.TestCase): ...@@ -34,7 +34,14 @@ class _test_TensorOps(unittest.TestCase):
e = (x + y) * 2 e = (x + y) * 2
fn, i, o = gof.PerformLinker(env([x, y], [e])).make_thunk(True) fn, i, o = gof.PerformLinker(env([x, y], [e])).make_thunk(True)
fn() fn()
print e assert (e.data == numpy.array([[8, 12], [8, 12]])).all()
def test_1(self):
x, y, z = inputs()
e = dot(x, z).T
fn, i, o = gof.PerformLinker(env([x, z], [e])).make_thunk(True)
fn()
assert (e.data == numpy.array([[3, 3, 3], [7, 7, 7]]).T).all()
# def test_0(self): # def test_0(self):
# x, y, z = inputs() # x, y, z = inputs()
......
"""
Helper functions to make gof backwards compatible (tested on python 2.4 and 2.5)
"""
import sys
if sys.version_info[:2] < (2,5):
def all(iterable):
for element in iterable:
if not element:
return False
return True
else:
# Only bother with this else clause and the __all__ line if you are putting
# this in a separate file.
import __builtin__
all = __builtin__.all
__all__ = ['all']
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论