提交 557ded05 authored 作者: AndreiCostinescu's avatar AndreiCostinescu

Changed comments to docstrings where necessary in theano/gof/tests

上级 1983af1c
# We don't have real tests for the cache, but it would be great to make them!
#
# But this one tests a current behavior that isn't good: the c_code isn't
# deterministic based on the input type and the op.
"""
We don't have real tests for the cache, but it would be great to make them!
But this one tests a current behavior that isn't good: the c_code isn't
deterministic based on the input type and the op.
"""
from __future__ import absolute_import, print_function, division
import numpy as np
......
......@@ -19,7 +19,9 @@ from theano.tensor.basic import _allclose
# Used in TestComputeTestValue.test_no_perform
class IncOneC(Op):
# An Op with only a C (c_code) implementation
"""
An Op with only a C (c_code) implementation
"""
__props__ = ()
def make_node(self, input):
......@@ -332,7 +334,9 @@ class TestComputeTestValue(unittest.TestCase):
def test_no_c_code(self):
class IncOnePython(Op):
# An Op with only a Python (perform) implementation
"""
An Op with only a Python (perform) implementation
"""
__props__ = ()
def make_node(self, input):
......
......@@ -256,20 +256,21 @@ class TestToposort:
class TestIsSameGraph(unittest.TestCase):
def check(self, expected, debug=True):
# Core function to perform comparison.
#
# :param expected: A list of tuples (v1, v2, ((g1, o1), ..., (gN, oN)))
# with:
# - `v1` and `v2` two Variables (the graphs to be compared)
# - `gj` a `givens` dictionary to give as input to `is_same_graph`
# - `oj` the expected output of `is_same_graph(v1, v2, givens=gj)`
#
# :param debug: If True, then we make sure we are testing both
# implementations of `is_same_graph`.
#
# This function also tries to call `is_same_graph` by inverting `v1` and
# `v2`, and ensures the output remains the same.
"""
Core function to perform comparison.
:param expected: A list of tuples (v1, v2, ((g1, o1), ..., (gN, oN)))
with:
- `v1` and `v2` two Variables (the graphs to be compared)
- `gj` a `givens` dictionary to give as input to `is_same_graph`
- `oj` the expected output of `is_same_graph(v1, v2, givens=gj)`
:param debug: If True, then we make sure we are testing both
implementations of `is_same_graph`.
This function also tries to call `is_same_graph` by inverting `v1` and
`v2`, and ensures the output remains the same.
"""
for v1, v2, go in expected:
for gj, oj in go:
r1 = is_same_graph(v1, v2, givens=gj, debug=debug)
......
......@@ -71,8 +71,7 @@ MyOp = MyOp()
class NoInputOp(Op):
# An Op to test the corner-case of an Op with no input.
"""An Op to test the corner-case of an Op with no input."""
__props__ = ()
def make_node(self):
......@@ -160,7 +159,7 @@ class TestMakeThunk(unittest.TestCase):
def test_no_c_code(self):
class IncOnePython(Op):
# An Op with only a Python (perform) implementation
"""An Op with only a Python (perform) implementation"""
__props__ = ()
def make_node(self, input):
......@@ -197,7 +196,7 @@ class TestMakeThunk(unittest.TestCase):
def test_no_perform(self):
class IncOneC(Op):
# An Op with only a C (c_code) implementation
"""An Op with only a C (c_code) implementation"""
__props__ = ()
def make_node(self, input):
......@@ -237,8 +236,7 @@ class TestMakeThunk(unittest.TestCase):
def test_no_make_node(self):
class DoubleOp(Op):
# An Op without make_node
"""An Op without make_node"""
__props__ = ()
itypes = [T.dmatrix]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论