Commit 1a1822c3 by Philipp Arras

### Cosmetics

parent 9f23622d
Pipeline #31069 passed with stages
in 1 minute and 24 seconds
 ... @@ -9,15 +9,12 @@ class LocalModel(NonlinearOperator): ... @@ -9,15 +9,12 @@ class LocalModel(NonlinearOperator): Computes nonlinearity(inp) Computes nonlinearity(inp) """ """ super(LocalModel, self).__init__(position) super(LocalModel, self).__init__(position) self._inp = inp.at(self.position) self._inp = inp.at(self.position) self._nonlinearity = nonlinearity self._nonlinearity = nonlinearity self._value = nonlinearity(self._inp.value) self._value = nonlinearity(self._inp.value) d_inner = self._inp.gradient # Gradient d_outer = makeOp(self._nonlinearity.derivative(self._inp.value)) self._gradient = makeOp( self._gradient = d_outer * d_inner self._nonlinearity.derivative(self._inp.value))*self._inp.gradient def at(self, position): def at(self, position): return self.__class__(position, self._inp, self._nonlinearity) return self.__class__(position, self._inp, self._nonlinearity)
 ... @@ -26,7 +26,6 @@ class NonlinearOperator(object): ... @@ -26,7 +26,6 @@ class NonlinearOperator(object): sel = SelectionOperator(self.value.domain, key) sel = SelectionOperator(self.value.domain, key) return sel(self) return sel(self) # TODO Support addition and multiplication with fields def __add__(self, other): def __add__(self, other): assert isinstance(other, NonlinearOperator) assert isinstance(other, NonlinearOperator) return Add.make(self, other) return Add.make(self, other) ... @@ -135,7 +134,6 @@ class LinearModel(NonlinearOperator): ... @@ -135,7 +134,6 @@ class LinearModel(NonlinearOperator): self._lin_op = lin_op self._lin_op = lin_op self._inp = inp self._inp = inp # FIXME This is a dirty hack! if isinstance(self._lin_op, SelectionOperator): if isinstance(self._lin_op, SelectionOperator): self._lin_op = SelectionOperator(self._inp.value.domain, self._lin_op = SelectionOperator(self._inp.value.domain, self._lin_op._key) 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!