Solved by callahman in post #2 
              
              
                I spent a little time trying to find something similar to a “Join on value”, but couldn’t come up with anything… 
This is the best I could come up with: 
import torch

ts3=torch.tensor([
 [ 24 , 24 , 8 ,0 ],
 [ 38 , 100 , 93 ,0],
 [ 65 , 91 , 73 ,0],
 [ 49 , 26 , 45 ,0],
 [ 78 , 54 , 11 ,0],
 [ 24 ,…