Commit 1a1822c3 authored by Philipp Arras's avatar Philipp Arras

Cosmetics

parent 9f23622d
Pipeline #31069 passed with stages
in 1 minute and 24 seconds
......@@ -9,15 +9,12 @@ class LocalModel(NonlinearOperator):
Computes nonlinearity(inp)
"""
super(LocalModel, self).__init__(position)
self._inp = inp.at(self.position)
self._nonlinearity = nonlinearity
self._value = nonlinearity(self._inp.value)
# Gradient
self._gradient = makeOp(
self._nonlinearity.derivative(self._inp.value))*self._inp.gradient
d_inner = self._inp.gradient
d_outer = makeOp(self._nonlinearity.derivative(self._inp.value))
self._gradient = d_outer * d_inner
def at(self, position):
return self.__class__(position, self._inp, self._nonlinearity)
......@@ -26,7 +26,6 @@ class NonlinearOperator(object):
sel = SelectionOperator(self.value.domain, key)
return sel(self)
# TODO Support addition and multiplication with fields
def __add__(self, other):
assert isinstance(other, NonlinearOperator)
return Add.make(self, other)
......@@ -135,7 +134,6 @@ class LinearModel(NonlinearOperator):
self._lin_op = lin_op
self._inp = inp
# FIXME This is a dirty hack!
if isinstance(self._lin_op, SelectionOperator):
self._lin_op = SelectionOperator(self._inp.value.domain,
self._lin_op._key)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment