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


Python torchsummary.summary方法代码示例

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


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

示例1: __init__

# 需要导入模块: import torchsummary [as 别名]
# 或者: from torchsummary import summary [as 别名]
def __init__(self, n_agents, state_size=24, action_size=2, seed=0):
        """
        Params
        ======
            n_agents (int): number of distinct agents
            state_size (int): number of state dimensions for a single agent
            action_size (int): number of action dimensions for a single agent
            seed (int): random seed
        """
        self.actor_local = LowDimActor(state_size, action_size, seed).to(device)
        self.actor_target = LowDimActor(state_size, action_size, seed).to(device)
        critic_input_size = (state_size+action_size)*n_agents
        self.critic_local = LowDimCritic(critic_input_size, seed).to(device)
        self.critic_target = LowDimCritic(critic_input_size, seed).to(device)
        # output model architecture
        print(self.actor_local)
        summary(self.actor_local, (state_size,))
        print(self.critic_local)
        #summary(self.critic_local, (state_size*n_agents,), (action_size*n_agents,)) 
开发者ID:danielnbarbosa,项目名称:angela,代码行数:21,代码来源:models.py

示例2: resnet152

# 需要导入模块: import torchsummary [as 别名]
# 或者: from torchsummary import summary [as 别名]
def resnet152(pretrained=False, **kwargs):
    """Constructs a ResNet-152 model.

    Args:
        pretrained (bool): If True, returns a model pre-trained on ImageNet
    """
    model = ResNet(Bottleneck, [3, 8, 36, 3], **kwargs)
    if pretrained:
        model.load_state_dict(model_zoo.load_url(model_urls['resnet152']))
    return model
# net = resnet34(pretrained=False)
# torchsummary.summary(net, (3, 512, 512)) 
开发者ID:FENGShuanglang,项目名称:Pytorch_Medical_Segmention_Template,代码行数:14,代码来源:resnet.py

示例3: _test

# 需要导入模块: import torchsummary [as 别名]
# 或者: from torchsummary import summary [as 别名]
def _test():
    from torchsummary import summary
    model = DarkNet_53()
    torch.cuda.set_device(0)
    model = model.cuda()
    summary(model,input_size=(3,256,256)) 
开发者ID:HaiyangLiu1997,项目名称:Pytorch-Networks,代码行数:8,代码来源:Darknet2016.py

示例4: _test

# 需要导入模块: import torchsummary [as 别名]
# 或者: from torchsummary import summary [as 别名]
def _test():
    from torchsummary import summary
    model = ResNet18()
    model = model.cuda()
    summary(model,input_size=(3,224,224)) 
开发者ID:HaiyangLiu1997,项目名称:Pytorch-Networks,代码行数:7,代码来源:ResNetV2.py

示例5: _test

# 需要导入模块: import torchsummary [as 别名]
# 或者: from torchsummary import summary [as 别名]
def _test():
    from torchsummary import summary
    model = ResNeXt50()
    model = model.cuda()
    summary(model,input_size=(3,224,224)) 
开发者ID:HaiyangLiu1997,项目名称:Pytorch-Networks,代码行数:7,代码来源:ResNeXt2016.py

示例6: _test

# 需要导入模块: import torchsummary [as 别名]
# 或者: from torchsummary import summary [as 别名]
def _test():
    from torchsummary import summary
    model = Inception_Res_v2()
    model = model.cuda()
    summary(model,input_size=(3,299,299)) 
开发者ID:HaiyangLiu1997,项目名称:Pytorch-Networks,代码行数:7,代码来源:Inception_all.py

示例7: _test

# 需要导入模块: import torchsummary [as 别名]
# 或者: from torchsummary import summary [as 别名]
def _test():
    from torchsummary import summary
    model = TestNet()
    torch.cuda.set_device(1)
    model = model.cuda()
    summary(model,input_size=(3,224,224)) 
开发者ID:HaiyangLiu1997,项目名称:Pytorch-Networks,代码行数:8,代码来源:SEmodule2017.py

示例8: _test

# 需要导入模块: import torchsummary [as 别名]
# 或者: from torchsummary import summary [as 别名]
def _test():
    from torchsummary import summary
    model = DenseNet264()
    model = model.cuda()
    summary(model,input_size=(3,224,224)) 
开发者ID:HaiyangLiu1997,项目名称:Pytorch-Networks,代码行数:7,代码来源:DenseNet2016.py

示例9: _test

# 需要导入模块: import torchsummary [as 别名]
# 或者: from torchsummary import summary [as 别名]
def _test():
    from torchsummary import summary
    model = EfficientNet_B0()
    torch.cuda.set_device(1)
    model = model.cuda()
    summary(model,input_size=(3,224,224)) 
