RuntimeError: There were no tensor arguments to this function

Rayah_Q: <p>Hello ,<br>
I am getting this error (" CUDA out of memory ") when running the GAN code.</p>
<p>I tried to solve it by reducing the batch size , but same error appear.<br>
so I have been tried to reduce the number of hidden layers from 256 to 128,The code has been run for all epochs.<br>
But at the end of running the code the run time error below has been appeared .</p>
<p>I have stuck here for a long time. I really need some help plz.<br>
Any help would be greatly appreciated.<br>
And thanks in advance.</p>
<p><strong>Traceback (most recent call last):</strong><br>
**  File “main.py”, line 152, in **<br>
**    main()**<br>
**  File “main.py”, line 146, in main**<br>
**    results = malgan.measure_and_export_results()**<br>
**  File “C:\Users\malgan_<em>init</em>_.py”, line 393, in measure_and_export_results**<br>
**    avg_changed_bits = torch.cat(bits_changed).mean()**<br>
<strong>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]</strong></p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/6/e/6eac5ca1f60e794da93d7eb0b3e44f2dd7ee0e5b.png" data-download-href="https://discuss.pytorch.org/uploads/default/6eac5ca1f60e794da93d7eb0b3e44f2dd7ee0e5b" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/6/e/6eac5ca1f60e794da93d7eb0b3e44f2dd7ee0e5b_2_690x388.png" alt="image" data-base62-sha1="fN3NVA1z7zdWIMf2e5h0TKD4YgX" width="690" height="388" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/6/e/6eac5ca1f60e794da93d7eb0b3e44f2dd7ee0e5b_2_690x388.png, https://discuss.pytorch.org/uploads/default/optimized/3X/6/e/6eac5ca1f60e794da93d7eb0b3e44f2dd7ee0e5b_2_1035x582.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/6/e/6eac5ca1f60e794da93d7eb0b3e44f2dd7ee0e5b_2_1380x776.png 2x" data-dominant-color="212324"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">1920×1080 238 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>

albanD: <p>Hi,</p>
<p>What is <code>bits_changed</code> that you give to <code>torch.cat()</code>? Is it a list/tuple of Tensors as expected by the function?</p>

Rayah_Q: <p>Thanks for your reply, It is a List.</p>

albanD: <p>And what does it contain? It should be a list of Tensors.<br>
Given the error I expect that this list contains other kind of elements no?</p>

Rayah_Q: <p>In the beginning, it is declared as an empty list. Then, it is appended.<br>
the attached photo declares the general idea relevant to bits_ changed!<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/f/7/f7d550d455e056eba35e4b658c12786ec8d99dad.png" data-download-href="https://discuss.pytorch.org/uploads/default/f7d550d455e056eba35e4b658c12786ec8d99dad" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/f/7/f7d550d455e056eba35e4b658c12786ec8d99dad_2_690x388.png" alt="image" data-base62-sha1="zmqXEbh5DPiGyOkjBnyzR6tby6V" width="690" height="388" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/f/7/f7d550d455e056eba35e4b658c12786ec8d99dad_2_690x388.png, https://discuss.pytorch.org/uploads/default/optimized/3X/f/7/f7d550d455e056eba35e4b658c12786ec8d99dad_2_1035x582.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/f/7/f7d550d455e056eba35e4b658c12786ec8d99dad_2_1380x776.png 2x" data-dominant-color="2B343D"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">1920×1080 312 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>

albanD: <p>Can you add a print just before the line that runs the <code>cat</code> to print the content of bits_changed to make sure?</p>

Rayah_Q: <p>Just calling the function ( as declared in the attached photo) at main file<br>
#" results = malgan.measure_and_export_results()<br>
if args.print_results:<br>
print(results)"</p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/4/2/42d8aea09bb9be3acdbd1bcf2c2c85f1d8ba72fa.png" data-download-href="https://discuss.pytorch.org/uploads/default/42d8aea09bb9be3acdbd1bcf2c2c85f1d8ba72fa" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/4/2/42d8aea09bb9be3acdbd1bcf2c2c85f1d8ba72fa_2_690x388.png" alt="image" data-base62-sha1="9xlKEbwn7Yo1LTmDBWJzolhjb62" width="690" height="388" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/4/2/42d8aea09bb9be3acdbd1bcf2c2c85f1d8ba72fa_2_690x388.png, https://discuss.pytorch.org/uploads/default/optimized/3X/4/2/42d8aea09bb9be3acdbd1bcf2c2c85f1d8ba72fa_2_1035x582.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/4/2/42d8aea09bb9be3acdbd1bcf2c2c85f1d8ba72fa_2_1380x776.png 2x" data-dominant-color="2C363E"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">1920×1080 306 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>

albanD: <p>I meant add a <code>print(bits_changed)</code> line 393 in your <code>__init__.py</code> file above.<br>
And share what this print gives.</p>

Rayah_Q: <p>It doesn’t return any thing.<br>
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.<br>
But in current case , it returns no value.</p>

albanD: <p>How do you run your code? Don’t you have a command line where you can see what you print when the code runs?</p>

Rayah_Q: <p>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.</p>

albanD: <p>So if you add some python <code>print</code> statement in the script just before the line that crashes. This should get printed in the command prompt right? Can you share that?</p>

Rayah_Q: <p>I tried that but it returns nothing!</p>