當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。