Python/머신러닝
![[머신러닝] 파이토치 텐서 (tensor)의 연산](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FnjxvT%2FbtrePVL5wi3%2FT1m73v6GtM6s2NsRBUWVbK%2Fimg.png)
[머신러닝] 파이토치 텐서 (tensor)의 연산
1. 텐서 기초 a. 텐서 선언하기 1차원 텐서 tensor = torch.FloatTensor([0., 1., 2., 3.]) 2차원 텐서 tensor = torch.FloatTensor([[1., 2., 3.], [4., 5., 6.], [7., 8., 9.], [10., 11., 12.]]) print(tensor.dim()) print(tensor.size()) print(tensor[:, :2]) # 첫번째 차원 전체 선택, 두번쨰 차원의 0번째, 1번째 요소 선택 2 torch.Size([4, 3]) tensor([[ 1., 2.], [ 4., 5.], [ 7., 8.], [10., 11.]] 데이터로부터 직접 생성 data = [[1, 2],[3, 4]] x_data = torch.tenso..