{"title":"torch.unsqueeze","image_url":null,"blog_url":"https://randommemory.hatenablog.com/","width":"100%","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Frandommemory.hatenablog.com%2Fentry%2F2020%2F05%2F13%2F222727\" title=\"torch.unsqueeze - \u3089\u3093\u3060\u3080\u306a\u8a18\u61b6\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","description":"import torch x = torch.Tensor([1,2,3]) print(x) print(x.shape) y = x.unsqueeze(dim=0) print(y) print(y.shape) print(x.numpy(), y.numpy()) torch.unsqueeze(x, dim=0) tensor([1., 2., 3.]) torch.Size([3]) tensor([[1., 2., 3.]]) torch.Size([1, 3]) [1. 2. 3.] [[1. 2. 3.]] tensor([[1., 2., 3.]]) \u5165\u308c\u5b50\uff1f\u306b\u3057\u3066\u6b21\u5143\u3092\u2026","provider_url":"https://hatena.blog","url":"https://randommemory.hatenablog.com/entry/2020/05/13/222727","published":"2020-05-13 22:27:27","author_name":"derwind","provider_name":"Hatena Blog","type":"rich","categories":["machine_learning"],"version":"1.0","blog_title":"\u3089\u3093\u3060\u3080\u306a\u8a18\u61b6","author_url":"https://blog.hatena.ne.jp/derwind/","height":"190"}