Example #1
0
def MakeModel(params = None):
  """Create a Glimpse model.

  .. seealso::
     :func:`SetModelClass`

  """
  if params == None:
    params = GetParams()
  return __MODEL_CLASS(backends.MakeBackend(), params)
Example #2
0
    def __init__(self, backend=None, params=None):
        """Create new object.

    :param backend: Implementation of backend operations, such as dot-products.
    :param params: Model configuration.

    """
        if backend == None:
            backend = backends.MakeBackend()
        else:
            backend = copy.copy(backend)
        if params == None:
            params = self.ParamClass()
        else:
            if not isinstance(params, self.ParamClass):
                raise ValueError("Params object has wrong type: expected %s, got %s" % \
                    (self.ParamClass, type(params)))
            params = copy.copy(params)
        self.backend = backend
        self.params = params
Example #3
0
    def __init__(self, backend=None, params=None):
        """Create new object.

    :param backend: Implementation of backend operations, such as dot-products.
    :param params: Model configuration.

    """
        if backend == None:
            backend = backends.MakeBackend()
        else:
            backend = copy.copy(backend)
        if params == None:
            params = self.ParamClass()
        else:
            if not isinstance(params, self.ParamClass):
                raise ValueError("Params object has wrong type: expected %s, got %s" % \
                    (self.ParamClass, type(params)))
            params = copy.copy(params)
        # Make sure parameter container is sub-class of BaseParams.
        assert isinstance(params, BaseParams), "Internal error: model " \
            "configuration uses parameter container that does not inherit from " \
            "BaseParams"
        self.backend = backend
        self.params = params
 def __init__(self, backend):
     if backend == None:
         backend = backends.MakeBackend()
     self.backend = backend
     self.params = Params()