home
search
help
profile
liking the experience? our app is even better
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now  
Search
showing results for torch cat
1>>> x = torch.randn(2, 3)
2>>> x
3tensor([[ 0.6580, -1.0969, -0.4614],
4        [-0.1034, -0.5790,  0.1497]])
5>>> torch.cat((x, x, x), 0)
6tensor([[ 0.6580, -1.0969, -0.4614],
7        [-0.1034, -0.5790,  0.1497],
8        [ 0.6580, -1.0969, -0.4614],
9        [-0.1034, -0.5790,  0.1497],
10        [ 0.6580, -1.0969, -0.4614],
11        [-0.1034, -0.5790,  0.1497]])
12>>> torch.cat((x, x, x), 1)
13tensor([[ 0.6580, -1.0969, -0.4614,  0.6580, -1.0969, -0.4614,  0.6580,
14         -1.0969, -0.4614],
15        [-0.1034, -0.5790,  0.1497, -0.1034, -0.5790,  0.1497, -0.1034,
16         -0.5790,  0.1497]])
17
upvote
downvote
source
1> torch.cat(
2    (t1,t2,t3)
3    ,dim=0
4)
5tensor([1, 1, 1, 2, 2, 2, 3, 3, 3])
6
upvote
downvote
source
1> torch.cat(
2    (
3         t1.unsqueeze(0)
4        ,t2.unsqueeze(0)
5        ,t3.unsqueeze(0)
6    )
7    ,dim=0
8)
9tensor([[1, 1, 1],
10        [2, 2, 2],
11        [3, 3, 3]])
12
upvote
downvote
source