• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python module.Module类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __init__

 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,代码行数:7,代码来源:dropout.py


示例2: __init__

 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,代码行数:7,代码来源:HTTPLogger.py


示例3: __init__

    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,代码行数:26,代码来源:lstm.py


示例4: __init__

 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,代码行数:7,代码来源:linear.py


示例5: __init__

 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,代码行数:25,代码来源:kohonen.py


示例6: dropEvent

	def dropEvent(self, e):
		# Establecer el widget en una nueva posición
		# aqui tengo que separar entre modulos nuevos y ya existentes.
		# la cadena que transmito es "posx,posy" si es mover uno existe
		# posx y posy es la posicion relativa al modulo del cursor
		# los ya existentes, muevo el modulo que paso con el drag a
		# la posicion del click menos el punto (posx,posy)
		# los modulos nuevos, hago una copia de ese tipo de modulo
		# de una base que no se este mostrando, y lo muestro
		# y no solo eso, sino que ademas mantengo
		# la numeracion de cada tipo de modulos para generar siguientes

		# obtiene la posicion relativa de los datos mime (mimeData)
		if e.mimeData().hasText():
			x, y = map(int, e.mimeData().text().split(','))
			e.source().move(e.pos()-QtCore.QPoint(x, y))
			e.setDropAction(QtCore.Qt.MoveAction)
			for l in e.source().lines:
				l.repaint()
		else:
			name=self.newName(e.source().name)
			m = Module(name, e.source().code, self)
			m.move(e.pos()-QtCore.QPoint(100,50))
			m.show()
			self.addModule(m)
			if m.type == Module.Input:
				self.update_composite()
			e.setDropAction(QtCore.Qt.CopyAction)
		e.accept()
开发者ID:LJavierG,项目名称:thesis-cyphers-block-construction,代码行数:29,代码来源:dropframe.py


示例7: LoadEntered

  def LoadEntered(self):
      name = self.e.get()
      self.loadPopup.destroy()
      tempDict = {}
      with open("./Patches/patches.json",'r') as json_file:
        patchDictionary = json.load(json_file)
        print "ALL MODULES"
        print self.AllModules
        while len(self.AllModules) != 0:
          m = self.AllModules.pop()
          print "DELETING" + str(m.name)
          m.delete()
        patch = patchDictionary[name]
        self.PureData.reset()

        #Load all modules 
        for n, module in patch['modules'].iteritems():
          newM = Module(self.canvas, module['Name'], module['x'] * scalar , module['y'] * scalar, self, self.osc)
          newM.setValues(module['Values'])
          tempDict[n] = newM
          self.AllModules.append(newM)

        #Load all connections
        for cable in patch['cables'].values():
          print cable
          inputModule = tempDict[cable[0]]
          inputJack = inputModule.InputJacks[cable[1]]
          outputModule = tempDict[cable[2]]
          outputJack = outputModule.OutputJacks[cable[3]]
          inputModule.connectCable(inputJack, outputJack)
开发者ID:computerstaat,项目名称:PDModular,代码行数:30,代码来源:SynthBuilder.py


示例8: write_london

def write_london(template, scf, molecule):
    printable = ''
    wave_function = scf.contains(template.wave_function.name)
    if wave_function:
        scf_submodule = wave_function.submodules.get(template.scf.name)
        if scf_submodule:
            atomst = scf_submodule.properties.pop(template.atomst.name)

    for module in scf.modules:
        if module.name != template.visual.name:
            printable += module.__str__()

    nmr = SubModule('*NMR')
    nmr.add_property(template, '.LONDON')
    nmr.add_property(template, '.DOEPRN')
    nmr.add_property(template, '.INTFLG', ['1 1 0'])#calculating just large-large large-small

    newModule = Module('**PROPERTIES')
    newModule.add_property(template, '.' + molecule.magnetic_field)
    newModule.submodules.update({'*NMR':nmr})

    printable += newModule.__str__()
    printable += '*END OF\n'

    if atomst:
        scf_submodule.properties.update({atomst.name:atomst})

    return printable
开发者ID:crissetubal,项目名称:sci_converter,代码行数:28,代码来源:london.py


