Commit 7db7646b authored by Philipp Arras's avatar Philipp Arras
Browse files

Add explicit local models

parent 93314cc2
Pipeline #31078 passed with stages
in 1 minute and 24 seconds
from .constant import Constant
from .local_nonlinearity import LocalModel
from .local_nonlinearity import (LocalModel, PointwiseExponential,
PointwisePositiveTanh, PointwiseTanh)
from .model import LinearModel, Model
from .variable import Variable
__all__ = ['Model', 'Constant', 'LocalModel', 'Variable',
'LinearModel', 'PointwiseTanh', 'PointwisePositiveTanh',
from nifty4.library.nonlinearities import Exponential, PositiveTanh, Tanh
from nifty4.sugar import makeOp
from .model import Model
......@@ -18,3 +19,15 @@ class LocalModel(Model):
def at(self, position):
return self.__class__(, self._nonlinearity)
def PointwiseExponential(inp):
return LocalModel(inp, Exponential())
def PointwiseTanh(inp):
return LocalModel(inp, Tanh())
def PointwisePositiveTanh(inp):
return LocalModel(inp, PositiveTanh())
Supports Markdown
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