Skip to content
Snippets Groups Projects
Commit bfc24760 authored by Stephan Seitz's avatar Stephan Seitz
Browse files

Lint and .gitlab-ci.yml

parent 7acd3fba
No related branches found
No related tags found
No related merge requests found
Pipeline #17020 failed
[flake8]
max-line-length=120
ignore = W293 W503 W291
......@@ -13,8 +13,7 @@ minimal-windows:
- conda env list
- python -c "import numpy"
- pip install -e .
- pip install pytest
- pytest
- python3 setup.py test
minimal-ubuntu:
stage: test
......@@ -23,7 +22,8 @@ minimal-ubuntu:
- $ENABLE_NIGHTLY_BUILDS
image: i10git.cs.fau.de:5005/pycodegen/pycodegen/minimal_ubuntu
script:
- pytest
- pip install -e .
- python3 setup.py test
tags:
- docker
......@@ -35,8 +35,7 @@ minimal-conda:
image: i10git.cs.fau.de:5005/pycodegen/pycodegen/minimal_conda
script:
- pip install -e .
- pip install pytest
- pytest
- python3 setup.py test
tags:
- docker
......
......@@ -30,7 +30,7 @@ package_dir =
# DON'T CHANGE THE FOLLOWING LINE! IT WILL BE UPDATED BY PYSCAFFOLD!
setup_requires = pyscaffold>=3.2a0,<3.3a0
# Add here dependencies of your project (semicolon/line-separated), e.g.
install_requires = numpy;pystencils;jinja2
install_requires = numpy;pystencils>=0.2.6;jinja2
# The usage of test_requires is discouraged, see `Dependency Management` docs
tests_require = pytest;pytest-cov;tensorflow;torch
# Require a specific Python version, e.g. Python 2.7 or >= 3.4
......@@ -110,6 +110,8 @@ exclude =
dist
.eggs
docs/conf.py
max-line-length=120
ignore = W293 W503 W291 W504
[pyscaffold]
# PyScaffold's parameters when the project was created.
......
import pystencils_autodiff.backends
from pystencils_autodiff._field_to_tensors import (
import pystencils_autodiff.backends # NOQA
from pystencils_autodiff._field_to_tensors import ( # NOQA
tf_constant_from_field, tf_placeholder_from_field, tf_scalar_variable_from_field,
tf_variable_from_field, torch_tensor_from_field)
from pystencils_autodiff.adjoint_field import AdjointField
......
import numpy as np
import pystencils as ps
from pystencils_autodiff.backends import AVAILABLE_BACKENDS
......@@ -10,7 +9,9 @@ def fix_layout(array, target_field, backend):
# Just index coordinate wrong?
swapped_array = np.swapaxes(array, 0, -1)
if swapped_array.strides == target_field.strides and swapped_array.shape == target_field.shade and target_field.index_dimensions == 1:
if (swapped_array.strides == target_field.strides and
swapped_array.shape == target_field.shade and
target_field.index_dimensions == 1):
array = swapped_array
# Everything ok
......
......@@ -12,7 +12,7 @@ class AdjointField(pystencils.Field):
def __init__(self, forward_field, name_prefix='diff'):
new_name = name_prefix + forward_field.name
super().__init__(new_name, forward_field.field_type, forward_field._dtype,
forward_field._layout, forward_field.shape, forward_field.strides)
forward_field._layout, forward_field.shape, forward_field.strides)
self.corresponding_forward_field = forward_field
self.name_prefix = name_prefix
......
......@@ -281,7 +281,8 @@ Backward:
if forward_read_field in self._time_constant_fields:
# Accumulate in case of time_constant_fields
assignment = ps.Assignment(
diff_read_field.center_vector[index], diff_read_field.center_vector[index] + diff_read_field_sum[index])
diff_read_field.center_vector[index],
diff_read_field.center_vector[index] + diff_read_field_sum[index])
else:
# If time dependent, we just need to assign the sum for the current time step
assignment = ps.Assignment(
......@@ -302,7 +303,7 @@ Backward:
if self._do_common_subexpression_elimination:
backward_assignments = ps.simp.sympy_cse_on_assignment_list(
backward_assignments)
except:
except Exception:
pass
# print("Common subexpression elimination failed")
# print(err)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment