RuntimeError: expected scalar type Double but found Float

Traceback (most recent call last):
  File "/workspace/SACNT/main.py", line 250, in <module>
    main()
  File "/workspace/SACNT/main.py", line 230, in main
    pred = model.forward(e1, rel, X, adjacencies)
  File "/workspace/SACNT/models.py", line 230, in forward
    e1_embedded_all = self.bn_init(emb_initial)
  File "/opt/conda/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl
    return forward_call(*input, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/torch/nn/modules/batchnorm.py", line 171, in forward
    return F.batch_norm(
  File "/opt/conda/lib/python3.9/site-packages/torch/nn/functional.py", line 2450, in batch_norm
    return torch.batch_norm(
RuntimeError: expected scalar type Double but found Float

self.bn_init函数是定义的标准化函数

self.bn_init = torch.nn.BatchNorm1d(Config.init_emb_size)

不知道是哪里出的问题,emb_initial的数据类型改了float32,float64,double没用。

或许问题不在这个参数上。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值