"Torch"의 두 판 사이의 차이

ph
이동: 둘러보기, 검색
잔글
잔글
6번째 줄: 6번째 줄:
 
ipython같이 쓸 수 있음.
 
ipython같이 쓸 수 있음.
  
==scratch==
+
==etc==
 +
===storage===
 
Tensor is a particular way of viewing a Storage. <c>storage</c>로 접근하면 내부 배열에 순차적으로 접근 가능. matlab에서 2차원 이상 배열을 1차원배열 index로 접근하는 것과 동일.
 
Tensor is a particular way of viewing a Storage. <c>storage</c>로 접근하면 내부 배열에 순차적으로 접근 가능. matlab에서 2차원 이상 배열을 1차원배열 index로 접근하는 것과 동일.
 
<pre>x = torch.Tensor(4,5)
 
<pre>x = torch.Tensor(4,5)
13번째 줄: 14번째 줄:
 
   s[i] = i
 
   s[i] = i
 
end</pre>
 
end</pre>
 +
===apply===
 +
<pre>x:apply(function(x)
 +
  return x
 +
end)</pre>

2017년 7월 12일 (수) 14:40 판

links

iTorch

https://github.com/facebook/iTorch
ipython같이 쓸 수 있음.

etc

storage

Tensor is a particular way of viewing a Storage. storage로 접근하면 내부 배열에 순차적으로 접근 가능. matlab에서 2차원 이상 배열을 1차원배열 index로 접근하는 것과 동일.

x = torch.Tensor(4,5)
s = x:storage()
for i=1,s:size() do -- fill up the Storage
  s[i] = i
end

apply

x:apply(function(x)
  return x
end)