RuntimeError: expected scalar type Double but found Float

Traceback (most recent call last):
  File "/workspace/SACNT/main.py", line 250, in 
    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没用。

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

你可能感兴趣的:(pytorch,python)