首页 > 其他分享 >RuntimeError: cuda runtime error (8) : invalid device function at /pytorch/aten/src/THC/THCGeneral.c

RuntimeError: cuda runtime error (8) : invalid device function at /pytorch/aten/src/THC/THCGeneral.c

时间:2024-02-27 20:23:46浏览次数:18  
标签:function src self py __ File input line THCGeneral

今天犯了一个很低级的错误。
打开服务器使用python命令训练网络报错:

Traceback (most recent call last):
  File "Train.py", line 166, in <module>
    result = G(input)
  File "/home/cat/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in __call__
    result = self.forward(*input, **kwargs)
  File "/data1/cat/lab/network/Model.py", line 327, in forward
    x_down1 = self.down1(input)  # [bs, 64, 256, 256]
  File "/home/cat/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/cat/anaconda3/lib/python3.7/site-packages/torch/nn/modules/container.py", line 92, in forward
    input = module(input)
  File "/home/cat/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/cat/anaconda3/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 338, in forward
    self.padding, self.dilation, self.groups)
RuntimeError: cuda runtime error (8) : invalid device function at /pytorch/aten/src/THC/THCGeneral.cpp:383

找了半天还以为是代码的问题,然后我突然发现我没启动虚拟环境。
故使用如下命令启动虚拟环境:

conda activate your_environment_name

标签:function,src,self,py,__,File,input,line,THCGeneral
From: https://www.cnblogs.com/chengcat/p/18037870

相关文章

  • [Rust] Specifying a function argument can be mutated
    Followingcodehascompileerror:#[test]fnmain(){letvec0=vec![22,44,66];letmutvec1=fill_vec(vec0);assert_eq!(vec1,vec![22,44,66,88]);}fnfill_vec(vec:Vec<i32>)->Vec<i32>{vec.push(88);vec}......
  • ../inst/include/Eigen/src/Core/MathFunctions.h:487:16: error: no member named 'R
    Asmentionedin conda-forge/r-base-feedstock#163(comment),IsuccessfullyinstalledsctransforminMacsiliconM1Maxbyfirstrun exportPKG_CPPFLAGS="-DHAVE_WORKING_LOG1P intheterminalandtheninstallthepackageinR.......
  • Semantic Kernel 学习笔记:体验基于 prompt function 实现的 Plugin
    在一个SemanticKernelplugin中可以创建两种类型的function,分别是nativefunction与promptfunction(之前叫semanticfunction)。下面这款plugin中给C#method添加了[KernelFunction]attribute,就是nativefunctionpublicclassLightPlugin{publicboolIsOn......
  • [Rust] Implicitly returning values from functions
    Codehaserror:fnmain(){letanswer=square(3);println!("Thesquareof3is{}",answer);}fnsquare(num:i32)->i32{num*num;}Error:⚠️Compilingofexercises/functions/functions5.rsfailed!Pleasetryagain.Here&#......
  • let、const、var、function所谓的”变量提升“、暂时性死区到底是什么
    今天看了大佬一个文章我用了两个月的时间才理解let-知乎(zhihu.com),文章中其实说得很清楚,还有大佬解决这个问题的整个心路历程。我这里做一个总结记录,专注于“变量提升”、暂时性死区这两个点做一个讨论。现象讨论下面这两段代码,我们都知道这段代码在控制台会打印undefined......
  • Machine Learning - The Sigmoid Function
    CalculateNodeOutput.TaskYouaregiventhevaluesforw1,w2,b,x1andx2andyoumustcomputetheoutputforthenode.Usethesigmoidastheactivationfunction.InputFormatw1,w2,b,x1andx2ononelineseparatedbyspacesOutputFormatFloatrounded......
  • 【Azure Function】示例运行 python durable function(model V2)
    问题描述参考官方文档(使用Python创建你的第一个持久函数:https://learn.microsoft.com/zh-cn/azure/azure-functions/durable/quickstart-python-vscode),部署后,却出现“Failedtoloadfunction”错误。在结合以上参考文档后,可以通过如下的步骤创建并运行PythonDurableFu......
  • 一文搞懂Flink Window机制 Windows和 Function 和 Process组合处理事件
    一文搞懂FlinkWindow机制和Function和Process组合处理事件Windows是处理无线数据流的核心,它将流分割成有限大小的桶(buckets),并在其上执行各种计算。Windows是处理无线数据流的核心,它将流分割成有限大小的桶(buckets),并在其上执行各种计算。窗口化的Flink程......
  • Flink 增量窗口聚合函数 ReduceFunction(归约函数)和AggregateFunction(聚合函数)
    Flink增量窗口聚合函数定义了窗口分配器,只是知道了数据属于哪个窗口,可以将数据收集起来了;至于收集起来到底要做什么,其实还完全没有头绪。所以在窗口分配器之后,必须再接上一个定义窗口如何进行计算的操作,这就是所谓的“窗口函数”(windowfunctions)。经窗口分配器处理之后,数据可......
  • 绕过disable_functions的限制
    https://github.com/AntSwordProject/AntSword-Labs/tree/master/bypass_disable_functionshttps://wiki.luoyunhao.com/web/Bypassdisable_function绕过disable_functions的限制disable_functions是php.ini中的一个设置选项,可以用来设置PHP环境禁止使用某些函数,通常是网站......