解决报错:TypeError: log_sigmoid(): argument ‘input‘ (position 1) must be Tensor, not torch.return_types.

报错如下:

TypeError: log_sigmoid(): argument 'input' (position 1) must be Tensor, not torch.return_types.max

torch.max()的返回类型为 torch.return_types.max

fused_scores = torch.max(scores, 0)

查看 fused_scores 的输出

fused_scores:  torch.return_types.max(
values=tensor([[ 0.5952,  0.1784, -0.2445,  ..., -0.0974, -0.6694,  0.3119],
        [ 0.7369,  0.7385, -0.2017,  ..., -0.2205, -0.2231,  0.1668],
        [ 0.3139,  0.6366, -0.3020,  ..., -0.7823, -0.2979,  0.1990],
        ...,
        [ 0.5835,  0.6074,  0.7595,  ...,  0.0768, -0.9004,  0.5091],
        [-0.1438,  0.5788, -0.4486,  ..., -0.5650, -0.2581,  0.8750],
        [-0.0785,  0.2236,  0.2840,  ...,  0.0266, -0.2749,  0.0575]],
       device='cuda:0', grad_fn=<MaxBackward0>),
indices=tensor([[3, 0, 5,  ..., 3, 5, 2],
        [0, 1, 4,  ..., 0, 4, 2],
        [5, 1, 0,  ..., 5, 0, 3],
        ...,
        [0, 3, 1,  ..., 2, 4, 1],
        [4, 5, 2,  ..., 3, 2, 0],
        [3, 5, 2,  ..., 1, 2, 3]], device='cuda:0'))

fused_scores.values即可 ==> xxx.values

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值