본문 바로가기

자료들

(37)
Gradient Descent and Its Variants 이 글에서는 Gradient Descent algorithms인 BGD(Batch Gradient Descent), SGD(Stochastic Gradient Descent) 그리고 MGD(Mini-batch Gradient Descent)에 대해서 다소 Mathematically하게 설명을 해보겠습니다. 그 동안 개념을 어렴풋하게만 아셨던 분들은 이 글을 통해서 수학적으로 개념을 다시 명확하게 할 수 있을 것 같습니다. 수학이라는 단어를 사용하기는 했지만 산수에 가까운 정도이니 부담없이 읽으실 수 있습니다. 그럼 시작하겠습니다. 1. 우선 Loss function에 대해서 먼저 알아보죠. Gradient Descent algorithm에 대해서 알아보기 전에 Loss function이라는 것에 대해서 ..
Edge TPU Co-compilation 적용 검토 1. 개요 Edge TPU에서 복수의 모델을 연속적으로 실행시킬 때 속도 개선을 위하여 co-compilation 지원함. co-compilation을 적용하면 두번째 모델을 실행할 때 Edge TPU의 SRAM cache clear를 하지 않아서 속도가 개선됨. co-compilation 효과를 확인하기 위하여, pre-trained detection 모델(SSD MobileNet V2)과 pre-trained embedding 모델(MobileNet V2)에 적용하여 속도 측정함. co-compilation 적용 시에 어떤 모델에 cache를 우선 할당할 지 결정 필요함. detection 모델과 embedding 모델의 inference를 pair로 100회 수행하여 평균 속도를 측정함 측정 데이터..
Tensorflow 모델 pruning 적용 방법 1. 개요 tensorflow 모델에 pruning을 적용하는 방법을 정리함 pruning 알고리듬은 'gradual pruning' 방식을 적용함 (초기 sparsity 값으로부터 목표 sparsity 값에 도달할 때까지 진행하며 pruning 속도를 점차 완만하게 늦춤) cifar10 CNN 모델을 pruning하는 예제를 통하여 pruning mask 및 weight 변수 값의 변화를 확인함 pruning을 통한 이득을 얻기 위해서는, pruning된 sparse tensor를 압축하는 메커니즘 및 sparse tensor 연산을 가속하기 위한 HW적 지원이 필요함 2. Workflow 3. pruning 모델 생성 pruning 대상이 되는 layer에 mask와 threshold variable..
Quantization-aware training에 대한 code 정리 1. 신경망 모델 양자화(quantization)에 대한 접근 방법 post-training quantization quantization-aware training 개념 floating point 모델로 training을 진행하고 결과 weight값들에 대하여 양자화(quantization)를 적용함 학습 진행 시점에 inference 시의 양자화 적용에 의한 영향을 미리 simulation(modeling) 수행함 장단점 파라미터 size가 큰 대형 모델에 대해서는 정확도 하락 폭이 작으며, 파라미터 size가 작은 소형 모델에 대해서는 적합하지 않음 양자화 모델의 정확도 하락을 최소화할 수 있음 quantization-aware training을 통하여 forward / backward pass에서..
Pruning 논문 2편 정리 1. 3단계 pruning 학습 pipeline (원본 논문 Link) 1) 개요 신경망 모델의 정확도에 영향을 주지 않고 모델 저장 공간 및 모델 연산량을 절감할 수 있는 방법론을 제안함 3단계 pruning 학습 방법을 이용하여 신경망 모델에서 잉여 연결들(redundant connections)을 가지치기 할 수 있음 2) 3단계 pruning 학습 방법 1단계 : 일반적인 학습 과정을 통하여 어떤 연결들이 중요한지 파악하는 단계임 → inference용으로 최적화된 모델을 얻기 위한 수준이 아니고 pruning 전에 각 connection의 중요도를 파악할 수 있는 수준으로 수행함 2단계 : weight 값이 threshold 이하인 connection들을 신경망에서 제거함 → 밀도가 높은 신경망..
Selection Sort in Java Time complexity 1. Worst Case: O(N^2) 2. Best Case: O(N^2) public static void sort(Comparable[] a) { int n = a.length; for (int i = 0; i < n; i++) { int min = i; for (int j = i+1; j < n; j++) { if (less(a[j], a[min])) min = j; } exch(a, i, min); assert isSorted(a, 0, i); } assert isSorted(a); } // is v < w ? private static boolean less(Comparable v, Comparable w) { return v.compareTo(w) < 0; } /..
Sorting / Distinct Write a functionclass Solution { public int solution(int[] A); }that, given a zero-indexed array A consisting of N integers, returns the number of distinct values in array A.Assume that:N is an integer within the range [0..100,000];each element of array A is an integer within the range [−1,000,000..1,000,000].For example, given array A consisting of six elements such that: A[0] = 2 A[1] = 1 A[2]..
Sorting / Triangle A zero-indexed array A consisting of N integers is given. A triplet (P, Q, R) is triangular if 0 ≤ P A[R],A[Q] + A[R] > A[P],A[R] + A[P] > A[Q].For example, consider array A such that: A[0] = 10 A[1] = 2 A[2] = 5 A[3] = 1 A[4] = 8 A[5] = 20Triplet (0, 2, 4) is triangular.Write a function:class Solution { public int solution(int[] A); }that, given a zero-indexed arra..