开发者ID:HaiyangLiu1997,项目名称:Pytorch-Networks,代码行数:8,代码来源:EfficientNet2019.py

示例10: _test

# 需要导入模块: import torchsummary [as 别名]
# 或者: from torchsummary import summary [as 别名]
def _test():
    from torchsummary import summary
    model = vgg19()
    model = model.cuda()
    summary(model,input_size=(3,224,224)) 
开发者ID:HaiyangLiu1997,项目名称:Pytorch-Networks,代码行数:7,代码来源:VGG2014.py

示例11: _test

# 需要导入模块: import torchsummary [as 别名]
# 或者: from torchsummary import summary [as 别名]
def _test():
    from torchsummary import summary
    model = MnasNet_A1()
    model = model.cuda()
    summary(model,input_size=(3,224,224)) 
开发者ID:HaiyangLiu1997,项目名称:Pytorch-Networks,代码行数:7,代码来源:MnasNet2018.py

示例12: _test

# 需要导入模块: import torchsummary [as 别名]
# 或者: from torchsummary import summary [as 别名]
def _test():
    from torchsummary import summary
    model = NIN()
    model = model.cuda()
    summary(model,input_size=(3,224,224)) 
开发者ID:HaiyangLiu1997,项目名称:Pytorch-Networks,代码行数:7,代码来源:NIN2013.py

示例13: _test

# 需要导入模块: import torchsummary [as 别名]
# 或者: from torchsummary import summary [as 别名]
def _test():
    from torchsummary import summary
    model = MobileNet_V1()
    torch.cuda.set_device(1)
    model = model.cuda()
    summary(model,input_size=(3,224,224)) 
开发者ID:HaiyangLiu1997,项目名称:Pytorch-Networks,代码行数:8,代码来源:MobileNet.py

示例14: own

# 需要导入模块: import torchsummary [as 别名]
# 或者: from torchsummary import summary [as 别名]
def own():
	nc=3
	rnn_hidden_size=256
	rnn_num_layers=2
	leakyRelu=False

	ks = [3, 3, 3, 3, 3, 3, 2]
	ps = [1, 1, 1, 1, 1, 1, 0]
	ss = [1, 1, 1, 1, 1, 1, 1]
	nm = [64, 128, 256, 256, 512, 512, 512]

	cnn = nn.Sequential()

	def convRelu(i, batchNormalization=False):
		nIn = nc if i == 0 else nm[i - 1]
		nOut = nm[i]
		cnn.add_module('conv{0}'.format(i),
					   nn.Conv2d(nIn, nOut, ks[i], ss[i], ps[i]))
		if batchNormalization:
			cnn.add_module('batchnorm{0}'.format(i), nn.BatchNorm2d(nOut))
		if leakyRelu:
			cnn.add_module('relu{0}'.format(i),
						   nn.LeakyReLU(0.2, inplace=True))
		else:
			cnn.add_module('relu{0}'.format(i), nn.ReLU(True))

	convRelu(0)
	cnn.add_module('pooling{0}'.format(0), nn.MaxPool2d(2, 2))  # 64x16x64
	convRelu(1)
	cnn.add_module('pooling{0}'.format(1), nn.MaxPool2d(2, 2))  # 128x8x32
	convRelu(2, True)
	convRelu(3)
	cnn.add_module('pooling{0}'.format(2),
				   nn.MaxPool2d((2, 2), (2, 1), (0, 1)))  # 256x4x16
	convRelu(4, True)
	convRelu(5)
	cnn.add_module('pooling{0}'.format(3),
				   nn.MaxPool2d((2, 2), (2, 1), (0, 1)))  # 512x2x16
	convRelu(6, True)  # 512x1x16

	print(summary(cnn.cuda(), (3,32,150))) 
开发者ID:mayank-git-hub,项目名称:Text-Recognition,代码行数:43,代码来源:trial.py

示例15: weights_init_kaiming

# 需要导入模块: import torchsummary [as 别名]
# 或者: from torchsummary import summary [as 别名]
def weights_init_kaiming(m):
    classname = m.__class__.__name__
    #print(classname)
    if classname.find('Conv') != -1:
        init.kaiming_normal_(m.weight.data, a=0, mode='fan_in')
    elif classname.find('Linear') != -1:
        init.kaiming_normal_(m.weight.data, a=0, mode='fan_in')
    elif classname.find('BatchNorm') != -1:
        init.normal_(m.weight.data, 1.0, 0.02)
        init.constant_(m.bias.data, 0.0)
#model = UNet()
#torchsummary.summary(model, (1, 512, 512)) 
开发者ID:FENGShuanglang,项目名称:Pytorch_Medical_Segmention_Template,代码行数:14,代码来源:unet.py


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