RuntimeError: cuda runtime error (2) : out of memory at /pytorch/aten/src/THC/THCTensorRandom.cu:25

import sys, os
sys.path.append(os.path.dirname(os.path.abspath(file)) + ‘/Data’)

CLASS_COUNT = 1
BATCH_SIZE = 2
how can i fix it please help?

Is there more source code than that? Nothing in your code interacts with the GPU.

)
THCudaCheck FAIL file=/pytorch/aten/src/THC/THCTensorRandom.cu line=25 error=2 : out of memory
Traceback (most recent call last):
File “train.py”, line 110, in
main()
File “train.py”, line 56, in main
dream_model.cuda()
File “/mnt/home/dreamdd/newDream/DreamHU/venv/lib/python2.7/site-packages/torch/nn/modules/module.py”, line 249, in cuda
return self._apply(lambda t: t.cuda(device))
File “/mnt/home/dreamdd/newDream/DreamHU/venv/lib/python2.7/site-packages/torch/nn/modules/module.py”, line 176, in _apply
module._apply(fn)
File “/mnt/home/dreamdd/newDream/DreamHU/venv/lib/python2.7/site-packages/torch/nn/modules/module.py”, line 176, in _apply
module._apply(fn)
File “/mnt/home/dreamdd/newDream/DreamHU/venv/lib/python2.7/site-packages/torch/nn/modules/module.py”, line 176, in _apply
module._apply(fn)
File “/mnt/home/dreamdd/newDream/DreamHU/venv/lib/python2.7/site-packages/torch/nn/modules/module.py”, line 182, in _apply
param.data = fn(param.data)
File “/mnt/home/dreamdd/newDream/DreamHU/venv/lib/python2.7/site-packages/torch/nn/modules/module.py”, line 249, in
return self._apply(lambda t: t.cuda(device))
RuntimeError: cuda runtime error (2) : out of memory at /pytorch/aten/src/THC/THCTensorRandom.cu:25

Can you post your full source code? Or a minimum example that you have run that gets the error message? This is not enough information to help you.

can you help me solve my question?
my question is similar like him ,here is my question,thanks