示例9: configure

 def configure(self, config):
     Module.configure(self, config)
     if not self.version:
         self.version = m.ReadModuleName()
     # Import appropriate the ADAM module (or package).
     module = 'mpx.ion.adam.adam' + self.version
     command = compile('import ' + module,
                       'mpx.ion.adam.unknown.configure()', 'exec')
     eval(command)
     # Get the module's factory and instanciate the "real" class.
     command = module + '.factory'
     adam_factory = eval(command, globals(), locals())
     self.instance = adam_factory()
     
     # Scary stuff.  Detach this ion from our parent, configure the real
     # instance (thus attaching it to the parent) and then morph this
     # instance to behave like the real instance (in case anyone has a
     # handle to this instance).
     try:
         self.parent._del_child(self.name)
         self.instance.configure(config)
         attributes = vars(self.instance.__class__)
         attributes.update(vars(self.instance))
         for attrribute in attributes:
             setattr(self, attrribute, getattr(self.instance, attrribute))
     except:
         msglog.exception()
         # The scary stuff failed, reattach to the parent.
         try:
             self.parent._del_child(self.instance.name)
         except:
             pass
         self.parent._add_child(self)
开发者ID:mcruse,项目名称:monotone,代码行数:33,代码来源:unknown.py


示例10: ModuleTestCase

class ModuleTestCase(TestCase):
    def setUp(self):
        print '-' * 200
        print 'testing Module'
        self.module = Module(1)
        self.module.fill('dcg', 'DCG', 1)
        obj = self.module.get_object()
        print obj
开发者ID:Superjom,项目名称:webp,代码行数:8,代码来源:tests.py


示例11: GenerateBldMod

 def GenerateBldMod (self):
     # ugly hack for create a module for the bld file
     bldMod = Module('bld_' + self.name, '** autogenerated **')         
     bldMod.resolvedFiles.append(self.bldFile)
     bldMod.putInPkg = False
     self.buildSys.modules[bldMod.name] = bldMod
     if bldMod.name not in self.modules:
         self.modules.append(bldMod.name)
开发者ID:xuebai5,项目名称:TheZombieEngine,代码行数:8,代码来源:target.py


示例12: __init__

 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,代码行数:9,代码来源:btscan.py


示例13: scan

 def scan(self):
     for addr in range(0,0x100):
         try:
             m = Module()
             m.configure({'name':'adamXXXX', 'parent':self,
                          'line_handler':self, 'address':addr})
             print '0x%02X' % addr, '(%3d)' % addr, m.ReadModuleName()
         except EIOError:
             print "."
         del m
开发者ID:mcruse,项目名称:monotone,代码行数:10,代码来源:line_handler.py


示例14: list_bin

def list_bin(args):
    """ 
    List the programs provided by the module.
    """

    db = ModuleDb()
    for moduleid in args.module:
        name,version = splitid(moduleid)
        try:
            Module.list_bin(db.lookup(name),version)
        except ModuleError as e:
            e.warn()
开发者ID:shk3,项目名称:pymodules,代码行数:12,代码来源:modulecmd.py


示例15: __init__

 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,代码行数:12,代码来源:slideshow.py


示例16: prepare_and_absolute_diff_all_archs

    def prepare_and_absolute_diff_all_archs(self, old_lib, new_lib):
        old_modules = Module.get_test_modules_by_name(old_lib)
        new_modules = Module.get_test_modules_by_name(new_lib)
        self.assertEqual(len(old_modules), len(new_modules))

        for old_module, new_module in zip(old_modules, new_modules):
            self.assertEqual(old_module.arch, new_module.arch)
            old_ref_dump_path = self.get_or_create_ref_dump(old_module, False)
            new_ref_dump_path = self.get_or_create_ref_dump(new_module, True)
            self.assertEqual(
                read_output_content(old_ref_dump_path, AOSP_DIR),
                read_output_content(new_ref_dump_path, AOSP_DIR))
开发者ID:android,项目名称:platform_development,代码行数:12,代码来源:test.py


示例17: Tensor

 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,代码行数:14,代码来源:spatial_convolution.py


示例18: __init__

	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,代码行数:15,代码来源:submod0.py


示例19: unload

def unload(args):
    """
    Unload modules, if the specified version is already loaded.
    aliases: rm remove
    """

    env = ModuleEnv()
    db = ModuleDb()
    for moduleid in args.module:
        name,version = splitid(moduleid)
        try:
            Module.unload(db.lookup(name),env,strict=True)
        except ModuleError as e:
            e.warn()
    env.dump()
开发者ID:shk3,项目名称:pymodules,代码行数:15,代码来源:modulecmd.py


示例20: load

def load(args):
    """
    Load modules, unloading any versions that are already loaded.
    aliases: add switch swap
    """

    env = ModuleEnv()
    db = ModuleDb()
    for moduleid in args.module:
        name,version = splitid(moduleid)
        try:
            Module.load(db.lookup(name),env,version)
        except ModuleError as e:
            e.warn()
    env.dump()
开发者ID:shk3,项目名称:pymodules,代码行数:15,代码来源:modulecmd.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python module.ModuleDetector类代码示例发布时间:2022-05-27
下一篇:
Python modtool_base.ModTool类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap