Question: 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:

PYTORCH Question!!! We have the following PYTORCH TENSOR: How do I write

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!