wavefrontshaping / complexPyTorch

A high-level toolbox for using complex valued neural networks in PyTorch
MIT License
610 stars 148 forks source link

How to feed the input of two dimensions to the model #15

Closed Xyy-tj closed 2 years ago

Xyy-tj commented 3 years ago

Hi, I am a beginner of CNN, and I want to feed my datasets (wave datasets) to the model, and I get the error: "RuntimeError: stack expects each tensor to be equal size, but got [117792, 8] at entry 0 and [117792, 2, 128] at entry 1"

I noticed that you said "The only usage difference is that the forward function takes two tensors, corresponding to real and imaginary parts, and returns two ones too.", but i dont know how to take two tensors.

I don't know if my question is clear, maybe you can give me more guidance or example.

Thank you. image

wavefrontshaping commented 3 years ago

Hi,

"The only usage difference is that the forward function takes two tensors, corresponding to real and imaginary parts, and returns two ones too."

Sorry, this sentence was from the first version of the code, when complex tensors were not implemented at all in PyTorch. I removed it. You simply feed to your network tensors as you do normally, except that they need to be of complex type.

Xyy-tj commented 3 years ago

Thanks for your reply! Fortunately, I successfully feed my data . By the way, I noticed that the function "test()" in your example , the argu is test_loader, but use "train_loader" in function logic, is it a slip of the pen, or just a example that don't care about the actual meaning?

And thanks a lot again.

wavefrontshaping commented 2 years ago

the argu is test_loader, but use "train_loader" in function logic

That was a typo indeed, but it was just to compute the progress in percentage, so no biggy. I corrected it.