【问题标题】:pytorch model summary - forward func has more than one argumentpytorch 模型总结——forward func 有多个参数
【发布时间】:2020-06-14 06:25:06
【问题描述】:

我正在使用手电筒摘要

from torchsummary import summary

我想在打印模型摘要时传递多个参数,但这里提到的示例:Model summary in pytorch 只接受了一个参数。例如:

model = Network().to(device)
summary(model,(1,28,28))

原因是forward函数需要两个参数作为输入,例如:

def forward(self, img1, img2):

如何在这里传递两个参数?

【问题讨论】:

    标签: python pytorch


    【解决方案1】:

    您可以使用此处给出的示例:pytorch summary multiple inputs

    summary(model, [(1, 16, 16), (1, 28, 28)])
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-07-17
      • 2022-11-17
      • 2021-12-04
      • 2018-08-18
      • 2021-07-01
      • 2021-04-10
      • 2020-06-13
      相关资源
      最近更新 更多