当前位置: 首页>>代码示例>>Python>>正文


Python Module.__init__方法代码示例

本文整理汇总了Python中module.Module.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Module.__init__方法的具体用法?Python Module.__init__怎么用?Python Module.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在module.Module的用法示例。


在下文中一共展示了Module.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from module import Module [as 别名]
# 或者: from module.Module import __init__ [as 别名]
 def __init__(self, dim, nNeurons, name=None, outputFullMap=False):
     if outputFullMap: 
         outdim = nNeurons ** 2
     else: 
         outdim = 2
     Module.__init__(self, dim, outdim, name)
     
     # switch modes
     self.outputFullMap = outputFullMap
     
     # create neurons
     self.neurons = random.random((nNeurons, nNeurons, dim))
     self.difference = zeros(self.neurons.shape)
     self.winner = zeros(2)
     self.nInput = dim
     self.nNeurons = nNeurons
     self.neighbours = nNeurons 
     self.learningrate = 0.01
     self.neighbourdecay = 0.9999
     
     # distance matrix
     distx, disty = mgrid[0:self.nNeurons, 0:self.nNeurons]
     self.distmatrix = zeros((self.nNeurons, self.nNeurons, 2))
     self.distmatrix[:, :, 0] = distx
     self.distmatrix[:, :, 1] = disty
开发者ID:ZachPhillipsGary,项目名称:CS200-NLP-ANNsProject,代码行数:27,代码来源:kohonen.py

示例2: __init__

# 需要导入模块: from module import Module [as 别名]
# 或者: from module.Module import __init__ [as 别名]
 def __init__(self, probability=0.5, scaled=False):
     assert probability < 1 and probability > 0, 'probability must be (0,1)'
     Module.__init__(self)
     self.prob = probability
     self.train = True
     self.scaled = scaled
     self.noise = torch.Tensor()
开发者ID:onebitbrain,项目名称:torch,代码行数:9,代码来源:dropout.py

示例3: __init__

# 需要导入模块: from module import Module [as 别名]
# 或者: from module.Module import __init__ [as 别名]
 def __init__(self,args):
     Module.__init__(self,args)
     self.log_request = args.log_request
     self.log_response = args.log_response
     self.log = args.log
     self.data = args.data
     self.headers = args.headers
开发者ID:ymvunjq,项目名称:pyproxy,代码行数:9,代码来源:HTTPLogger.py

示例4: __init__

# 需要导入模块: from module import Module [as 别名]
# 或者: from module.Module import __init__ [as 别名]
 def __init__(self, input_size, output_size):
     Module.__init__(self)
     self.weight = Tensor(output_size, input_size)
     self.bias = Tensor(output_size)
     self.grad_weight = Tensor(output_size, input_size)
     self.grad_bias = Tensor(output_size)
     self.reset()
开发者ID:onebitbrain,项目名称:torch,代码行数:9,代码来源:linear.py

示例5: __init__

# 需要导入模块: from module import Module [as 别名]
# 或者: from module.Module import __init__ [as 别名]
    def __init__(self, dim, peepholes = False, name = None):
        """
        :arg dim: number of cells
        :key peepholes: enable peephole connections (from state to gates)? """
        self.setArgs(dim = dim, peepholes = peepholes)

        # Internal buffers, created dynamically:
        self.bufferlist = [
            ('ingate', dim),
            ('outgate', dim),
            ('forgetgate', dim),
            ('ingatex', dim),
            ('outgatex', dim),
            ('forgetgatex', dim),
            ('state', dim),
            ('ingateError', dim),
            ('outgateError', dim),
            ('forgetgateError', dim),
            ('stateError', dim),
        ]

        Module.__init__(self, 4*dim, dim, name)
        if self.peepholes:
            ParameterContainer.__init__(self, dim*3)
            self._setParameters(self.params)
            self._setDerivatives(self.derivs)
开发者ID:DanSGraham,项目名称:code,代码行数:28,代码来源:lstm.py

示例6: __init__

# 需要导入模块: from module import Module [as 别名]
# 或者: from module.Module import __init__ [as 别名]
 def __init__(self, context):
     Module.__init__(self, context)
     self.monitor_is_on = True
     self.status_label = render.OutlinedTextImg(color="#8888ff", outlinesize=2, size=20)
     self.bluetooth_address = context.get_config("bluetooth")
     if len(self.bluetooth_address) == 0:
         self.bluetooth_address = None
     # -1=scan failed, 0=not scanned, 1=not found, 2=found
     self.bluetooth_status = 0
开发者ID:tragatron,项目名称:informant,代码行数:11,代码来源:btscan.py

示例7: __init__

# 需要导入模块: from module import Module [as 别名]
# 或者: from module.Module import __init__ [as 别名]
 def __init__(self, context):
     Module.__init__(self, context)
     self.img = None
     self._next_index = 0
     self.img_rect = None
     self._files = []
     slideshow_dir = context.get_config("slideshow_dir")
     for filename in os.listdir(slideshow_dir):
         full_path = os.path.join(slideshow_dir, filename)
         if os.path.isfile(full_path):
             self._files.append(full_path)
     random.shuffle(self._files)
