提交 ece7b6fd authored 作者: Olivier Delalleau's avatar Olivier Delalleau

PEP8 fixes

上级 9f009ab1
...@@ -2685,6 +2685,7 @@ where = switch ...@@ -2685,6 +2685,7 @@ where = switch
# Bit-wise # Bit-wise
########################## ##########################
@_scal_elemwise_with_nfunc('bitwise_and', 2, 1) @_scal_elemwise_with_nfunc('bitwise_and', 2, 1)
def and_(a, b): def and_(a, b):
"""bitwise a & b""" """bitwise a & b"""
...@@ -4334,8 +4335,10 @@ class Subtensor(Op): ...@@ -4334,8 +4335,10 @@ class Subtensor(Op):
while (inner_ii < %(c_prefix)s_NDIM(%(xview)s)) while (inner_ii < %(c_prefix)s_NDIM(%(xview)s))
{ {
assert (outer_ii < %(c_prefix)s_NDIM(%(x)s)); assert (outer_ii < %(c_prefix)s_NDIM(%(x)s));
%(set_dim)s(%(xview)s, inner_ii, %(c_prefix)s_DIMS(%(x)s)[outer_ii]); %(set_dim)s(%(xview)s, inner_ii,
%(set_stride)s(%(xview)s, inner_ii, %(c_prefix)s_STRIDES(%(x)s)[outer_ii]); %(c_prefix)s_DIMS(%(x)s)[outer_ii]);
%(set_stride)s(%(xview)s, inner_ii,
%(c_prefix)s_STRIDES(%(x)s)[outer_ii]);
inner_ii += 1; inner_ii += 1;
outer_ii += 1; outer_ii += 1;
} }
...@@ -4469,8 +4472,8 @@ def batched_dot(x, y): ...@@ -4469,8 +4472,8 @@ def batched_dot(x, y):
""" """
:param x: A Tensor with sizes e.g.: for 3D (dim1, dim3, dim2) :param x: A Tensor with sizes e.g.: for 3D (dim1, dim3, dim2)
:param y: A Tensor with sizes e.g.: for 3D (dim1, dim2, dim4) :param y: A Tensor with sizes e.g.: for 3D (dim1, dim2, dim4)
This function computes the dot product between the two tensors, by iterating This function computes the dot product between the two tensors, by
over the first dimension using scan. iterating over the first dimension using scan.
Returns a tensor of size e.g. if it is 3D: (dim1, dim3, dim4) Returns a tensor of size e.g. if it is 3D: (dim1, dim3, dim4)
Example: Example:
>>> first = T.tensor3('first') >>> first = T.tensor3('first')
...@@ -5727,7 +5730,8 @@ class Reshape(Op): ...@@ -5727,7 +5730,8 @@ class Reshape(Op):
// -- will err if this will downcast. This could happen if the // -- will err if this will downcast. This could happen if the
// -- user pass an int64 dtype, but npy_intp endup being int32. // -- user pass an int64 dtype, but npy_intp endup being int32.
new_dims[ii] = ((dtype_%(shp)s*)( new_dims[ii] = ((dtype_%(shp)s*)(
PyArray_BYTES(%(shp)s) + ii * PyArray_STRIDES(%(shp)s)[0]))[0]; PyArray_BYTES(%(shp)s) +
ii * PyArray_STRIDES(%(shp)s)[0]))[0];
} }
Py_XDECREF(%(z)s); Py_XDECREF(%(z)s);
%(z)s = (PyArrayObject *) PyArray_Newshape(%(x)s, &newshape, %(z)s = (PyArrayObject *) PyArray_Newshape(%(x)s, &newshape,
...@@ -5939,8 +5943,8 @@ def tile(x, reps, ndim=None): ...@@ -5939,8 +5943,8 @@ def tile(x, reps, ndim=None):
ndim = len(reps) ndim = len(reps)
# backport # backport
# ndim = len(reps) if ndim is None else ndim # not sure if len(shp) is going # ndim = len(reps) if ndim is None else ndim
# to work. # not sure if len(shp) is going to work.
if ndim not in tile.op: if ndim not in tile.op:
tile.op[ndim] = Tile(ndim) tile.op[ndim] = Tile(ndim)
return tile.op[ndim](x, reps) return tile.op[ndim](x, reps)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论