提交 001e2cd8 authored 作者: Olivier Breuleux's avatar Olivier Breuleux

__instance_type__ -> InstanceType

上级 f7e4787b
...@@ -11,7 +11,7 @@ import numpy as N ...@@ -11,7 +11,7 @@ import numpy as N
class LogisticRegressionN(module.FancyModule): class LogisticRegressionN(module.FancyModule):
class __instance_type__(module.FancyModuleInstance): class InstanceType(module.FancyModuleInstance):
def initialize(self, n_in, n_out): def initialize(self, n_in, n_out):
#self.component is the LogisticRegressionTemplate instance that built this guy. #self.component is the LogisticRegressionTemplate instance that built this guy.
...@@ -47,7 +47,7 @@ class LogisticRegressionN(module.FancyModule): ...@@ -47,7 +47,7 @@ class LogisticRegressionN(module.FancyModule):
self.apply = module.Method([self.x], T.argmax(T.dot(self.x, self.w) + self.b, axis=1)) self.apply = module.Method([self.x], T.argmax(T.dot(self.x, self.w) + self.b, axis=1))
class LogisticRegression2(module.FancyModule): class LogisticRegression2(module.FancyModule):
class __instance_type__(module.FancyModuleInstance): class InstanceType(module.FancyModuleInstance):
def initialize(self, n_in): def initialize(self, n_in):
#self.component is the LogisticRegressionTemplate instance that built this guy. #self.component is the LogisticRegressionTemplate instance that built this guy.
......
...@@ -486,7 +486,7 @@ class ModuleInstance(CompositeInstance): ...@@ -486,7 +486,7 @@ class ModuleInstance(CompositeInstance):
class Module(Composite): class Module(Composite):
__instance_type__ = ModuleInstance InstanceType = ModuleInstance
def __init__(self, components = {}, **kwcomponents): def __init__(self, components = {}, **kwcomponents):
super(Module, self).__init__() super(Module, self).__init__()
...@@ -507,7 +507,7 @@ class Module(Composite): ...@@ -507,7 +507,7 @@ class Module(Composite):
return self._components.iteritems() return self._components.iteritems()
def build(self, mode, memo): def build(self, mode, memo):
inst = self.__instance_type__(self, {}) inst = self.InstanceType(self, {})
for name, c in self._components.iteritems(): for name, c in self._components.iteritems():
x = c.build(mode, memo) x = c.build(mode, memo)
if x is not None: if x is not None:
...@@ -601,7 +601,7 @@ class FancyModuleInstance(ModuleInstance): ...@@ -601,7 +601,7 @@ class FancyModuleInstance(ModuleInstance):
self.__dict__[attr] = value self.__dict__[attr] = value
class FancyModule(Module): class FancyModule(Module):
__instance_type__ = FancyModuleInstance InstanceType = FancyModuleInstance
def __wrapper__(self, x): def __wrapper__(self, x):
return wrap(x) return wrap(x)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论