Wednesday, May 29, 2024

PyTorch preferred way to copy a tensor


https://stackoverflow.com/questions/55266154/pytorch-preferred-way-to-copy-a-tensor

 Use .clone().detach() (or preferrably .detach().clone())

If you first detach the tensor and then clone it, the computation path is not copied, the other way around it is copied and then abandoned. Thus, .detach().clone() is very slightly more efficient.-- pytorch forums

as it's slightly fast and explicit in what it does.

Monday, January 2, 2023

Flatten a Pandas DF by column name

Use melt function 


https://stackoverflow.com/questions/38612154/pandas-flatten-a-dataframe-to-a-single-column

Plotly plot pandas data frame by index

 Plotly plot pandas data frame by index


https://stackoverflow.com/questions/57178206/use-pandas-index-in-plotly-express

Merge two data frames by index

 

Merge two data frames by index


https://stackoverflow.com/questions/40468069/merge-two-dataframes-by-index

PyTorch preferred way to copy a tensor

https://stackoverflow.com/questions/55266154/pytorch-preferred-way-to-copy-a-tensor   Use   .clone().detach()   (or preferrably   .detach()....