Answers for "how to concatenate two tensors in pytorch"

5

torch concat matrix

third_tensor = torch.cat((first_tensor, second_tensor), 0) # keep column width append in rows

third_tensor = torch.cat((first_tensor, second_tensor), 1) # keep row height and append in columns
Posted by: Guest on September-28-2020
0

concat tensors pytorch

x = torch.randn(2, 3)
y = torch.randn(2, 3)
# concat x and y
result = torch.cat((x, y), 0)
Posted by: Guest on August-08-2021

Code answers related to "how to concatenate two tensors in pytorch"

Python Answers by Framework

Browse Popular Code Answers by Language