Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PYTORCH Question!!! We have the following PYTORCH TENSOR: How do I write a loop such that I can convert this Pytorch tensor to a pandas
PYTORCH Question!!!
We have the following PYTORCH TENSOR:
How do I write a loop such that I can convert this Pytorch tensor to a pandas dataframe that looks like the following:
183 rows, in which each row has a total of 33*20 = 660 columns!! In other words, I simply want to take all the elements from each 33 x 20 tensor (there are 183 of these in total) and make them a row in my pandas df so that there are 660 feature (columns), each storing one value from the original tensor. Thanks in advance!!
0.070... 0.066212378 Tensor: b_fp Tensor with shape torch.Size([183, 33, 20]) b_fp 0.0000e+00, 0.00002+00, - tensor( [[[6.9605e+00, 2.3818e+00, 7.0687e-02, 0.0000e+00, 0.00002+00], [6.9605e+00, 2.3818e+00, 7.0687e-02, 0.0000e+00, 0.0000e+00], [6.9605e+00, 2.3818e+00, 7.0687e-02, 0.00002+00, 0.0000e+00], 0.0000e+00, 0.0000e+00, 0.00002+00, [6.9605e+00, 2.3818e+00, 7.0687e-02, 0.0000e+00, 0.00002+00], [6.9605e+00, 2.3818e+00, 7.0687e-02, 0.0000e+00, 0.0000e+00], [6.0452e+00, 2.3243e+00, 5.6076e-01, 0.0000e+00, 0.0000e+00]], 0.00002+00, 0.0000e+00, 0.00002+00, [[6.9605e+00, 2.3818e+00, 7.0687e-02, 0.0000e+00, 0.00002+00], [6.9605e+00, 2.3818e+00, 7.0687e-02, 0.0000e+00, 0.00002+00], [6.9605e+00, 2.3818e+00, 7.0687e-02, 0.0000e+00, 0.0000e+00], 0.0000e+00
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started