开发者ID:tragatron,项目名称:informant,代码行数:14,代码来源:slideshow.py

示例8: Tensor

# 需要导入模块: from module import Module [as 别名]
# 或者: from module.Module import __init__ [as 别名]
 def __init__ = (self, input_plane, output_plane, kw, kh, dw=1, dh=1, padding=0):
     Module.__init__(self)
     self.input_plane = input_plane
     self.output_plane = output_plane
     self.dw = dw
     self.dh = dh
     self.kw = kw
     self.kh = kh
     self.padding = padding
     self.weight = Tensor(output_plane, input_plane, kh, kw)
     self.bias = Tensor(output_plane)
     self.grad_weight = Tensor(output_plane, input_plane, kh, kw)
     self.grad_bias = Tensor(output_plane)
     self.reset()
开发者ID:onebitbrain,项目名称:torch,代码行数:16,代码来源:spatial_convolution.py

示例9: __init__

# 需要导入模块: from module import Module [as 别名]
# 或者: from module.Module import __init__ [as 别名]
 def __init__(self, context):
     Module.__init__(self, context)
     self._gradient = render.Gradient(context.width, self.GRADIENT_SIZE, pygame.Color(0, 0, 0, 0),
                                      pygame.Color(0, 0, 0, 255))
     self.zip_code = context.get_config("zip_code")
     if len(self.zip_code) == 0:
         self.zip_code = self._get_geoip()
     self.api_key = context.get_config("api_key")
     self.temp_label = render.OutlinedTextImg(color="#ffffff", outlinesize=2, size=60)
     self.weather_label = render.OutlinedTextImg(color="#ffffff", outlinesize=2, size=60)
     self.updated_label = render.TextImg(color="#ffffff", size=20)
     self.sun_label = render.TextImg(color="#ffffff", size=20)
     self.temp_f = ""
     self._updated_time = None
     self._had_error = False
开发者ID:tragatron,项目名称:informant,代码行数:17,代码来源:weather.py

示例10: __init__

# 需要导入模块: from module import Module [as 别名]
# 或者: from module.Module import __init__ [as 别名]
	def __init__(self, frame):
		Module.__init__(self, frame, 'submod0')
		self.label = QtWidgets.QLabel()
		#self.label.setGeometry(10,10,100,200)

		grid = QtWidgets.QGridLayout()
		self.setLayout(grid)

		grid.addWidget(self.label, 0, 0, 1, 1)
		reader = QtGui.QImageReader("Mod2Line.png")
		image = reader.read()
		qpixmap = QtGui.QPixmap()
		qpixmap.convertFromImage(image)
		self.label.setPixmap(qpixmap)
		self.changeStateComplete()
开发者ID:Saucyz,项目名称:explode,代码行数:17,代码来源:submod0.py

示例11: __init__

# 需要导入模块: from module import Module [as 别名]
# 或者: from module.Module import __init__ [as 别名]
	def __init__(self, frame):
		Module.__init__(self, frame, 'submod4')
		
		self.init = 1
		self.background = QtWidgets.QLabel()
		#self.label.setGeometry(10,10,100,200)

		grid = QtWidgets.QGridLayout()
		self.setLayout(grid)

		grid.addWidget(self.background, 0, 0, 100, 100)
		reader = QtGui.QImageReader("pie.png")
		image = reader.read()
		qpixmap = QtGui.QPixmap()
		qpixmap.convertFromImage(image)
		self.label.setPixmap(qpixmap)
开发者ID:Saucyz,项目名称:explode,代码行数:18,代码来源:submod4.py

示例12: __init__

# 需要导入模块: from module import Module [as 别名]
# 或者: from module.Module import __init__ [as 别名]
    def __init__(self,args):
        Module.__init__(self,args)
        if args.bytes:
            self.corrupt = corrupt_bytes
        else:
            self.corrupt = corrupt_bits

        self.number = args.number
        self.percentage = args.percentage

        self.corrupt_request = args.both or args.request
        self.corrupt_response = args.both or args.response

        # To be reproductible
        if not args.seed is None:
            random.seed(args.seed)
开发者ID:ymvunjq,项目名称:pyproxy,代码行数:18,代码来源:Corrupt.py

示例13: __init__

