使用moduledit,我有:输入类型(torch.cuda.FloatTensor)和权重类型(torch.FloatTensor)应该相同

2024-09-26 17:51:02 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试我的__init__函数:


        self.downscale_time_conv = np.empty(8, dtype=object)
        for i in range(8):
            self.downscale_time_conv[i] = torch.nn.ModuleDict({})

但在我的{}中,我有:

        down_out = False
        for i in range(8):
            if not down_out:
                down_out = self.downscale_time_conv[i][side](inputs)
            else:
                down_out += self.downscale_time_conv[i][side](inputs)

我得到:

RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same

Tags: inselffortimeinittyperangetorch

热门问题