提交 47255ce3 authored 作者: Iban Harlouchet's avatar Iban Harlouchet

flake8 for tensor/fourier.py

上级 47853608
...@@ -87,8 +87,8 @@ class Fourier(gof.Op): ...@@ -87,8 +87,8 @@ class Fourier(gof.Op):
if len(shape_a) == 1: if len(shape_a) == 1:
return [(n,)] return [(n,)]
elif isinstance(axis, tensor.TensorConstant): elif isinstance(axis, tensor.TensorConstant):
out_shape = list(shape_a[0: axis.data.item()]) + [n] +\ out_shape = (list(shape_a[0: axis.data.item()]) + [n] +
list(shape_a[axis.data + 1:]) list(shape_a[axis.data + 1:]))
else: else:
l = len(shape_a) l = len(shape_a)
shape_a = tensor.stack(*shape_a) shape_a = tensor.stack(*shape_a)
...@@ -136,7 +136,8 @@ class Fourier(gof.Op): ...@@ -136,7 +136,8 @@ class Fourier(gof.Op):
flip_shape = list(numpy.arange(0, a.ndim)[::-1]) flip_shape = list(numpy.arange(0, a.ndim)[::-1])
res = res.dimshuffle(flip_shape) res = res.dimshuffle(flip_shape)
res = tensor.switch(tensor.lt(n, tensor.shape(a)[axis]), res = tensor.switch(tensor.lt(n, tensor.shape(a)[axis]),
tensor.set_subtensor(res[n::, ], 0, False, False), res) tensor.set_subtensor(res[n::, ], 0, False, False),
res)
res = res.dimshuffle(flip_shape) res = res.dimshuffle(flip_shape)
# insures that gradient shape conforms to input shape: # insures that gradient shape conforms to input shape:
......
...@@ -57,7 +57,6 @@ whitelist_flake8 = [ ...@@ -57,7 +57,6 @@ whitelist_flake8 = [
"typed_list/tests/test_type.py", "typed_list/tests/test_type.py",
"typed_list/tests/test_opt.py", "typed_list/tests/test_opt.py",
"typed_list/tests/test_basic.py", "typed_list/tests/test_basic.py",
"tensor/fourier.py",
"tensor/__init__.py", "tensor/__init__.py",
"tensor/opt_uncanonicalize.py", "tensor/opt_uncanonicalize.py",
"tensor/blas.py", "tensor/blas.py",
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论