# 需要导入模块: from module import Module [as 别名]
# 或者: from module.Module import __init__ [as 别名]
	def __init__(self, frame):
		Module.__init__(self, frame, 'submod3')
		
		self.stage = 0
		self.init = 1
		self.posState2 = 0
		self.posState1 = 0
		self.selectedButton = 1
		self.background = QtWidgets.QLabel()
		self.background1 = QtWidgets.QLabel()
		self.button1 = QtWidgets.QPushButton()
		self.button2 = QtWidgets.QPushButton()
		self.button3 = QtWidgets.QPushButton()
		self.displayNum = QtWidgets.QLabel()
		self.select1 = QtWidgets.QLabel()
		self.select2 = QtWidgets.QLabel()
		self.select3 = QtWidgets.QLabel()

		self.stageLabel = QtWidgets.QLabel()
		grid = QtWidgets.QGridLayout()
		self.setLayout(grid)
		'''
		self.background = QtWidgets.QLabel()

		'''
		grid.addWidget(self.background, 0, 0, 0, 1)
		grid.addWidget(self.background1, 0, 0, 1, 0)
		grid.addWidget(self.button3, 2, 3)
		grid.addWidget(self.button2, 2, 2)
		grid.addWidget(self.button1, 2, 1)
		grid.addWidget(self.select3, 3, 3)
		grid.addWidget(self.select2, 3, 2)
		grid.addWidget(self.select1, 3, 1)
		grid.addWidget(self.displayNum, 1, 1, 1, 2)
		grid.addWidget(self.stageLabel, 1, 3, 1, 1)

		reader = QtGui.QImageReader("Mod3Line1.png")
		image = reader.read()
		qpixmap = QtGui.QPixmap()
		qpixmap.convertFromImage(image)
		self.background.setPixmap(qpixmap)

		reader = QtGui.QImageReader("Mod3Line2.png")
		image = reader.read()
		qpixmap = QtGui.QPixmap()
		qpixmap.convertFromImage(image)
		self.background1.setPixmap(qpixmap)
开发者ID:Saucyz,项目名称:explode,代码行数:49,代码来源:submod3.py

示例14: __init__

# 需要导入模块: from module import Module [as 别名]
# 或者: from module.Module import __init__ [as 别名]
 def __init__(self, context):
     Module.__init__(self, context)
     self.clockfont = pygame.font.Font("NixieOne-Regular.otf", int(context.height * .65))
     color = "white"
     outline = "black"
     self.clock = render.MultiColoredTextImg(parts=[
         render.OutlinedTextImg(font=self.clockfont, outercolor=outline, color=color, outlinesize=2),
         render.OutlinedTextImg(font=self.clockfont, outercolor=outline, color="gray", outlinesize=2),
         render.OutlinedTextImg(font=self.clockfont, outercolor=outline, color=color, outlinesize=2)
     ])
     self.date_label = render.OutlinedTextImg(color="#ffffff", size=60)
     self.clock.set_text(1, ":")
     self._i = 0
     self.time_x = 0
     self.time_y = 0
     self.last_minute = -1
     random.seed()
开发者ID:tragatron,项目名称:informant,代码行数:19,代码来源:clock.py

示例15: __init__

# 需要导入模块: from module import Module [as 别名]
# 或者: from module.Module import __init__ [as 别名]
 def __init__(self, indim, outdim, peepholes = False, name = None):
     nrNeurons = outdim
     self.peep = peepholes
     # internal buffers:
     self.ingate = zeros((0,nrNeurons))
     self.outgate = zeros((0,nrNeurons))
     self.forgetgate = zeros((0,nrNeurons))
     self.cell = zeros((0,nrNeurons))
     self.ingatex = zeros((0,nrNeurons))
     self.outgatex = zeros((0,nrNeurons))
     self.forgetgatex = zeros((0,nrNeurons))
     self.cellx = zeros((0,nrNeurons))
     self.state = zeros((0,nrNeurons))
     self.ingateError = zeros((0,nrNeurons))
     self.outgateError = zeros((0,nrNeurons))
     self.forgetgateError = zeros((0,nrNeurons))
     self.stateError = zeros((0,nrNeurons))
     self.Sin = zeros((0,indim*nrNeurons))
     self.Sforget = zeros((0,indim*nrNeurons))
     self.Scell = zeros((0,indim*nrNeurons))
     self.SinRec = zeros((0,nrNeurons*nrNeurons))
     self.SforgetRec = zeros((0,nrNeurons*nrNeurons))
     self.ScellRec = zeros((0,nrNeurons*nrNeurons))
     
     Module.__init__(self, indim, outdim, name)
     if self.peep:
         ParameterContainer.__init__(self, nrNeurons*3 + (4*indim+nrNeurons)*nrNeurons)
         self.Sin_peep = zeros((0,nrNeurons))
         self.Sforget_peep = zeros((0,nrNeurons))
         self.Scell_peep = zeros((0,nrNeurons))
     else:
         ParameterContainer.__init__(self, (4*indim+nrNeurons)*nrNeurons)
     self._setParameters(self.params)
     self._setDerivatives(self.derivs)
         
     # transfer functions and their derivatives
     self.f = sigmoid
     self.fprime = sigmoidPrime
     self.g = lambda x: 2*tanh(x)
     self.gprime = lambda x: 2*tanhPrime(x)
     self.h = self.g
     self.hprime = self.gprime
开发者ID:HKou,项目名称:pybrain,代码行数:44,代码来源:lstmrtrlblock.py


注:本文中的module.Module.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。