添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接


Traceback (most recent call last):
File "D:\nlp\zhinengyunwei\wh_lstm_pytorch.py", line 213, in <module>
loss = loss_func(torch.squeeze(output), target)
File "D:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "D:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\loss.py", line 1150, in forward
return F.cross_entropy(input, target, weight=self.weight,
File "D:\ProgramData\Anaconda3\lib\site-packages\torch\nn\functional.py", line 2846, in cross_entropy
return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index, label_smoothing)
RuntimeError: "nll_loss_forward_reduce_cuda_kernel_2d_index" not implemented for 'Float'

发生在loss计算的时候,

loss_func(torch.squeeze(output), target)

改为:

loss_func(torch.squeeze(output), target.long())



上一篇: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimension 0

下一篇: 2021 全国人工智能大赛 AI+无线通信

【pytorch错误】:Pytorch RuntimeError: “host_softmax” not implemented for 'torch.cuda.LongTensor'

问题Pytorch RuntimeError: “host_softmax” not implemented for ‘torch.cuda.LongTensor’报错的位置在这个地方loss=criterion(out,train_y) # train_y 应该是int64原因参考:https://stackoverflow.com/questions/51818225/pytorch-run

feature2d.cpp:174: error: (-213:The function/feature is not implemented) in function 'detectAndComp

文章目录1 问题2 结局办法1 问题libc++abi.dylib: terminating with uncaught exce

Java怎么发送Redis命令 java redisutil

该工具包含是封装了jedis,包含redis.properties和jedisPool,序列化使用的是protostuff,map类型操作使用的是fastjson自己抽空写的,基本只要理解什么是get,什么是set就可以使用redis数据库了下载地址:点击打开链接JedisPoolUtil的源码:package com.bsy.common; import java.io.FileInputSt

Java:简述try-catch-finally异常捕获 一、try-catch语句      在Java中,异常通过try-catch语句捕获。其一般语法形式为:try { // 可能会发生异常的程序代码 } catch (Type1 id1){ // 捕获并处置try抛出的异常类型Type1