提交 bf053fca authored 作者: Francesco Visin's avatar Francesco Visin

Improve dev start guide and extending theano

- Move the contribution requirements on top, so that contributors read them even if they know how to setup GitHub - Fix minor errors - Remove commented code in elemwise
上级 043cdaea
差异被折叠。
...@@ -476,10 +476,8 @@ Here is an example showing how to use ``verify_grad`` on an Op instance: ...@@ -476,10 +476,8 @@ Here is an example showing how to use ``verify_grad`` on an Op instance:
.. testcode:: .. testcode::
def test_flatten_outdimNone(): def test_flatten_outdimNone():
""" # Testing gradient w.r.t. all inputs of an op (in this example the op
Testing gradient w.r.t. all inputs of an op (in this example the op # being used is Flatten(), which takes a single input).
being used is Flatten(), which takes a single input).
"""
a_val = numpy.asarray([[0,1,2],[3,4,5]], dtype='float64') a_val = numpy.asarray([[0,1,2],[3,4,5]], dtype='float64')
rng = numpy.random.RandomState(42) rng = numpy.random.RandomState(42)
tensor.verify_grad(tensor.Flatten(), [a_val], rng=rng) tensor.verify_grad(tensor.Flatten(), [a_val], rng=rng)
......
...@@ -356,11 +356,6 @@ class DimShuffle(Op): ...@@ -356,11 +356,6 @@ class DimShuffle(Op):
"if (strides[%(i)s] == 0) strides[%(i)s] = strides[%(i)s+1] * " "if (strides[%(i)s] == 0) strides[%(i)s] = strides[%(i)s+1] * "
"dimensions[%(i)s+1]" % dict(i=str(i))) "dimensions[%(i)s+1]" % dict(i=str(i)))
#
# PyObject* PyArray_New(PyTypeObject* subtype, int nd, npy_intp* dims,
# int type_num, npy_intp* strides, void* data,
# int itemsize, int flags, PyObject* obj)
#
close_bracket = [ close_bracket = [
# create a new array, # create a new array,
('%(res)s = (PyArrayObject*)PyArray_New(&PyArray_Type, ' ('%(res)s = (PyArrayObject*)PyArray_New(&PyArray_Type, '
...@@ -494,17 +489,17 @@ class Elemwise(OpenMPOp): ...@@ -494,17 +489,17 @@ class Elemwise(OpenMPOp):
variable number of inputs), whereas the numpy function may variable number of inputs), whereas the numpy function may
not have varargs. not have varargs.
Examples Note
-------- ----
>>> Elemwise(add) # represents + on tensors (x + y) | Elemwise(add) represents + on tensors (x + y)
>>> Elemwise(add, {0 : 0}) # represents the += operation (x += y) | Elemwise(add, {0 : 0}) represents the += operation (x += y)
>>> Elemwise(add, {0 : 1}) # represents += on the second argument (y += x) | Elemwise(add, {0 : 1}) represents += on the second argument (y += x)
>>> Elemwise(mul)(rand(10, 5), rand(1, 5)) # the second input is completed | Elemwise(mul)(rand(10, 5), rand(1, 5)) the second input is completed \
>>> # along the first dimension to match the first input along the first dimension to match the first input
>>> Elemwise(true_div)(rand(10, 5), rand(10, 1)) # same but along the | Elemwise(true_div)(rand(10, 5), rand(10, 1)) same but along the \
>>> # second dimension second dimension
>>> Elemwise(int_div)(rand(1, 5), rand(10, 1)) # the output has size (10, 5) | Elemwise(int_div)(rand(1, 5), rand(10, 1)) the output has size (10, 5)
>>> Elemwise(log)(rand(3, 4, 5)) | Elemwise(log)(rand(3, 4, 5))
""" """
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论