RuntimeError: There were no tensor arguments to this function

Hello ,
I am getting this error (" CUDA out of memory ") when running the GAN code.

I tried to solve it by reducing the batch size , but same error appear.
so I have been tried to reduce the number of hidden layers from 256 to 128,The code has been run for all epochs.
But at the end of running the code the run time error below has been appeared .

I have stuck here for a long time. I really need some help plz.
Any help would be greatly appreciated.
And thanks in advance.

Traceback (most recent call last):
** File “main.py”, line 152, in **
** main()**
** File “main.py”, line 146, in main**
** results = malgan.measure_and_export_results()**
** File “C:\Users\malgan_init_.py”, line 393, in measure_and_export_results**
** avg_changed_bits = torch.cat(bits_changed).mean()**
RuntimeError: There were no tensor arguments to this function (e.g., you passed an empty list of Tensors), but no fallback function is registered for schema aten::_cat. This usually means that this function requires a non-empty list of Tensors. Available functions are [CPUTensorId, CUDATensorId, QuantizedCPUTensorId, VariableTensorId]

Hi,

What is bits_changed that you give to torch.cat()? Is it a list/tuple of Tensors as expected by the function?

1 Like

Thanks for your reply, It is a List.

And what does it contain? It should be a list of Tensors.
Given the error I expect that this list contains other kind of elements no?

1 Like

In the beginning, it is declared as an empty list. Then, it is appended.
the attached photo declares the general idea relevant to bits_ changed!

Can you add a print just before the line that runs the cat to print the content of bits_changed to make sure?

1 Like

Just calling the function ( as declared in the attached photo) at main file
#" results = malgan.measure_and_export_results()
if args.print_results:
print(results)"

I meant add a print(bits_changed) line 393 in your __init__.py file above.
And share what this print gives.

1 Like

It doesn’t return any thing.
The final result returned only when the code runs correctly. Then it has been saved at csv file and the (bits_changed) has been included within it.
But in current case , it returns no value.

How do you run your code? Don’t you have a command line where you can see what you print when the code runs?

1 Like

The code is provided as a package in the folder. A driver script is provided in main.py, which processes input arguments via argparse. The basic interface is for it is " python main.py Noise BATCH_SIZE NUM_EPOCHS MALWARE_FILE BENIGN_FILE " and runs through a command prompt.

So if you add some python print statement in the script just before the line that crashes. This should get printed in the command prompt right? Can you share that?

1 Like

I tried that but it returns nothing!