ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [python] theano 함수 요약본
    Deep Learining/[python] Machine Learning 2015. 9. 1. 18:26

    Theano 함수 요약본




    1. Multilayer Perceptron에서 사용되는 theano 함수


    theano.tensor

    : tensor type의 변수를 제공해주는 라이브러리 클래스이다.


    theano.tensor.lscalar(name=None, dtype=config.floatX)

    : 0-dimensional ndarray를  위한 변수를 반환한다.


    theano.tensor.ivector(name=None, dtype=config.floatX)

    : 1-dimensional ndarray를 위한 변수를 반환한다.


    theano.tensor.matrix(name=None, dtype=config.floatX)

    : 2-dimensional ndarray를 위한 변수를 반환한다.


    theano.tensor4(name='input')

    : Return a Variable for a 4-dimensional ndarray


    theano.config.floatX

    : 이 모듈은 GPU에서 float32와 float64를 계산하는 속도의 차이때문에 존재한다. GPU에서는 float64가 float32보다 더

      빨리 계산되어지기 때문에 이 함수를 사용해서 자료형을 바꿔준다.


    theano.tensor.nnet.sigmoid

    : sigmoid function의 결과값을 반환한다.


    theano.tensor.nnet.conv.conv2d(input, W)

    : 전통적인 2D convolution을 수행한다.

      다음과 같이 파라미터 2개를 사용하면 input, filters를 사용하게된다.

      input은 이미지를 필터처리하기위한 심볼릭 변수이며, filter는 필터변수를 포함하는 심볼릭 변수이다.


    theano.shared(value=W_values, name='W', borrow=True)

    : 기본적으로 GPU 연산은 데이터를 주메모리에서 GPU용 메모리인 VRAM으로 옮긴 후 처리된다. 그리고 결과를 확인하려

      면 다시 VRAM에서 주메모리로 가져와야한다. 이 부분이 시간 많이 소요된다. 따라서 메모리간 이동을 최소화 하기 위해서

      GPU에 데이터를 올리는 함수이다.


    theano.function(input, output, givens)

    : 그래프들을 청구될 수 있는 object들로 컴파일링하기 위한 인터페이스이다.


    theano.grad(cost, param)

    : gradient(기울기)를 계산해주는 함수이다. gradient descent나 ascent를 사용할 때 쓴다.  prameter로  cost를

      편미분한 값을 구한다.

    'Deep Learining > [python] Machine Learning' 카테고리의 다른 글

    [pytohn] pylab 함수 요약  (0) 2015.09.02
    [python] numpy 함수 요약본  (1) 2015.09.01
Designed by Tistory.