KR20210111677A - Method for clipping neural networks, method for calculating convolution of neural networks and apparatus for performing the methods - Google Patents

Method for clipping neural networks, method for calculating convolution of neural networks and apparatus for performing the methods Download PDF

Info

Publication number
KR20210111677A
KR20210111677A KR1020210020655A KR20210020655A KR20210111677A KR 20210111677 A KR20210111677 A KR 20210111677A KR 1020210020655 A KR1020210020655 A KR 1020210020655A KR 20210020655 A KR20210020655 A KR 20210020655A KR 20210111677 A KR20210111677 A KR 20210111677A
Authority
KR
South Korea
Prior art keywords
kernel
slice
slices
similar
input channel
Prior art date
Application number
KR1020210020655A
Other languages
Korean (ko)
Inventor
헤 콩콩
자오 지안
양 민
레이 펭
Original Assignee
삼성전자주식회사
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 삼성전자주식회사 filed Critical 삼성전자주식회사
Priority to US17/190,642 priority Critical patent/US20210279586A1/en
Publication of KR20210111677A publication Critical patent/KR20210111677A/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning
    • G06N20/10Machine learning using kernel methods, e.g. support vector machines [SVM]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/082Learning methods modifying the architecture, e.g. adding, deleting or silencing nodes or connections

Abstract

Disclosed are a method for clipping a neural network, a method for calculating a convolution of a neural network and an electronic device for performing the methods. The electronic device includes at least one processor. The processor is capable of: selecting, based on the convolution parameters of a convolutional layer included in a neural network, a kernel slice of an input channel of the convolutional layer; determining one or more kernel slices similar to the selected kernel slice; determining a replacement slice to replace the selected kernel slice based on the one or more similar kernel slices; clipping the selected kernel slice; and replacing the clipped kernel slice with the replacement slice. Here, the convolution parameters may include the number of input channels of the convolutional layer, the number of output channels, the width of the filter of the convolutional kernel, and the height of the filter of the convolutional kernel.

Description

뉴럴 네트워크의 클리핑 방법, 뉴럴 네트워크의 컨벌루션 계산 방법 및 그 방법을 수행하기 위한 전자 장치{METHOD FOR CLIPPING NEURAL NETWORKS, METHOD FOR CALCULATING CONVOLUTION OF NEURAL NETWORKS AND APPARATUS FOR PERFORMING THE METHODS}A clipping method of a neural network, a method of calculating a convolution of a neural network, and an electronic device for performing the method

아래 실시예들은 뉴럴 네트워크의 경량화에 관한 것으로, 뉴럴 네트워크를 클리핑하고 클리핑된 뉴럴 네트워크에서 컨벌루션을 수행하는 기술에 관한 것이다.The following embodiments relate to weight reduction of a neural network, and to a technique for clipping a neural network and performing convolution in the clipped neural network.

컨벌루션 뉴럴 네트워크의 공간 복잡성과 저장 공간 문제를 해결하기 위해, 뉴럴 네트워크를 클리핑하는 압축 방법이 사용될 수 있다. 컨벌루션 뉴럴 네트워크가 학습된 후에 0 또는 임계 값에 가까운 가중치가 검색되고 클리핑될 수 있다. 클리핑된 가중치의 인덱스는 인덱스 정보에 저장될 수 있다. 다만, 단순한 클리핑 방법은 클리핑된 가중치 분포가 무작위이기 때문에 클리핑된 가중치의 인덱스를 저장하기 위해 대량의 추가적인 참조 공간을 필요로 하고, 클리핑된 가중치가 불규칙한 형태인 경우 추론 과정에서 가중치에 대한 액세스에 문제가 발생할 수 있다.In order to solve the spatial complexity and storage space problems of convolutional neural networks, a compression method of clipping neural networks may be used. After the convolutional neural network is trained, weights close to zero or a threshold can be retrieved and clipped. The index of the clipped weight may be stored in index information. However, the simple clipping method requires a large amount of additional reference space to store the index of the clipped weight because the clipped weight distribution is random. may occur.

위에서 설명한 배경기술은 발명자가 본원의 개시 내용을 도출하는 과정에서 보유하거나 습득한 것으로서, 반드시 본 출원 전에 일반 공중에 공개된 공지기술이라고 할 수는 없다. The background art described above is possessed or acquired by the inventor in the process of deriving the disclosure of the present application, and it cannot necessarily be said to be a known technology disclosed to the general public prior to the present application.

일 실시예에 따른 뉴럴 네트워크의 클리핑 방법 은, 뉴럴 네트워크에 포함된 컨벌루션 레이어의 컨벌루션 매개 변수에 기초하여 상기 컨벌루션 레이어의 입력 채널의 커널 슬라이스(kernel slice)를 선택하는 동작; 상기 선택된 커널 슬라이스와 유사한 하나 이상의 커널 슬라이스를 결정하는 동작; 하나 이상의 상기 유사한 커널 슬라이스를 기초로 상기 선택된 커널 슬라이스를 대체하는 대체 슬라이스를 결정하는 동작; 및 상기 선택된 커널 슬라이스를 클리핑하고 상기 대체 슬라이스로 상기 클리핑된 커널 슬라이스를 대체하는 동작을 포함하고, 상기 컨벌루션 매개 변수는 상기 컨벌루션 레이어의 상기 입력 채널의 수, 출력 채널의 수, 컨벌루션 커널의 필터의 폭, 컨벌루션 커널의 필터의 높이를 포함할 수 있다.A clipping method of a neural network according to an embodiment includes: selecting a kernel slice of an input channel of a convolutional layer based on a convolution parameter of a convolutional layer included in the neural network; determining one or more kernel slices similar to the selected kernel slice; determining a replacement slice to replace the selected kernel slice based on one or more of the similar kernel slices; and clipping the selected kernel slice and replacing the clipped kernel slice with the replacement slice, wherein the convolution parameters are the number of input channels, number of output channels, and filter of the convolutional kernel of the convolutional layer. It can include the width and height of the filter in the convolution kernel.

상기 클리핑된 커널 슬라이스의 인덱스를 저장하는 동작을 더 포함할 수 있다.The method may further include storing an index of the clipped kernel slice.

상기 유사한 하나 이상의 커널 슬라이스를 결정하는 동작은, 상기 컨벌루션 레이어의 각 입력 채널의 커널 슬라이스의 놈(norm)을 계산하는 동작; 및 상기 각 입력 채널의 커널 슬라이스의 놈을 기초로 상기 선택된 커널 슬라이스와 유사한 하나 이상의 커널 슬라이스를 결정하는 동작을 포함할 수 있다.The determining of the one or more similar kernel slices may include: calculating a norm of a kernel slice of each input channel of the convolutional layer; and determining one or more kernel slices similar to the selected kernel slice based on the norm of the kernel slice of each input channel.

상기 놈을 기초로 상기 선택된 커널 슬라이스와 유사한 하나 이상의 커널 슬라이스를 결정하는 동작은, 상기 각 입력 채널의 커널 슬라이스의 놈을 기초로 상기 각 입력 채널의 커널 슬라이스를 하나 이상의 클래스로 분류하는 단계; 및 상기 선택된 커널 슬라이스가 속한 클래스로 분류된 하나 이상의 커널 슬라이스 간의 유사도를 기초로 상기 선택된 커널 슬라이스와 유사한 하나 이상의 커널 슬라이스를 결정하는 동작을 포함할 수 있다.The determining of one or more kernel slices similar to the selected kernel slice based on the norm may include: classifying the kernel slice of each input channel into one or more classes based on the norm of the kernel slice of each input channel; and determining one or more kernel slices similar to the selected kernel slice based on a similarity between one or more kernel slices classified into a class to which the selected kernel slice belongs.

상기 유사도를 기초로 상기 선택된 커널 슬라이스와 유사한 하나 이상의 커널 슬라이스를 결정하는 동작은, 상기 선택된 커널 슬라이스가 속한 클래스로 분류된 각각의 커널 슬라이스와 상기 선택된 커널 슬라이스 간의 차이의 놈을 계산함으로써 유사도를 결정하는 동작; 및 상기 유사도가 임계값 이하인 커널 슬라이스를 상기 선택된 커널 슬라이스와 유사한 커널 슬라이스로 결정하는 동작을 포함할 수 있다.The determining of one or more kernel slices similar to the selected kernel slice based on the similarity may include determining the similarity by calculating a norm of a difference between each kernel slice classified into a class to which the selected kernel slice belongs and the selected kernel slice. action to do; and determining a kernel slice having the similarity equal to or less than a threshold value as a kernel slice similar to the selected kernel slice.

상기 대체 슬라이스를 결정하는 동작은, 상기 선택된 커널 슬라이스 및 상기 하나 이상의 유사한 커널 슬라이스를 평균하여 평균 커널 슬라이스를 계산하는 동작; 및 상기 선택된 커널 슬라이스 및 상기 하나 이상의 유사한 커널 슬라이스 중 적어도 하나의 커널 슬라이스를 상기 평균 커널 슬라이스로 대체하는 동작을 포함할 수 있다.The determining of the replacement slice may include calculating an average kernel slice by averaging the selected kernel slice and the one or more similar kernel slices; and replacing at least one kernel slice among the selected kernel slice and the one or more similar kernel slices with the average kernel slice.

상기 커널 슬라이스를 선택하는 동작은, 상기 입력 채널의 수를 기초로 상기 커널 슬라이스의 수를 결정하는 동작; 및 상기 결정된 커널 슬라이스의 수 및 상기 컨벌루션 매개 변수를 기초로 상기 컨벌루션 레이어의 컨벌루션 커널을 나타내는 텐서(tensor)로부터 상기 입력 채널의 커널 슬라이스를 추출하는 동작을 포함할 수 있다.The selecting of the kernel slices may include: determining the number of kernel slices based on the number of input channels; and extracting the kernel slice of the input channel from a tensor indicating a convolutional kernel of the convolutional layer based on the determined number of kernel slices and the convolution parameter.

일 실시예에 따른 뉴럴 네트워크의 컨벌루션 계산 방법은, 뉴럴 네트워크에 포함된 컨벌루션 레이어의 인덱스 정보를 기초로 상기 각 입력 채널의 커널 슬라이스가 대체 슬라이스인지 판단하는 동작; 상기 커널 슬라이스가 대체 슬라이스인 경우 상기 인덱스 정보 중에서 상기 대체 슬라이스의 인덱스를 획득하는 동작; 및 상기 대체 슬라이스의 인덱스를 기초로 컨벌루션을 계산하는 동작을 포함하고, 상기 컨벌루션 레이어의 컨벌루션 매개 변수에 기초하여 선택된 커널 슬라이스와 유사한 커널 슬라이스는 클리핑되고 상기 대체 슬라이스로 대체될 수 있다.According to an embodiment, a method for calculating a convolution of a neural network includes: determining whether a kernel slice of each input channel is a replacement slice based on index information of a convolution layer included in the neural network; obtaining an index of the replacement slice from among the index information when the kernel slice is a replacement slice; and calculating a convolution based on the index of the replacement slice, wherein a kernel slice similar to the selected kernel slice based on the convolution parameter of the convolution layer may be clipped and replaced with the replacement slice.

일 실시예에 따른 컴퓨터 판독가능 기록매체는 상기 방법을 실행하는 컴퓨터 프로그램을 저장할 수 있다.A computer-readable recording medium according to an embodiment may store a computer program for executing the method.

일 실시예에 따른 전자 장치는, 적어도 하나의 프로세서를 포함하고, 상기 프로세서는, 뉴럴 네트워크에 포함된 컨벌루션 레이어의 컨벌루션 매개 변수에 기초하여 상기 컨벌루션 레이어의 입력 채널의 커널 슬라이스(kernel slice)를 선택하는 동작; 상기 선택된 커널 슬라이스와 유사한 하나 이상의 커널 슬라이스를 결정하는 동작; 하나 이상의 상기 유사한 커널 슬라이스를 기초로 상기 선택된 커널 슬라이스를 대체하는 대체 슬라이스를 결정하는 동작; 및 상기 선택된 커널 슬라이스를 클리핑하고 상기 대체 슬라이스로 상기 클리핑된 커널 슬라이스를 대체하는 동작을 수행하고, 상기 컨벌루션 매개 변수는 상기 컨벌루션 레이어의 상기 입력 채널의 수, 출력 채널의 수, 컨벌루션 커널의 필터의 폭, 컨벌루션 커널의 필터의 높이를 포함할 수 있다.An electronic device according to an embodiment includes at least one processor, wherein the processor selects a kernel slice of an input channel of the convolutional layer based on a convolution parameter of a convolutional layer included in a neural network. action to do; determining one or more kernel slices similar to the selected kernel slice; determining a replacement slice to replace the selected kernel slice based on one or more of the similar kernel slices; and clipping the selected kernel slice and replacing the clipped kernel slice with the replacement slice, wherein the convolution parameters are the number of input channels, number of output channels, and filter of the convolutional kernel of the convolutional layer. It can include the width and height of the filter in the convolution kernel.

도 1은 일 실시예에 따른 뉴럴 네트워크의 클리핑 방법의 동작을 도시한 흐름도이다.
도 2는 일 실시예에 따른 뉴럴 네트워크의 클리핑 방법의 예시적인 흐름도이다.
도 3은 일 실시예에 따른 뉴럴 네트워크의 클리핑 방법에서 커널 슬라이스를 추출하는 예시를 도시한 도면이다.
도 4는 일 실시예에 따른 뉴럴 네트워크의 클리핑 방법에서 커널 슬라이스의 클래스를 분류하는 예시를 도시한 도면이다.
도 5는 일 실시예에 따른 뉴럴 네트워크의 클리핑 방법에서 동일한 클래스에 속한 커널 슬라이스의 유사도를 결정하는 예시를 도시한 도면이다.
도 6은 일 실시예에 따른 뉴럴 네트워크의 클리핑 방법에서 선택된 커널 슬라이스와 유사한 커널 슬라이스를 클리핑하는 예시를 도시한 도면이다.
도 7은 일 실시예에 따른 뉴럴 네트워크의 계산 방법의 동작을 도시한 흐름도이다.
도 8은 일반적인 컨벌루션 계산의 예시를 도시한 도면이다.
도 9는 일 실시예에 따른 뉴럴 네트워크의 계산 방법에서 컨벌루션 계산의 예시를 도시한 도면이다.
도 10은 일 실시예에 따른 전자 장치의 구성을 도시한 도면이다.
1 is a flowchart illustrating an operation of a clipping method of a neural network according to an embodiment.
2 is an exemplary flowchart of a clipping method of a neural network according to an embodiment.
3 is a diagram illustrating an example of extracting a kernel slice in a clipping method of a neural network according to an embodiment.
4 is a diagram illustrating an example of classifying a class of a kernel slice in a clipping method of a neural network according to an embodiment.
5 is a diagram illustrating an example of determining a degree of similarity between kernel slices belonging to the same class in a clipping method of a neural network according to an embodiment.
6 is a diagram illustrating an example of clipping a kernel slice similar to a selected kernel slice in a neural network clipping method according to an embodiment.
7 is a flowchart illustrating an operation of a method for calculating a neural network according to an embodiment.
8 is a diagram illustrating an example of a general convolutional calculation.
9 is a diagram illustrating an example of a convolution calculation in a method of calculating a neural network according to an embodiment.
10 is a diagram illustrating a configuration of an electronic device according to an exemplary embodiment.

실시예들에 대한 특정한 구조적 또는 기능적 설명들은 단지 예시를 위한 목적으로 개시된 것으로서, 다양한 형태로 변경되어 구현될 수 있다. 따라서, 실제 구현되는 형태는 개시된 특정 실시예로만 한정되는 것이 아니며, 본 명세서의 범위는 실시예들로 설명한 기술적 사상에 포함되는 변경, 균등물, 또는 대체물을 포함한다.Specific structural or functional descriptions of the embodiments are disclosed for purposes of illustration only, and may be changed and implemented in various forms. Accordingly, the actual implemented form is not limited to the specific embodiments disclosed, and the scope of the present specification includes changes, equivalents, or substitutes included in the technical idea described in the embodiments.

제1 또는 제2 등의 용어를 다양한 구성요소들을 설명하는데 사용될 수 있지만, 이런 용어들은 하나의 구성요소를 다른 구성요소로부터 구별하는 목적으로만 해석되어야 한다. 예를 들어, 제1 구성요소는 제2 구성요소로 명명될 수 있고, 유사하게 제2 구성요소는 제1 구성요소로도 명명될 수 있다.Although terms such as first or second may be used to describe various components, these terms should be interpreted only for the purpose of distinguishing one component from another. For example, a first component may be termed a second component, and similarly, a second component may also be termed a first component.

어떤 구성요소가 다른 구성요소에 "연결되어" 있다고 언급된 때에는, 그 다른 구성요소에 직접적으로 연결되어 있거나 또는 접속되어 있을 수도 있지만, 중간에 다른 구성요소가 존재할 수도 있다고 이해되어야 할 것이다.When a component is referred to as being “connected to” another component, it may be directly connected or connected to the other component, but it should be understood that another component may exist in between.

단수의 표현은 문맥상 명백하게 다르게 뜻하지 않는 한, 복수의 표현을 포함한다. 본 명세서에서, "포함하다" 또는 "가지다" 등의 용어는 설명된 특징, 숫자, 단계, 동작, 구성요소, 부분품 또는 이들을 조합한 것이 존재함으로 지정하려는 것이지, 하나 또는 그 이상의 다른 특징들이나 숫자, 단계, 동작, 구성요소, 부분품 또는 이들을 조합한 것들의 존재 또는 부가 가능성을 미리 배제하지 않는 것으로 이해되어야 한다.The singular expression includes the plural expression unless the context clearly dictates otherwise. In this specification, terms such as "comprise" or "have" are intended to designate that the described feature, number, step, operation, component, part, or combination thereof exists, and includes one or more other features or numbers, It should be understood that the possibility of the presence or addition of steps, operations, components, parts or combinations thereof is not precluded in advance.

다르게 정의되지 않는 한, 기술적이거나 과학적인 용어를 포함해서 여기서 사용되는 모든 용어들은 해당 기술 분야에서 통상의 지식을 가진 자에 의해 일반적으로 이해되는 것과 동일한 의미를 가진다. 일반적으로 사용되는 사전에 정의되어 있는 것과 같은 용어들은 관련 기술의 문맥상 가지는 의미와 일치하는 의미를 갖는 것으로 해석되어야 하며, 본 명세서에서 명백하게 정의하지 않는 한, 이상적이거나 과도하게 형식적인 의미로 해석되지 않는다.Unless defined otherwise, all terms used herein, including technical and scientific terms, have the same meaning as commonly understood by one of ordinary skill in the art. Terms such as those defined in a commonly used dictionary should be interpreted as having a meaning consistent with the meaning in the context of the related art, and should not be interpreted in an ideal or excessively formal meaning unless explicitly defined in the present specification. does not

이하, 실시예들을 첨부된 도면들을 참조하여 상세하게 설명한다. 첨부 도면을 참조하여 설명함에 있어, 도면 부호에 관계없이 동일한 구성 요소는 동일한 참조 부호를 부여하고, 이에 대한 중복되는 설명은 생략하기로 한다.Hereinafter, embodiments will be described in detail with reference to the accompanying drawings. In the description with reference to the accompanying drawings, the same components are assigned the same reference numerals regardless of the reference numerals, and overlapping descriptions thereof will be omitted.

도 1은 일 실시예에 따른 뉴럴 네트워크의 클리핑 방법의 동작을 도시한 흐름도이다.1 is a flowchart illustrating an operation of a clipping method of a neural network according to an embodiment.

일 실시예에 따르면, 전자 장치는 학습이 수행된 뉴럴 네트워크의 컨벌루션 레이어의 커널 슬라이스(kernel slice)를 클리핑(clipping)할 수 있다. 전자 장치는 유사한 커널 슬라이스들을 대체 슬라이스로 대체함으로써 커널 슬라이스의 저장 공간 및 복잡도를 줄일 수 있다. 전자 장치는 클리핑된 커널 슬라이스의 인덱스를 대체 슬라이스에 재활용할 수 있다. 이하에서, 클리핑은 프루닝(pruning)으로 지칭될 수 있다.According to an embodiment, the electronic device may clip a kernel slice of a convolutional layer of a neural network on which learning is performed. The electronic device may reduce the storage space and complexity of the kernel slice by replacing similar kernel slices with the replacement slice. The electronic device may reuse the index of the clipped kernel slice to the replacement slice. Hereinafter, clipping may be referred to as pruning.

일 실시예에 따르면, 동작(101)에서, 전자 장치는 뉴럴 네트워크에 포함된 컨벌루션 레이어의 컨벌루션 매개 변수에 기초하여 컨벌루션 레이어의 입력 채널의 커널 슬라이스를 선택할 수 있다. 일 실시예에 따르면, 전자 장치는 입력 채널의 수를 기초로 커널 슬라이스의 수를 결정할 수 있다. 일 실시예에 따르면, 전자 장치는 결정된 커널 슬라이스의 수 및 컨벌루션 매개 변수를 기초로 컨벌루션 레이어의 컨벌루션 커널을 나타내는 텐서(tensor)로부터 입력 채널의 커널 슬라이스를 추출할 수 있다. 여기서, 컨벌루션 매개 변수는 컨벌루션 레이어의 입력 채널의 수, 출력 채널의 수, 컨벌루션 커널의 필터의 폭, 컨벌루션 커널의 필터의 높이를 포함할 수 있다.According to an embodiment, in operation 101, the electronic device may select a kernel slice of an input channel of a convolutional layer based on a convolution parameter of a convolutional layer included in the neural network. According to an embodiment, the electronic device may determine the number of kernel slices based on the number of input channels. According to an embodiment, the electronic device may extract a kernel slice of an input channel from a tensor indicating a convolutional kernel of a convolutional layer based on the determined number of kernel slices and a convolution parameter. Here, the convolution parameter may include the number of input channels of the convolutional layer, the number of output channels, the width of the filter of the convolutional kernel, and the height of the filter of the convolutional kernel.

일 실시예에 따르면, 동작(103)에서, 전자 장치는 선택된 커널 슬라이스와 유사한 하나 이상의 커널 슬라이스를 결정할 수 있다.According to an embodiment, in operation 103 , the electronic device may determine one or more kernel slices similar to the selected kernel slice.

일 실시예에 따르면, 전자 장치는 컨벌루션 레이어의 각 입력 채널의 커널 슬라이스의 놈(norm)을 계산할 수 있다.According to an embodiment, the electronic device may calculate a norm of a kernel slice of each input channel of the convolutional layer.

일 실시예에 따르면, 전자 장치는 각 입력 채널의 커널 슬라이스의 놈을 기초로 선택된 커널 슬라이스와 유사한 하나 이상의 커널 슬라이스를 결정할 수 있다. 일 실시예에 따르면, 전자 장치는 각 입력 채널의 커널 슬라이스의 놈을 기초로 각 입력 채널의 커널 슬라이스를 하나 이상의 클래스로 분류할 수 있다. 일 실시예에 따르면, 전자 장치는 선택된 커널 슬라이스가 속한 클래스로 분류된 하나 이상의 커널 슬라이스 간의 유사도를 기초로 선택된 커널 슬라이스와 유사한 하나 이상의 커널 슬라이스를 결정할 수 있다. According to an embodiment, the electronic device may determine one or more kernel slices similar to the selected kernel slice based on the norm of the kernel slice of each input channel. According to an embodiment, the electronic device may classify the kernel slice of each input channel into one or more classes based on the norm of the kernel slice of each input channel. According to an embodiment, the electronic device may determine one or more kernel slices similar to the selected kernel slice based on a similarity between one or more kernel slices classified into a class to which the selected kernel slice belongs.

일 실시예에 따르면, 전자 장치는 선택된 커널 슬라이스가 속한 클래스로 분류된 각각의 커널 슬라이스와 선택된 커널 슬라이스 간의 차이의 놈을 계산함으로써 유사도를 결정할 수 있다. 일 실시예에 따르면, 전자 장치는 유사도가 임계값 이하인 커널 슬라이스를 선택된 커널 슬라이스와 유사한 커널 슬라이스로 결정할 수 있다. 전자 장치는 유사도 계산을 분류된 클래스 별로 수행함으로써 유사도 계산에 필요한 리소스 및 시간을 절약할 수 있다.According to an embodiment, the electronic device may determine the similarity by calculating a norm of a difference between each kernel slice classified into a class to which the selected kernel slice belongs and the selected kernel slice. According to an embodiment, the electronic device may determine a kernel slice having a similarity equal to or less than a threshold value as a kernel slice similar to the selected kernel slice. The electronic device may save resources and time required for the similarity calculation by performing the similarity calculation for each classified class.

일 실시예에 따르면, 동작(105)에서, 전자 장치는 하나 이상의 유사한 커널 슬라이스를 기초로 선택된 커널 슬라이스를 대체하는 대체 슬라이스를 결정할 수 있다. 일 실시예에 따르면, 전자 장치는 선택된 커널 슬라이스 및 하나 이상의 유사한 커널 슬라이스를 평균하여 평균 커널 슬라이스를 계산할 수 있다. 일 실시예에 따르면, 전자 장치는 선택된 커널 슬라이스 및 하나 이상의 유사한 커널 슬라이스 중 적어도 하나의 커널 슬라이스를 평균 커널 슬라이스로 대체할 수 있다. 다른 실시예에 따르면, 전자 장치는 선택된 커널 슬라이스 및 하나 이상의 유사한 커널 슬라이스 중 적어도 하나의 커널 슬라이스를 선택된 커널 슬라이스 및 하나 이상의 유사한 커널 슬라이스 중의 다른 커널 슬라이스로 대체할 수도 있다.According to an embodiment, in operation 105 , the electronic device may determine a replacement slice to replace the selected kernel slice based on one or more similar kernel slices. According to an embodiment, the electronic device may calculate an average kernel slice by averaging the selected kernel slice and one or more similar kernel slices. According to an embodiment, the electronic device may replace at least one kernel slice among the selected kernel slice and one or more similar kernel slices with an average kernel slice. According to another embodiment, the electronic device may replace at least one kernel slice among the selected kernel slice and one or more similar kernel slices with another kernel slice among the selected kernel slice and one or more similar kernel slices.

일 실시예에 따르면, 동작(107)에서, 전자 장치는 선택된 커널 슬라이스를 클리핑하고 대체 슬라이스로 클리핑된 커널 슬라이스를 대체할 수 있다. 일 실시예에 따르면, 전자 장치는 클리핑된 커널 슬라이스의 인덱스를 저장할 수 있다. According to an embodiment, in operation 107 , the electronic device may clip the selected kernel slice and replace the clipped kernel slice with the replacement slice. According to an embodiment, the electronic device may store the index of the clipped kernel slice.

일 실시예에 따르면, 전자 장치는 유사한 커널 슬라이스를 클리핑하고 클리핑된 커널 슬라이스의 인덱스를 재활용함으로써 추가적인 참조 공간 없이도 효율적으로 컨벌루션 뉴럴 네트워크의 공간 복잡성과 저장 공간 문제를 완화할 수 있다. 뉴럴 네트워크에서 미리 설정된 가중치가 차지하는 저장 공간을 클리핑하는 대신 입력 채널의 유사한 커널 슬라이스를 클리핑함으로써, 전자 장치는 뉴럴 네트워크의 공간 복잡성과 컨벌루션 레이어가 요구하는 저장 공간을 줄일 수 있다. 전자 장치는 컨벌루션 뉴럴 네트워크의 가중치의 표현 형식에 구애되지 않고 가중치를 클리핑할 수 있다. According to an embodiment, the electronic device may efficiently alleviate spatial complexity and storage space problems of a convolutional neural network without an additional reference space by clipping a similar kernel slice and recycling an index of the clipped kernel slice. By clipping a similar kernel slice of an input channel instead of clipping the storage space occupied by the preset weight in the neural network, the electronic device can reduce the spatial complexity of the neural network and the storage space required by the convolutional layer. The electronic device may clip the weights regardless of the expression format of the weights of the convolutional neural network.

도 2는 일 실시예에 따른 뉴럴 네트워크의 클리핑 방법의 예시적인 흐름도이다.2 is an exemplary flowchart of a clipping method of a neural network according to an embodiment.

전자 장치는 학습된 뉴럴 네트워크에 대해 입력 채널을 클리핑할 수 있다. 뉴럴 네트워크는 딥 뉴럴 네트워크로서 컨벌루션 레이어를 포함할 수 있다. 이하에서, 뉴럴 네트워크는 N으로 표시될 수 있다.The electronic device may clip the input channel with respect to the learned neural network. The neural network may include a convolutional layer as a deep neural network. Hereinafter, the neural network may be denoted by N.

동작(201)에서, 전자 장치는 뉴럴 네트워크 N의 정보를 획득할 수 있다. 전자 장치는 뉴럴 네트워크 N의 제1 컨벌루션 레이어의 커널

Figure pat00001
를 읽고 제1 컨벌루션 레이어의 컨벌루션 매개 변수를 획득할 수 있다. 컨벌루션 매개 변수는 입력 채널의 수 C, 출력 채널 수S, 컨벌루션 필터 너비w 및 컨벌루션 필터 높이h를 포함할 수 있다. 제1 컨벌루션 레이어는 입력 데이터가 통과하는 순방향을 기준으로 첫번째 컨벌루션 레이어를 의미할 수 있다.In operation 201, the electronic device may obtain information on the neural network N. The electronic device is a kernel of the first convolutional layer of the neural network N
Figure pat00001
can be read to obtain the convolution parameters of the first convolutional layer. The convolution parameters may include the number of input channels C, the number of output channels S, the convolution filter width w, and the convolution filter height h. The first convolutional layer may refer to a first convolutional layer based on a forward direction through which input data passes.

동작(203)에서, 전자 장치는 1에서 C까지의 입력 채널 각각에 대응하는 커널 슬라이스의 정보

Figure pat00002
를 획득할 수 있다. 여기서, 커널
Figure pat00003
은 4차원 텐서(tensor)일 수 있고, 커널 슬라이스는 각 입력 채널에 대응하는
Figure pat00004
일 수 있다. 예를 들어, 커널 슬라이스는 컨벌루션 레이어의 커널에 대응하는 행렬에서 추출된 벡터일 수 있다. 전자 장치는 길이가 C인 입력 채널에 대응하는 제1차원의 인덱스 1을 선택하고, 나머지 가능한 S, w 및 h의 모든 조합을 포함하는 커널 슬라이스
Figure pat00005
를 획득할 수 있다. 다음으로, 전자 장치는 길이가 C인 입력 채널에 대응하는 제1차원의 인덱스 2를 선택하고, 나머지 가능한 S, w 및 h의 모든 조합을 포함하는 커널 슬라이스
Figure pat00006
를 획득할 수 있다. 이처럼, 전자 장치는 제1 차원의 인덱스 1 부터 C까지 상기 과정을 반복하여 커널 슬라이스를 획득할 수 있다.In operation 203, the electronic device provides information on kernel slices corresponding to input channels 1 to C, respectively.
Figure pat00002
can be obtained. Here, the kernel
Figure pat00003
may be a 4D tensor, and the kernel slice corresponds to each input channel.
Figure pat00004
can be For example, the kernel slice may be a vector extracted from a matrix corresponding to the kernel of the convolutional layer. The electronic device selects an index 1 of a first dimension corresponding to an input channel of length C, and a kernel slice including all possible combinations of S, w and h.
Figure pat00005
can be obtained. Next, the electronic device selects a first-dimensional index 2 corresponding to an input channel of length C, and a kernel slice including all remaining possible combinations of S, w, and h.
Figure pat00006
can be obtained. As such, the electronic device may acquire the kernel slice by repeating the above process from index 1 to index C of the first dimension.

동작(205)에서, 전자 장치는 C개의 커널 슬라이스

Figure pat00007
에 대한 놈(norm)
Figure pat00008
을 계산할 수 있다. 전자 장치는 C개의 입력 채널의 커널 슬라이스 놈의 크기를 비교하여 유사한 놈을 가진 커널 슬라이스들을 클래스 별로 분류할 수 있다. 예를 들어, 커널 슬라이스는 T개의 클래스
Figure pat00009
,
Figure pat00010
, ??,
Figure pat00011
중의 하나로 분류될 수 있다.In operation 205 , the electronic device slices C kernels.
Figure pat00007
the norm for
Figure pat00008
can be calculated. The electronic device may classify kernel slices having similar norms by class by comparing sizes of kernel slice norms of C input channels. For example, a kernel slice has T classes
Figure pat00009
,
Figure pat00010
, ??,
Figure pat00011
can be classified as one of the

커널 슬라이스 간의 차이의 놈

Figure pat00012
을 사용할 경우, 두 개의 동일한 크기 텐서 A와 B 사이의 유사도를 비교할 수 있지만, 두 개의 입력 채널의 커널 슬라이스 간의 차이의 놈은 많은 양의 계산을 요구한다. 일 실시예에 따르면, 전자 장치는 먼저 각 입력 채널의 커널 슬라이스의 놈
Figure pat00013
을 계산하고, 커널 슬라이스의 놈의 유사도를 이용하여 임시적인 분류를 수행할 수 있다. 여기서, 동일한 클래스에 속하는 커널 슬라이스는 유사할 수 있지만 다른 클래스에 속하는 커널 슬라이스는 유사할 수 없다. 이후, 전자 장치는 각 클래스 내의 커널 슬라이스의 유사도를 계산함으로써 리소스를 절약하면서도 높은 수준의 정확도를 유지할 수 있다. Norm of difference between kernel slices
Figure pat00012
, it is possible to compare the similarity between two equal-size tensors A and B, but the norm of the difference between the kernel slices of two input channels requires a large amount of computation. According to an embodiment, the electronic device first performs a norm of a kernel slice of each input channel.
Figure pat00013
, and temporal classification can be performed using the similarity of the norm of the kernel slice. Here, kernel slices belonging to the same class may be similar, but kernel slices belonging to different classes may not be similar. Thereafter, the electronic device may maintain a high level of accuracy while saving resources by calculating the similarity of kernel slices within each class.

동작(207)에서, 전자 장치는 동일한 클래스 내의 커널 슬라이스 간의 유사도를 계산할 수 있다. 유사도

Figure pat00014
는 동일한
Figure pat00015
내에 있는 서로 다른 입력 채널의 커널 슬라이스 간 차이의 놈
Figure pat00016
으로 정의될 수 있다. 임계 값
Figure pat00017
에 대해
Figure pat00018
인 경우,
Figure pat00019
Figure pat00020
는 유사한 것으로 결정될 수 있다.In operation 207 , the electronic device may calculate a similarity between kernel slices within the same class. Similarity
Figure pat00014
is the same
Figure pat00015
Norm of difference between kernel slices of different input channels within
Figure pat00016
can be defined as threshold
Figure pat00017
About
Figure pat00018
If ,
Figure pat00019
Wow
Figure pat00020
can be determined to be similar.

동작(207)은 동작(205)과 연계되며, 전자 장치는 동일한 클래스 내의 커널 슬라이스 간의 유사도만을 계산함으로써 리소스를 절약하는 동시에 높은 수준의 정확도를 유지할 수 있다. 동작(205)의 차이의 놈은 예비적인 판단을 위한 것이고 동작(207)의 커널 슬라이스 간의 놈은 정확한 유사도 판단을 위한 것이다. 예를 들어, 벡터

Figure pat00021
와 벡터
Figure pat00022
의 놈은 동일하지만, 두 벡터 간의 차이의 놈은 4이다.Operation 207 is associated with operation 205 , and the electronic device can save resources while maintaining a high level of accuracy by calculating only similarities between kernel slices within the same class. The norm of difference in operation 205 is for preliminary determination and the norm between kernel slices in operation 207 is for accurate similarity determination. For example, vector
Figure pat00021
with vector
Figure pat00022
The norm of is the same, but the norm of the difference between the two vectors is 4.

동작(209)에서, 전자 장치는 T개의

Figure pat00023
에 대하여 각
Figure pat00024
에서 모든 입력 채널의 유사한 커널 슬라이스를 결정하고,
Figure pat00025
개의 세트를 획득할 수 있다. 세트는 M개일 수 있고, 여기서
Figure pat00026
일 수 있다. 각 세트
Figure pat00027
에는 입력 채널의 유사한 커널 슬라이스에 해당하는 입력 채널의 인덱스가 저장될 수 있다. 동일한
Figure pat00028
에 있는 각 두 개의 입력 채널의 인덱스 i 및 j에 해당하는 입력 채널의 커널 슬라이스
Figure pat00029
Figure pat00030
Figure pat00031
를 만족할 수 있다. 세트
Figure pat00032
에는 모든
Figure pat00033
중 유사한 입력 채널에 대응하지 않는 커널 슬라이스 인덱스가 저장될 수 있다.In operation 209, the electronic device has T
Figure pat00023
against each
Figure pat00024
determine similar kernel slices of all input channels in
Figure pat00025
You can get a set of dogs. The set can be M, where
Figure pat00026
can be each set
Figure pat00027
An index of an input channel corresponding to a similar kernel slice of the input channel may be stored in . same
Figure pat00028
Kernel slices of input channels corresponding to indices i and j of each of the two input channels in
Figure pat00029
and
Figure pat00030
Is
Figure pat00031
can be satisfied set
Figure pat00032
in all
Figure pat00033
A kernel slice index that does not correspond to a similar input channel may be stored.

Figure pat00034
에 대해, 전자 장치는 입력 채널의 가장 작은 인덱스의 커널 슬라이스
Figure pat00035
를 추출하고, 인덱스 순서로 추출된 커널 슬라이스와 다른 입력 채널의 커널 슬라이스
Figure pat00036
간의 유사도
Figure pat00037
을 계산할 수 있다. 전자 장치는
Figure pat00038
를 만족하는 입력 채널의 인덱스 i 및 j를 세트
Figure pat00039
에 포함시키고,
Figure pat00040
에 포함된 입력 채널의 인덱스를
Figure pat00041
에서 제거할 수 있다.
Figure pat00042
를 만족하는 입력 채널의 커널 슬라이스
Figure pat00043
를 찾지 못한 경우, 전자 장치는 i를 세트
Figure pat00044
에 포함시키고,
Figure pat00045
에서 i를 제거할 수 있다. each
Figure pat00034
For , the electronic device determines the kernel slice of the smallest index of the input channel.
Figure pat00035
, and the kernel slice extracted in index order and the kernel slice of the input channel different from that of the input channel.
Figure pat00036
similarity between
Figure pat00037
can be calculated. the electronic device
Figure pat00038
Set the indices i and j of the input channel that satisfy
Figure pat00039
included in
Figure pat00040
the index of the input channel included in
Figure pat00041
can be removed from
Figure pat00042
Kernel slice of the input channel that satisfies
Figure pat00043
If not found, the electronic device sets i
Figure pat00044
included in
Figure pat00045
i can be removed from

전자 장치 다음

Figure pat00046
에 대해 입력 채널의 가장 작은 인덱스의 커널 슬라이스
Figure pat00047
를 추출하고, 인덱스 순서로 추출된 커널 슬라이스와 다른 입력 채널의 커널 슬라이스
Figure pat00048
간의 채널 유사도
Figure pat00049
을 계산할 수 있다. 전자 장치는
Figure pat00050
를 만족하는 입력 채널의 인덱스 x 및 y를 세트
Figure pat00051
에 포함시키고,
Figure pat00052
에 입력된 입력 채널의 인덱스를
Figure pat00053
에서 제거할 수 있다.
Figure pat00054
를 만족하는 입력 채널의 커널 슬라이스
Figure pat00055
를 찾지 못하는 경우, 전자 장치는 x를 세트
Figure pat00056
에 포함시키고,
Figure pat00057
에서 x를 제거할 수 있다. 이처럼
Figure pat00058
가 빈 세트가 될 때까지 상기 과정이 반복되고,
Figure pat00059
개의
Figure pat00060
,
Figure pat00061
,
Figure pat00062
,
Figure pat00063
세트가 획득될 수 있다.electronic device
Figure pat00046
Kernel slice at the smallest index of the input channel for
Figure pat00047
, and the kernel slice extracted in index order and the kernel slice of the input channel different from that of the input channel.
Figure pat00048
channel similarity between
Figure pat00049
can be calculated. the electronic device
Figure pat00050
Set the indices x and y of the input channel that satisfy
Figure pat00051
included in
Figure pat00052
the index of the input channel input to
Figure pat00053
can be removed from
Figure pat00054
Kernel slice of the input channel that satisfies
Figure pat00055
If not found, the electronic device sets x
Figure pat00056
included in
Figure pat00057
x can be removed from like this
Figure pat00058
The above process is repeated until is an empty set,
Figure pat00059
doggy
Figure pat00060
,
Figure pat00061
,
Figure pat00062
,
Figure pat00063
A set may be obtained.

동작(209)의 결과, M개의

Figure pat00064
세트가 획득될 수 있다. M개의 세트 각각은 컨벌루션 커널 K에 포함된 커널 슬라이스 중에서 유사한 입력 채널의 인덱스를 포함할 수 있다. 세트
Figure pat00065
는 어느 것과도 유사하지 않은 입력 채널의 커널 슬라이스의 인덱스를 포함할 수 있다. 이처럼, 동작(209)은 클리핑될 입력 채널의 커널 슬라이스를 최종적으로 결정할 수 있다. As a result of operation 209, M
Figure pat00064
A set may be obtained. Each of the M sets may include an index of a similar input channel among kernel slices included in the convolution kernel K. set
Figure pat00065
may contain the index of the kernel slice of the input channel which is not similar to any one. As such, operation 209 may finally determine the kernel slice of the input channel to be clipped.

전자 장치는

Figure pat00066
Figure pat00067
를 기반으로 클리핑을 수행할 수 있다. 각
Figure pat00068
에 대해, 입력 채널의 인덱스 값 중 가장 낮은 값부터 시작하여 인덱스의 오름차순으로 비교 과정이 수행될 수 있다. 이를 통해,
Figure pat00069
가 변경된 후에 생길 수 있는 중복된 비교 과정을 피할 수 있다. 여기서,
Figure pat00070
또는
Figure pat00071
를 만족하는 입력 채널의 인덱스를 반복 기록하지 않는다는 것은 세트
Figure pat00072
또는
Figure pat00073
의 요소 값이 반복되지 않는다는 것을 의미하며, 그렇지 않으면 어떠한 입력 채널의 커널 슬라이스가 그 자체와 유사하다는 것을 의미한다. 만약 세트
Figure pat00074
및 M개의 세트
Figure pat00075
의 요소의 수량 및 분포가 미리 설정된 수량 요건 및/또는 분포 요건을 충족하지 못하는 경우, 동작(207)로 돌아가서 유사도의 임계 값
Figure pat00076
의 크기가 조정될 수 있다.the electronic device
Figure pat00066
and
Figure pat00067
Clipping can be performed based on each
Figure pat00068
, the comparison process may be performed in ascending order of the index starting from the lowest value among the index values of the input channel. because of this,
Figure pat00069
It is possible to avoid the duplicated comparison process that may occur after is changed. here,
Figure pat00070
or
Figure pat00071
Not repeating the index of the input channel that satisfies the set
Figure pat00072
or
Figure pat00073
It means that the element values of are not repeated, otherwise the kernel slice of any input channel is similar to itself. if set
Figure pat00074
and M sets
Figure pat00075
If the quantity and distribution of elements of n do not meet the preset quantity requirement and/or distribution requirement, it returns to operation 207 and the threshold value of similarity
Figure pat00076
can be resized.

동작(211)에서, 전자 장치는 세트

Figure pat00077
을 트래버스(traverse)할 수 있다. 전자 장치는 각
Figure pat00078
에 대해, 만약 그 원소의 개수가
Figure pat00079
인 경우, 그 중 모든 인덱스에 대응하는 입력 채널의 커널 슬라이스의 평균 커널 슬라이스를 계산할 수 있다. M개의 평균 커널 슬라이스가 획득될 수 있다. 전자 장치는 수학식 1에 따라 평균 커널 슬라이스를 계산할 수 있다. In operation 211, the electronic device sets
Figure pat00077
can be traversed. each electronic device
Figure pat00078
, if the number of elements is
Figure pat00079
In the case of , an average kernel slice of the kernel slices of the input channel corresponding to all indices may be calculated. M average kernel slices may be obtained. The electronic device may calculate the average kernel slice according to Equation (1).

Figure pat00080
Figure pat00080

동작(211)에서, 평균 커널 슬라이스는 입력 채널의 새로운 커널 슬라이스로서 클리핑된 커널 슬라이스 대신 추가될 수 있다. 여기서 평균 커널 슬라이스는 어떠한

Figure pat00081
에 있는 모든 입력 커널 슬라이스의 평균 텐서를 의미하며, 그 차원은 원래의 입력 채널의 커널 슬라이스
Figure pat00082
와 동일할 수 있다.
Figure pat00083
Figure pat00084
는 모두 M개이며,
Figure pat00085
의 개수에 따라 같은 수의 평균 커널 슬라이스가 생성될 수 있다.In operation 211 , the average kernel slice may be added instead of the clipped kernel slice as a new kernel slice of the input channel. where the average kernel slice is
Figure pat00081
Mean tensor of all input kernel slices in , whose dimension is the kernel slice of the original input channel
Figure pat00082
can be the same as
Figure pat00083
Wow
Figure pat00084
are all M,
Figure pat00085
According to the number of , the same number of average kernel slices may be generated.

동작(211)에서, 전자 장치는 모든 세트

Figure pat00086
를 트래버스할 수 있다. 각
Figure pat00087
에 대해, 전자 장치는 원래의 컨벌루션 커널
Figure pat00088
중에서 인덱스가
Figure pat00089
인 모든 입력 채널의 커널 슬라이스
Figure pat00090
를 클리핑할 수 있다. 전자 장치는
Figure pat00091
에 대응하는 평균 커널 슬라이스
Figure pat00092
를 클리핑된 커널 슬라이스 대신 해당 커널에 포함시킬 수 있다. 최종적인 컨벌루션 커널은
Figure pat00093
일 수 있다.In operation 211, the electronic device sets all
Figure pat00086
can be traversed. each
Figure pat00087
For , the electronic device has the original convolutional kernel
Figure pat00088
index among
Figure pat00089
Kernel slices for all input channels that are
Figure pat00090
can be clipped. the electronic device
Figure pat00091
Average kernel slice corresponding to
Figure pat00092
can be included in the corresponding kernel instead of the clipped kernel slice. The final convolutional kernel is
Figure pat00093
can be

컨벌루션 커널

Figure pat00094
은 입력 채널의 커널 슬라이스
Figure pat00095
로 구성되며, 총
Figure pat00096
개의 커널 슬라이스를 포함할 수 있다. 컨벌루션 커널
Figure pat00097
은 두 부분으로 구성될 수 있다. 첫 번째 부분은 원래의 컨벌루션 커널
Figure pat00098
에서
Figure pat00099
개의 클리핑되지 않은 입력 채널의 커널 슬라이스
Figure pat00100
이고, 두 번째 부분은 새로 추가된 M개의 평균 커널 슬라이스
Figure pat00101
일 수 있다.convolution kernel
Figure pat00094
is the kernel slice of the input channel
Figure pat00095
is composed of,
Figure pat00096
It can contain multiple kernel slices. convolution kernel
Figure pat00097
can be composed of two parts. The first part is the original convolutional kernel
Figure pat00098
at
Figure pat00099
Kernel slices of unclipped input channels
Figure pat00100
, and the second part is the newly added M average kernel slices.
Figure pat00101
can be

새로 추가된 M개의 평균 채널 커널 슬라이스

Figure pat00102
에는
Figure pat00103
에 포함된 원래의 인덱스 중에서 클리핑된 인덱스 p가 오름차순으로 할당될 수 있다. 전자 장치는 같은 순서로 모든
Figure pat00104
을 세트U의
Figure pat00105
에 기록할 수 있다. 클리핑 후, 세트
Figure pat00106
에 기록된 원래의 인덱스q는 오름차순으로 배열될 수 있다.M newly added average channel kernel slices
Figure pat00102
in
Figure pat00103
Among the original indices included in , the clipped index p may be allocated in ascending order. All electronic devices in the same order
Figure pat00104
Set U of
Figure pat00105
can be recorded in After clipping, set
Figure pat00106
The original index q written to can be arranged in ascending order.

동작(213)의 완료 후, 뉴럴 네트워크

Figure pat00107
의 다음 레이어가 컨벌루션 레이어인 경우, 동작(201)로 돌아가서 다음 레이어에 대한 전체 동작이 반복될 수 있다.After completion of operation 213, the neural network
Figure pat00107
If the next layer of is a convolutional layer, the process returns to operation 201 and the entire operation for the next layer may be repeated.

도 3은 일 실시예에 따른 뉴럴 네트워크의 클리핑 방법에서 커널 슬라이스를 추출하는 예시를 도시한 도면이다.3 is a diagram illustrating an example of extracting a kernel slice in a clipping method of a neural network according to an embodiment.

전자 장치는 1에서 C까지의 입력 채널 각각에 대응하는 커널 슬라이스의 정보

Figure pat00108
를 획득할 수 있다. 여기서, 커널
Figure pat00109
은 4차원 텐서(tensor)일 수 있고, 커널 슬라이스는 각 입력 채널에 대응하는
Figure pat00110
일 수 있다.The electronic device provides information on the kernel slice corresponding to each input channel from 1 to C.
Figure pat00108
can be obtained. Here, the kernel
Figure pat00109
may be a 4D tensor, and the kernel slice corresponds to each input channel.
Figure pat00110
can be

도 3을 참조하면, 커널

Figure pat00111
에서 C=4, S=7이고, 각 행의 S개의 컨벌루션 필터는 하나의 입력 채널의 커널 슬라이스이다. 커널 슬라이스의 크기는
Figure pat00112
이고, 입력 채널의 커널 슬라이스는 각각
Figure pat00113
,
Figure pat00114
,
Figure pat00115
,
Figure pat00116
이다.Referring to Figure 3, the kernel
Figure pat00111
C = 4, S = 7, and S convolutional filters in each row are kernel slices of one input channel. The size of the kernel slice is
Figure pat00112
, and the kernel slice of the input channel is each
Figure pat00113
,
Figure pat00114
,
Figure pat00115
,
Figure pat00116
am.

도 4는 일 실시예에 따른 뉴럴 네트워크의 클리핑 방법에서 커널 슬라이스의 클래스를 분류하는 예시를 도시한 도면이다.4 is a diagram illustrating an example of classifying a class of a kernel slice in a clipping method of a neural network according to an embodiment.

전자 장치는 C개의 커널 슬라이스

Figure pat00117
에 대한 놈(norm)
Figure pat00118
을 계산할 수 있다. 전자 장치는 C개의 입력 채널의 커널 슬라이스 놈의 크기를 비교하여 유사한 놈을 가진 커널 슬라이스들을 클래스 별로 분류할 수 있다. The electronic device has C kernel slices
Figure pat00117
the norm for
Figure pat00118
can be calculated. The electronic device may classify kernel slices having similar norms by class by comparing sizes of kernel slice norms of C input channels.

도 4를 참조하면, 축은 입력 채널의 차원이며, 8개의 입력 채널에 대응하는 커널 슬라이스가 도시된다. a, b, c, d, e, f, g, h는 입력 채널의 커널 슬라이스의 인덱스이다. 커널 슬라이스들은 놈의 유사도에 따라 T=2개의 클래스인

Figure pat00119
Figure pat00120
로 나뉠 수 있다. 적어도,
Figure pat00121
에 포함된 커널 슬라이스와
Figure pat00122
에 포함된 커널 슬라이스는 유사하지 않다는 사실을 알 수 있다.Referring to FIG. 4 , an axis is a dimension of an input channel, and kernel slices corresponding to eight input channels are shown. a, b, c, d, e, f, g, h are the indices of the kernel slice of the input channel. Kernel slices are divided into T = 2 classes according to the similarity of the norm.
Figure pat00119
class
Figure pat00120
can be divided into At least,
Figure pat00121
the kernel slice contained in
Figure pat00122
It can be seen that the kernel slices contained in .

도 5는 일 실시예에 따른 뉴럴 네트워크의 클리핑 방법에서 동일한 클래스에 속한 커널 슬라이스의 유사도를 결정하는 예시를 도시한 도면이다.5 is a diagram illustrating an example of determining a degree of similarity between kernel slices belonging to the same class in a clipping method of a neural network according to an embodiment.

전자 장치는 T개의

Figure pat00123
에 대하여 각
Figure pat00124
에서 모든 입력 채널의 유사한 커널 슬라이스를 결정하고,
Figure pat00125
개의 세트를 획득할 수 있다. 도 5를 참조하면,
Figure pat00126
는 7개의 입력 채널의 인덱스를 포함하고, 인덱스는 순서대로 a, b, c, d, e, f, g일 수 있다. 전자 장치는 가장 작은 인덱스 a를 선택하여
Figure pat00127
의 관계를 계산할 수 있다. 이러한 관계는
Figure pat00128
,
Figure pat00129
,
Figure pat00130
,
Figure pat00131
가 서로 유사하다는 것을 의미하며, 전자 장치는 a, c, d, f를 세트
Figure pat00132
에 포함시킬 수 있다.
Figure pat00133
에는 b, e, g가 남게 된다. 전자 장치는 다시
Figure pat00134
에서 가장 작은 인덱스 b를 선택하고,
Figure pat00135
Figure pat00136
가 서로 유사하다는 것을 결정할 수 있다. b, e는 세트
Figure pat00137
에 포함되고,
Figure pat00138
에서 마지막으로 남은 g는 세트
Figure pat00139
에 포함될 수 있다.Electronic devices are T
Figure pat00123
against each
Figure pat00124
determine similar kernel slices of all input channels in
Figure pat00125
You can get a set of dogs. Referring to Figure 5,
Figure pat00126
includes the indices of 7 input channels, and the indices may be a, b, c, d, e, f, g in order. The electronic device selects the smallest index a
Figure pat00127
relationship can be calculated. These relationships are
Figure pat00128
,
Figure pat00129
,
Figure pat00130
,
Figure pat00131
means that are similar to each other, and the electronic device sets a, c, d, f
Figure pat00132
can be included in
Figure pat00133
b, e, and g remain. electronic device again
Figure pat00134
choose the smallest index b from
Figure pat00135
and
Figure pat00136
can be determined to be similar to each other. b, e set
Figure pat00137
included in
Figure pat00138
The last remaining g in is set
Figure pat00139
can be included in

도 6은 일 실시예에 따른 뉴럴 네트워크의 클리핑 방법에서 선택된 커널 슬라이스와 유사한 커널 슬라이스를 클리핑하는 예시를 도시한 도면이다.6 is a diagram illustrating an example of clipping a kernel slice similar to a selected kernel slice in a neural network clipping method according to an embodiment.

입력 채널의 차원에서 원래의 컨벌루션 커널 K에 대응하는 새로운 컨벌루션 커널

Figure pat00140
의 원래의 인덱스는 증가할 수 있다. 첫 번째 부분의 클리핑되지 않은 원래의 커널 슬라이스의 인덱스 순서가 변경되지 않고, 두 번째 부분의 평균 커널 슬라이스에 할당되는 첫 번째 인덱스도 순서대로 증가한다는 점에서 계산은 편리해질 수 있다. A new convolutional kernel corresponding to the original convolutional kernel K in the dimension of the input channel.
Figure pat00140
The original index of may be incremented. The calculation may be convenient in that the index order of the original unclipped kernel slice of the first part is not changed, and the first index allocated to the average kernel slice of the second part is also increased in order.

도 6을 참조하면, 원래의 컨벌루션 커널은 8개의 입력 채널의 커널 슬라이스를 포함할 수 있다. 두 번째 및 네 번째의 입력 채널의 커널 슬라이스는 유사하고, 여섯 번째 및 일곱 번째의 입력 채널의 커널 슬라이스는 유사할 수 있다. 전자 장치는

Figure pat00141
에 포함된 인덱스에 따라 6번째 및 7번째 입력 채널의 커널 슬라이스를 클리핑하고,
Figure pat00142
에 포함된 인덱스에 따라 2번째 및 4번째 입력 채널의 커널 슬라이스를 클리핑할 수 있다. 이런 식으로 나머지 원래의 입력 채널의 커널 슬라이스의 배열 순서는 클리핑 후의 새로운 컨벌루션 커널에서 변경되지 않는다. 이후, 전자 장치는
Figure pat00143
에 해당하는 평균 커널 슬라이스
Figure pat00144
를 클리핑된 컨벌루션 커널에 포함시키고,
Figure pat00145
에 해당하는 평균 커널 슬라이스
Figure pat00146
를 클리핑된 컨벌루션 커널에 포함시킬 수 있다. 이는
Figure pat00147
의 가장 작은 원래의 인덱스가 2이고,
Figure pat00148
의 가장 작은 원래의 인덱스가 6이기 때문이다. Referring to FIG. 6 , the original convolutional kernel may include kernel slices of 8 input channels. The kernel slices of the second and fourth input channels may be similar, and the kernel slices of the sixth and seventh input channels may be similar. the electronic device
Figure pat00141
clip the kernel slices of the 6th and 7th input channels according to the index contained in
Figure pat00142
Kernel slices of the second and fourth input channels may be clipped according to the index included in . In this way, the arrangement order of the kernel slices of the remaining original input channels is not changed in the new convolutional kernel after clipping. After that, the electronic device
Figure pat00143
average kernel slice corresponding to
Figure pat00144
in the clipped convolution kernel,
Figure pat00145
average kernel slice corresponding to
Figure pat00146
can be included in the clipped convolution kernel. this is
Figure pat00147
The smallest original index of is 2,
Figure pat00148
This is because the smallest original index of .

후속 단계의 계산을 더욱 용이하게 하기 위해, 새로운 컨벌루션 커널과 관련된 원래의 입력 채널의 커널 슬라이스의 인덱스를 기록하기 위한 추가적인 참조 구조가 필요할 수 있다. 첫 번째 부분의 클리핑되지 않은 원래의 커널 슬라이스의 경우, 원래의 인덱스는 순서대로 세트

Figure pat00149
에 기록되고, 두 번째 부분의 평균 커널 슬라이스의 경우, 원래의 인덱스를 포함하는
Figure pat00150
은 가장 작은 원래의 인덱스의 순서대로 세트U에 기록될 수 있다. 도 6을 참조하면,
Figure pat00151
이고,
Figure pat00152
이다.To further facilitate the computation of subsequent steps, an additional reference structure may be needed to record the index of the kernel slice of the original input channel associated with the new convolutional kernel. For the original unclipped kernel slice of the first part, the original indices are set in order.
Figure pat00149
is written to, and for the average kernel slice of the second part, containing the original index
Figure pat00150
may be written to the set U in the order of the smallest original index. Referring to Figure 6,
Figure pat00151
ego,
Figure pat00152
am.

도 7은 일 실시예에 따른 뉴럴 네트워크의 계산 방법의 동작을 도시한 흐름도이다.7 is a flowchart illustrating an operation of a method for calculating a neural network according to an embodiment.

일 실시예에 따르면, 동작(701)에서, 전자 장치는 뉴럴 네트워크에 포함된 컨벌루션 레이어의 인덱스 정보를 기초로 각 입력 채널의 커널 슬라이스가 대체 슬라이스인지 판단할 수 있다. 일 실시예에 따르면, 동작(703)에서, 전자 장치는 커널 슬라이스가 대체 슬라이스인 경우 인덱스 정보 중에서 대체 슬라이스의 인덱스를 획득할 수 있다. 일 실시예에 따르면, 동작(705)에서, 전자 장치는 대체 슬라이스의 인덱스를 기초로 컨벌루션을 계산할 수 있다. 여기서, 컨벌루션 레이어의 컨벌루션 매개 변수에 기초하여 선택된 커널 슬라이스와 유사한 커널 슬라이스는 클리핑되고 대체 슬라이스로 대체된 것일 수 있다. According to an embodiment, in operation 701, the electronic device may determine whether a kernel slice of each input channel is a replacement slice based on index information of a convolutional layer included in the neural network. According to an embodiment, in operation 703 , when the kernel slice is the replacement slice, the electronic device may obtain the index of the replacement slice from among the index information. According to an embodiment, in operation 705 , the electronic device may calculate a convolution based on the index of the replacement slice. Here, a kernel slice similar to the kernel slice selected based on the convolution parameter of the convolutional layer may be clipped and replaced with a replacement slice.

커널 슬라이스가 대체 슬라이스인 경우, 전자 장치는 대체 슬라이스에 할당된 클리핑된 커널 슬라이스의 인덱스를 결정할 수 있다. 전자 장치는 결정된 인덱스에 대응하는 대체 슬라이스에 대해 컨벌루션 연산을 수행할 수 있다. 커널 슬라이스가 대체 슬라이스가 아닌 경우, 전자 장치는 원래의 커널 슬라이스의 인덱스를 이용하여 해당 커널 슬라이스에 대한 컨벌루션 연산을 수행할 수 있다. When the kernel slice is the replacement slice, the electronic device may determine the index of the clipped kernel slice allocated to the replacement slice. The electronic device may perform a convolution operation on the replacement slice corresponding to the determined index. When the kernel slice is not the replacement slice, the electronic device may perform a convolution operation on the corresponding kernel slice by using the index of the original kernel slice.

일 실시예에 따르면, 전자 장치는 일 실시예에 따른 뉴럴 네트워크의 계산 방법을 이용하여 이미지 또는 음성의 인식을 수행할 수 있다. 도 1에 의해 클리핑된 컨벌루션 뉴럴 네트워크는 이미지 또는 음성의 인식을 위해 사용될 수 있다. According to an embodiment, the electronic device may perform image or voice recognition using the neural network calculation method according to the embodiment. The convolutional neural network clipped by FIG. 1 may be used for image or voice recognition.

전자 장치는 사용자 입력을 통해 이미지 또는 음성을 수신할 수 있다. 예를 들어, 이미지의 형식에는 제한이 없으며 이미지는

Figure pat00153
일 수 있다. 여기서 C, W 및 H는 각각 이미지의 채널 수, 이미지의 너비 및 이미지의 높이를 나타낸다.
Figure pat00154
는 C개 채널의 WХH 크기의 특징 다이어그램을 포함할 수 있다.The electronic device may receive an image or a voice through a user input. For example, there are no restrictions on the format of an image,
Figure pat00153
can be where C, W, and H represent the number of channels in the image, the width of the image, and the height of the image, respectively.
Figure pat00154
may include a feature diagram of the size of WХH of C channels.

전자 장치는 수신된 이미지 또는 음성을 컨벌루션 뉴럴 네트워크의 제1 컨벌루션 레이어에 입력할 수 있다. 예를 들어, 전자 장치는 수신된 이미지

Figure pat00155
를 클리핑된 뉴럴 네트워크의 제1 컨벌루션 레이어에 입력할 수 있다. 이미지 인식에 사용되는 뉴럴 네트워크는 학습 데이터에 의해 미리 학습되고 클리핑될 수 있다.The electronic device may input the received image or voice to the first convolutional layer of the convolutional neural network. For example, the electronic device may display a received image
Figure pat00155
may be input to the first convolutional layer of the clipped neural network. A neural network used for image recognition may be pre-trained and clipped by training data.

전자 장치는 뉴럴 네트워크의 제1 컨벌루션 레이어부터 시작하여 뉴럴 네트워크의 각 컨벌루션 레이어를 차례대로 트래버스할 수 있다. 전자 장치는 각 입력 채널의 커널 슬라이스에 대해 커널 슬라이스의 인덱스에 따라 입력 채널의 커널 슬라이스가 대체 슬라이스인지 여부를 결정할 수 있다. The electronic device may sequentially traverse each convolutional layer of the neural network, starting with the first convolutional layer of the neural network. For the kernel slice of each input channel, the electronic device may determine whether the kernel slice of the input channel is the replacement slice according to the index of the kernel slice.

입력 채널의 커널 슬라이스가 대체 슬라이스인 경우, 전자 장치는 입력 채널의 커널 슬라이스로 대체된 입력 채널의 클리핑된 커널 슬라이스의 인덱스를 획득하고, 인덱스에 기초하여 컨벌루션 계산을 수행할 수 있다.When the kernel slice of the input channel is the replacement slice, the electronic device may obtain an index of the clipped kernel slice of the input channel replaced with the kernel slice of the input channel, and perform a convolution calculation based on the index.

전자 장치는 대체 슬라이스를 나타내는 인덱스를 기초로 대체 슬라이스를 결정하고, 결정된 커널 슬라이스(즉, 대체 슬라이스)에 대해 합계 계산을 수행하고, 합계 계산의 결과와 커널 슬라이스에 대해 컨벌루션 연산을 수행하여, 클리핑된 뉴럴 네트워크에서 컨벌루션 연산을 수행할 수 있다.The electronic device determines a replacement slice based on an index indicating the replacement slice, performs a sum calculation on the determined kernel slice (ie, a replacement slice), and performs a convolution operation on the result of the sum calculation and the kernel slice, so that clipping Convolutional operation can be performed on a neural network.

입력 채널의 커널 슬라이스가 대체 슬라이스가 아닌 경우, 전자 장치는 컨벌루션 입력 채널의 인덱스에 대응하는 커널 슬라이스를 결정하고, 결정된 커널 슬라이스에 대해 컨벌루션 계산을 수행할 수 있다.When the kernel slice of the input channel is not the replacement slice, the electronic device may determine a kernel slice corresponding to the index of the convolutional input channel and perform a convolution calculation on the determined kernel slice.

전자 장치는 컨벌루션 레이어의 모든 입력 채널의 커널 슬라이스의 컨벌루션 계산 결과의 누적 값을 컨벌루션 레이어의 출력 결과로서 출력할 수 있다. 전자 장치는 뉴럴 네트워크의 마지막 컨벌루션 레이어의 출력 결과를 이미지 또는 음성의 인식 결과로서 출력할 수 있다. The electronic device may output an accumulated value of a convolution calculation result of kernel slices of all input channels of the convolutional layer as an output result of the convolutional layer. The electronic device may output an output result of the last convolutional layer of the neural network as an image or voice recognition result.

전자 장치는 클리핑된 뉴럴 네트워크를 이용하여 컨벌루션 연산을 수행함으로써 이미지 또는 음성 인식에 사용되는 뉴럴 네트워크 및 계산의 복잡도를 완화하고, 뉴럴 네트워크의 저장 공간을 줄이며, 뉴럴 네트워크의 운영 환경에 대한 요건을 완화할 수 있다. The electronic device performs a convolution operation using the clipped neural network, thereby reducing the complexity of neural networks and computations used for image or speech recognition, reducing the storage space of the neural network, and easing the requirements for the operating environment of the neural network. can do.

예를 들어, 전자 장치는 클리핑된 컨벌루션 커널

Figure pat00156
의 입력 채널의 커널 슬라이스
Figure pat00157
를 순서대로 트래버스할 수 있다.
Figure pat00158
일 경우, 해당 입력 채널의 커널 슬라이스가 원래의 컨벌루션 커널
Figure pat00159
에 해당한다는 것을 의미할 수 있다. 원래의 컨벌루션 커널에서의 인덱스는
Figure pat00160
, 즉 세트
Figure pat00161
의 s 번째 요소이므로, 전자 장치는 입력 채널의
Figure pat00162
번째 커널 슬라이스
Figure pat00163
Figure pat00164
에 대해 일반적인 컨벌루션 연산을 수행하여 해당 회차의 출력
Figure pat00165
을 획득할 수 있다.
Figure pat00166
일 경우, 해당 입력 채널의 커널 슬라이스는 M개의 평균 커널 슬라이스
Figure pat00167
에서
Figure pat00168
번째임을 의미할 수 있다. 전자 장치는
Figure pat00169
번째 요소
Figure pat00170
을 읽고, 다시
Figure pat00171
에서 모든 원래의 커널 슬라이스의 인덱스
Figure pat00172
를 읽을 수 있다. 전자 장치는 입력 채널의 모든 p번째 커널 슬라이스
Figure pat00173
와 합한 후
Figure pat00174
와 일반적인 컨벌루션을 수행하여 해당 회차의 출력
Figure pat00175
을 획득할 수 있다. 모든
Figure pat00176
을 더하여 획득한 출력은 원래의 컨벌루션 출력
Figure pat00177
과 기본적으로 동일하며,
Figure pat00178
Figure pat00179
일 수 있다.For example, the electronic device may have a clipped convolutional kernel
Figure pat00156
Kernel slice of the input channel of
Figure pat00157
can be traversed in order.
Figure pat00158
, the kernel slice of the corresponding input channel is the original convolutional kernel.
Figure pat00159
may mean that it corresponds to The index in the original convolutional kernel is
Figure pat00160
, i.e. set
Figure pat00161
Since the s-th element of the electronic device is the input channel's
Figure pat00162
second kernel slice
Figure pat00163
and
Figure pat00164
Perform a general convolution operation on
Figure pat00165
can be obtained.
Figure pat00166
, the kernel slice of the corresponding input channel is M average kernel slices.
Figure pat00167
at
Figure pat00168
It could mean the second. the electronic device
Figure pat00169
second element
Figure pat00170
read it again
Figure pat00171
indices of all original kernel slices in
Figure pat00172
can read The electronic device slices every pth kernel of the input channel.
Figure pat00173
after combining with
Figure pat00174
Perform a general convolution with the output of the round
Figure pat00175
can be obtained. every
Figure pat00176
The output obtained by adding is the original convolutional output
Figure pat00177
is basically the same as
Figure pat00178
Figure pat00179
can be

도 8은 일반적인 컨벌루션 연산의 예시를 도시한 도면이다.8 is a diagram illustrating an example of a general convolution operation.

일반적인 컨벌루션 연산의 경우, 매번 모든 입력 특징 다이어그램을 연산에 참여시킴으로써 하나의 출력 특징 다이어그램을 얻고 마지막으로 모든 출력 특징 다이어그램을 합치는 과정을 포함할 수 있다. 일 실시예에 따른 컨벌루션 연산의 경우, 매번 하나의 입력 특징 다이어그램만 계산에 참여시킴으로써 모든 출력 특징 다이어그램을 얻지만, 이러한 출력 특징 다이어그램의 정보는 완전하지 않으며, 모든 입력 특징 다이어그램을 트래버스한 후에 각각의 출력 특징 다이어그램을 중첩시키는 과정을 포함할 수 있다. In the case of a general convolution operation, it may include the process of getting one output feature diagram by participating in the operation every time all the input feature diagrams and finally merging all the output feature diagrams. In the case of the convolution operation according to an embodiment, all output feature diagrams are obtained by participating in the calculation of only one input feature diagram each time, but the information of these output feature diagrams is not complete, and after traversing all input feature diagrams, each It may include the process of superimposing the output feature diagram.

일반적인 컨벌루션 연산의 경우, 모든 입력 특징 다이어그램과 이에 대응하는 입력 채널의 커널 슬라이스의 일부에 대해 먼저 컨벌루션 연산이 수행된 후에 그 결과들이 합산되어 출력 특징 다이어그램이 획득될 수 있다. 도8을 참조하면, 컨벌루션을 통해 8 개의 입력 특징 다이어그램은 12개의 출력 특징 다이어그램으로 변환될 수 있다. 도8의 컨벌루션 커널의 빗금친 부분 및 이에 대응하는 입력 채널의 인덱스와 동일한 입력 특징 다이어그램에 대해 각각 일반적인 컨벌루션이 수행되고, 그 결과들은 서로 합산되고, 도8의 빗금친 부분의 제6 출력 특징 다이어그램이 획득될 수 있다. In the case of a general convolution operation, a convolution operation is first performed on all input feature diagrams and a portion of a kernel slice of an input channel corresponding thereto, and then the results are summed to obtain an output feature diagram. Referring to FIG. 8 , 8 input feature diagrams may be converted into 12 output feature diagrams through convolution. A general convolution is respectively performed on the hatched portion of the convolution kernel of FIG. 8 and the input feature diagram that is the same as the index of the corresponding input channel, the results are summed, and the sixth output feature diagram of the hatched portion of FIG. this can be obtained.

한편, 일 실시예에 따르면, 전자 장치는

Figure pat00180
와 같은 하나의 입력 특징 다이어그램을 차례대로 동일한 입력 채널의 인덱스의
Figure pat00181
의 12개 부분과 각각 컨벌루션함으로써 12개의 출력 특징 다이어그램을 포함하는 텐서
Figure pat00182
, 즉,
Figure pat00183
를 획득할 수 있다. 이후에, 전자 장치는 모든 입력 특징 다이어그램을 트래버스 한 후, 12개의 출력 특징 다이어그램을 포함하는 8개의 출력 텐서를 획득할 수 있으며, 출력 텐서는 각각
Figure pat00184
,
Figure pat00185
,
Figure pat00186
,
Figure pat00187
이다. 마지막으로, 전자 장치는 8개의 출력 텐서를 합하여, 일반적인 컨벌루션 연산과 동일한 출력, 즉
Figure pat00188
를 얻을 수 있다. Meanwhile, according to an embodiment, the electronic device
Figure pat00180
One input feature diagram such as
Figure pat00181
A tensor containing 12 output feature diagrams by convolving each with 12 parts of
Figure pat00182
, In other words,
Figure pat00183
can be obtained. Thereafter, after traversing all input feature diagrams, the electronic device may obtain 8 output tensors including 12 output feature diagrams, and the output tensors are each
Figure pat00184
,
Figure pat00185
,
Figure pat00186
,
Figure pat00187
am. Finally, the electronic device sums the eight output tensors, resulting in the same output as a normal convolution operation, i.e.
Figure pat00188
can get

도 9는 일 실시예에 따른 뉴럴 네트워크의 계산 방법에서 컨벌루션 계산의 예시를 도시한 도면이다.9 is a diagram illustrating an example of a convolution calculation in a method of calculating a neural network according to an embodiment.

도9의 컨벌루션 커널의 클리핑 결과는 도8과 동일하며,

Figure pat00189
,
Figure pat00190
,
Figure pat00191
,
Figure pat00192
이다. 클리핑된 컨벌루션 커널
Figure pat00193
의 입력 채널의 커널 슬라이스는 차례대로 트래버스될 수 있다. 커널 슬라이스
Figure pat00194
는 원래의 컨벌루션 커널에 속하며 원래의 인덱스는
Figure pat00195
이므로, 커널 슬라이스와
Figure pat00196
에 대한 컨벌루션 연산이 수행되면
Figure pat00197
가 획득될 수 있다. 커널 슬라이스
Figure pat00198
는 원래의 컨벌루션 커널에 속하며 원래의 인덱스는
Figure pat00199
이므로, 커널 슬라이스와
Figure pat00200
에 대한 컨벌루션 연산이 수행되면
Figure pat00201
가 획득될 수 있다. 커널 슬라이스
Figure pat00202
는 원래의 컨벌루션 커널에 속하며 원래의 인덱스는
Figure pat00203
이므로, 커널 슬라이스와
Figure pat00204
에 대하여 컨벌루션 연산이 수행되면
Figure pat00205
가 획득될 수 있다. 커널 슬라이스
Figure pat00206
는 원래의 컨벌루션 커널에 속하며 원래의 인덱스 값은
Figure pat00207
이므로, 커널 슬라이스와
Figure pat00208
에 대해 컨벌루션 연산이 수행되면
Figure pat00209
가 획득될 수 있다. 커널 슬라이스
Figure pat00210
는 2개의 평균 커널 슬라이스 중 첫 번째에서 유래하고, 전자 장치는 U에서 첫 번째 요소
Figure pat00211
를 읽은 다음
Figure pat00212
에서 원래의 인덱스
Figure pat00213
를 획득할 수 있다. 전자 장치는 커널 슬라이스와
Figure pat00214
Figure pat00215
에 대해 컨벌루션 연산을 수행하여
Figure pat00216
를 획득할 수 있다. 커널 슬라이스
Figure pat00217
는 2개의 평균 커널 슬라이스 중 두 번째에서 유래하고, 전자 장치는 U에서 두 번째 요소
Figure pat00218
를 읽은 다음
Figure pat00219
에서 원래의 인덱스
Figure pat00220
를 획득할 수 있다. 전자 장치는 커널 슬라이스와
Figure pat00221
Figure pat00222
에 대해 컨벌루션 연산을 수행하여
Figure pat00223
를 획득할 수 있다. 전자 장치는
Figure pat00224
Figure pat00225
을 획득할 수 있으며, 근사값을 획득하는 이유는 평균 커널 슬라이스가 클리핑된 원래의 입력 채널의 커널 슬라이스를 대체하기 때문이다.
Figure pat00226
Figure pat00227
은 각각 두 개의 입력 특징 다이어그램과 관련된다. 전자 장치는 입력 특징 다이어그램의 합을 먼저 계산한 다음 컨벌루션을 수행함으로써 컨벌루션 연산의 회수를 줄이고 계산의 효율성을 높일 수 있다.The clipping result of the convolution kernel of FIG. 9 is the same as that of FIG.
Figure pat00189
,
Figure pat00190
,
Figure pat00191
,
Figure pat00192
am. Clipped Convolution Kernel
Figure pat00193
Kernel slices of the input channel of can be traversed in turn. Kernel Slice
Figure pat00194
belongs to the original convolutional kernel, and the original index is
Figure pat00195
So, the kernel slice and
Figure pat00196
When a convolution operation is performed on
Figure pat00197
can be obtained. Kernel Slice
Figure pat00198
belongs to the original convolutional kernel, and the original index is
Figure pat00199
So, the kernel slice and
Figure pat00200
When a convolution operation is performed on
Figure pat00201
can be obtained. Kernel Slice
Figure pat00202
belongs to the original convolutional kernel, and the original index is
Figure pat00203
So, the kernel slice and
Figure pat00204
When a convolution operation is performed on
Figure pat00205
can be obtained. Kernel Slice
Figure pat00206
belongs to the original convolutional kernel, and the original index value is
Figure pat00207
So, the kernel slice and
Figure pat00208
When a convolution operation is performed on
Figure pat00209
can be obtained. Kernel Slice
Figure pat00210
is from the first of the two average kernel slices, and the electronic device is the first element in U.
Figure pat00211
then read
Figure pat00212
original index in
Figure pat00213
can be obtained. The electronics consist of a kernel slice and
Figure pat00214
and
Figure pat00215
By performing a convolution operation on
Figure pat00216
can be obtained. Kernel Slice
Figure pat00217
is from the second of the two average kernel slices, and the electronic device is the second element in U.
Figure pat00218
then read
Figure pat00219
original index in
Figure pat00220
can be obtained. The electronics consist of a kernel slice and
Figure pat00221
and
Figure pat00222
By performing a convolution operation on
Figure pat00223
can be obtained. the electronic device
Figure pat00224
Figure pat00225
can be obtained, and the reason for obtaining an approximation is that the average kernel slice replaces the kernel slice of the original clipped input channel.
Figure pat00226
and
Figure pat00227
are each associated with two input feature diagrams. The electronic device may reduce the number of convolution operations and increase computational efficiency by first calculating the sum of the input feature diagrams and then performing convolution.

도 10은 일 실시예에 따른 전자 장치의 구성을 도시한 도면이다.10 is a diagram illustrating a configuration of an electronic device according to an exemplary embodiment.

일 실시예에 따르면, 전자 장치(1000)는 적어도 하나의 프로세서(1001)를 포함할 수 있다. 전자 장치(1000)는 메모리(1003)를 더 포함할 수 있다. 메모리(1003)는 뉴럴 네트워크 및 뉴럴 네트워크의 운영에 필요한 데이터를 저장할 수 있다. 메모리(1003)는 뉴럴 네트워크에 입력될 입력 데이터 및 출력되는 출력 데이터를 저장할 수 있다.According to an embodiment, the electronic device 1000 may include at least one processor 1001 . The electronic device 1000 may further include a memory 1003 . The memory 1003 may store the neural network and data necessary for the operation of the neural network. The memory 1003 may store input data to be input to the neural network and output data to be output.

프로세서(1001)는 뉴럴 네트워크에 포함된 컨벌루션 레이어의 컨벌루션 매개 변수에 기초하여 컨벌루션 레이어의 입력 채널의 커널 슬라이스(kernel slice)를 선택할 수 있다. 컨벌루션 매개 변수는 컨벌루션 레이어의 입력 채널의 수, 출력 채널의 수, 컨벌루션 커널의 필터의 폭, 컨벌루션 커널의 필터의 높이를 포함할 수 있다.The processor 1001 may select a kernel slice of the input channel of the convolutional layer based on the convolution parameter of the convolutional layer included in the neural network. The convolution parameter may include the number of input channels of the convolutional layer, the number of output channels, the width of the filter of the convolutional kernel, and the height of the filter of the convolutional kernel.

프로세서(1001)는 선택된 커널 슬라이스와 유사한 하나 이상의 커널 슬라이스를 결정할 수 있다. 프로세서(1001)는 하나 이상의 유사한 커널 슬라이스를 기초로 선택된 커널 슬라이스를 대체하는 대체 슬라이스를 결정할 수 있다. 프로세서(1001)는 선택된 커널 슬라이스를 클리핑하고 대체 슬라이스로 클리핑된 커널 슬라이스를 대체할 수 있다.The processor 1001 may determine one or more kernel slices similar to the selected kernel slice. The processor 1001 may determine a replacement slice to replace the selected kernel slice based on one or more similar kernel slices. The processor 1001 may clip the selected kernel slice and replace the clipped kernel slice with the replacement slice.

일 실시예에 따르면, 전자 장치는 컨벌루션 레이어 트래버스 유닛, 슬라이스 획득 유닛, 유사 슬라이스 결정 유닛, 대체 슬라이스 결정 유닛 및 유사 슬라이스 클리핑 유닛을 포함할 수 있다. 컨벌루션 레이어 트래버스 유닛, 슬라이스 획득 유닛, 유사 슬라이스 결정 유닛, 대체 슬라이스 결정 유닛 및 유사 슬라이스 클리핑 유닛은 하나 이상의 프로세서(1001)로 구현되거나, 소프트웨어로 구현되어 메모리(1003)에 저장될 수 있다.According to an embodiment, the electronic device may include a convolutional layer traverse unit, a slice obtaining unit, a similar slice determining unit, a replacement slice determining unit, and a similar slice clipping unit. The convolutional layer traverse unit, slice obtaining unit, similar slice determining unit, replacement slice determining unit, and similar slice clipping unit may be implemented with one or more processors 1001 , or implemented with software and stored in the memory 1003 .

컨벌루션 레이어 트래버스 유닛은 뉴럴 네트워크의 각 컨벌루션 레이어를 트래버스하도록 구성될 수 있다. 슬라이스 획득 유닛은 컨벌루션 레이어의 컨벌루션 매개 변수에 기초하여 입력 채널의 커널 슬라이스를 획득하도록 구성될 수 있다.The convolutional layer traverse unit may be configured to traverse each convolutional layer of the neural network. The slice acquiring unit may be configured to acquire the kernel slice of the input channel based on the convolution parameter of the convolutional layer.

슬라이스 획득 유닛은 컨벌루션 커널의 입력 채널의 수에 따라 입력 채널의 커널 슬라이스의 수량을 결정하도록 구성될 수 있다. 슬라이스 획득 유닛은 입력 채널의 결정된 커널 슬라이스의 수에 따라 컨벌루션 매개 변수에 기초하여 컨벌루션을 나타내는 텐서(tensor)에서 입력 채널의 커널 슬라이스를 추출하도록 구성될 수 있다. The slice obtaining unit may be configured to determine the quantity of kernel slices of the input channel according to the number of input channels of the convolutional kernel. The slice obtaining unit may be configured to extract the kernel slice of the input channel from a tensor representing the convolution based on the convolution parameter according to the determined number of kernel slices of the input channel.

유사 슬라이스 결정 유닛은 입력 채널의 커널 슬라이스에서 입력 채널의 선택된 커널 슬라이스와 유사한 커널 슬라이스를 결정하도록 구성될 수 있다.The similar slice determining unit may be configured to determine, in a kernel slice of the input channel, a kernel slice similar to the selected kernel slice of the input channel.

유사 슬라이스 결정 유닛은 각 입력 채널의 커널 슬라이스의 놈을 계산하고, 놈에 따라 입력 채널의 커널 슬라이스 중에서 선택된 커널 슬라이스와 유사한 커널 슬라이스를 결정하도록 구성될 수 있다.The similar slice determining unit may be configured to calculate a norm of a kernel slice of each input channel, and determine a kernel slice similar to the selected kernel slice from among kernel slices of the input channel according to the norm.

대체 슬라이스 결정 유닛은 입력 채널의 유사한 커널 슬라이스에 기초하여 입력 채널의 선택된 커널 슬라이스와 유사한 커널 슬라이스를 대체하는 대체 슬라이스를 결정하도록 구성될 수 있다.The replacement slice determining unit may be configured to determine, based on the similar kernel slice of the input channel, a replacement slice for replacing a kernel slice similar to the selected kernel slice of the input channel.

대체 슬라이스 결정 유닛은 입력 채널의 유사한 커널 슬라이스의 평균 커널 슬라이스를 계산하고, 평균 커널 슬라이스를 대체 슬라이스로 결정하도록 구성될 수 있다. 대체 슬라이스 결정 유닛은 입력 채널의 유사한 커널 슬라이스 중 하나를 대체 슬라이스로 결정하도록 구성될 수 있다.The replacement slice determining unit may be configured to calculate an average kernel slice of a similar kernel slice of the input channel, and determine the average kernel slice as the replacement slice. The replacement slice determining unit may be configured to determine one of the similar kernel slices of the input channel as the replacement slice.

대체 슬라이스 결정 유닛은 놈의 유사도에 따라 입력 채널의 커널 슬라이스를 분류하고, 분류 결과의 각 클래스를 트래버스하고, 각 입력 채널의 커널 슬라이스 간의 유사도를 계산하고, 유사도에 따라 입력 채널의 유사한 커널 슬라이스를 결정하도록 구성될 수 있다.The replacement slice determining unit classifies the kernel slice of the input channel according to the similarity of the norm, traverses each class of the classification result, calculates the similarity between the kernel slices of each input channel, and selects the similar kernel slice of the input channel according to the similarity. can be configured to determine.

대체 슬라이스 결정 유닛은 각 입력 채널의 커널 슬라이스 간의 차이의 놈을 계산하여 각 입력 채널의 커널 슬라이스 간의 유사도를 획득하고, 유사도가 임계값 범위 내에 있는 입력 채널의 커널 슬라이스를 입력 채널의 유사한 커널 슬라이스로 결정하도록 구성될 수 있다.The replacement slice determining unit calculates the norm of the difference between the kernel slices of each input channel to obtain a similarity between the kernel slices of each input channel, and converts the kernel slice of the input channel whose similarity is within a threshold range to the similar kernel slice of the input channel. can be configured to determine.

유사 슬라이스 클리핑 유닛은 대체 슬라이스로 입력 채널의 클리핑된 커널 슬라이스를 대체하기 위해, 입력 채널의 유사한 커널 슬라이스를 클리핑하도록 구성될 수 있다.The similar slice clipping unit may be configured to clip the similar kernel slice of the input channel to replace the clipped kernel slice of the input channel with the replacement slice.

전자 장치는 인덱스 기록 유닛을 더 포함할 수 있다. 인덱스 기록 유닛은 대체 슬라이스가 대체한 입력 채널의 클리핑된 커널 슬라이스의 인덱스를 기록하도록 구성될 수 있다. 이러한 방식으로, 전자 장치는 각 입력 채널의 클리핑된 커널 슬라이스를 인덱스로 기록할 수 있다.The electronic device may further include an index recording unit. The index recording unit may be configured to record the index of the clipped kernel slice of the input channel replaced by the replacement slice. In this way, the electronic device may record the clipped kernel slice of each input channel as an index.

다른 실시예에 따르면, 전자 장치는 컨벌루션 레이어 트래버스 유닛, 대체 슬라이스 판단 유닛 및 컨벌루션 계산 유닛을 포함할 수 있다.According to another embodiment, the electronic device may include a convolutional layer traverse unit, a replacement slice determining unit, and a convolutional calculation unit.

컨벌루션 레이어 트래버스 유닛은 뉴럴 네트워크의 각 컨벌루션 레이어를 트래버스하도록 구성될 수 있다.The convolutional layer traverse unit may be configured to traverse each convolutional layer of the neural network.

대체 슬라이스 판단 유닛은 컨벌루션 레이어의 각 입력 채널의 커널 슬라이스에 대해, 입력 채널의 커널 슬라이스의 인덱스에 따라 입력 채널의 커널 슬라이스가 대체 슬라이스인지 판단할 수 있다.The replacement slice determining unit may determine, for the kernel slice of each input channel of the convolutional layer, whether the kernel slice of the input channel is the replacement slice according to an index of the kernel slice of the input channel.

입력 채널의 커널 슬라이스가 대체 슬라이스인 경우, 컨벌루션 계산 유닛은 입력 채널의 대체 슬라이스로 대체된 입력 채널의 클리핑된 커널 슬라이스의 인덱스를 획득하고, 대체 슬라이스로 대체된 클리핑된 커널 슬라이스의 인덱스에 기초하여 컨벌루션 연산을 수행하도록 구성될 수 있다.When the kernel slice of the input channel is the replacement slice, the convolution calculation unit obtains the index of the clipped kernel slice of the input channel replaced with the replacement slice of the input channel, and based on the index of the clipped kernel slice replaced with the replacement slice It may be configured to perform a convolution operation.

컨벌루션 계산 유닛은 대체 슬라이스로 대체된 컨벌루션 레이어의 입력 채널의 커널 슬라이스의 인덱스에 대응하는 커널 슬라이스를 결정하고, 결정된 커널 슬라이스에 대해 합계 계산을 수행하고, 합계 계산의 결과와 커널 슬라이스에 대해 컨벌루션 계산을 수행하도록 구성될 수 있다.The convolution calculation unit determines a kernel slice corresponding to an index of a kernel slice of the input channel of the convolutional layer replaced by the replacement slice, performs sum calculation on the determined kernel slice, and performs convolution calculation on the result of the sum calculation and the kernel slice may be configured to perform

입력 채널의 커널 슬라이스가 대체 슬라이스가 아닌 경우, 컨벌루션 계산 유닛은 입력 채널의 원래의 커널 슬라이스의 인덱스에 대응하는 커널 슬라이스를 결정하고, 결정된 커널 슬라이스의 인덱스에 대응하는 커널 슬라이스에 대해 컨벌루션 계산을 수행하도록 구성될 수 있다.If the kernel slice of the input channel is not the replacement slice, the convolution calculation unit determines a kernel slice corresponding to the index of the original kernel slice of the input channel, and performs convolution calculation on the kernel slice corresponding to the index of the determined kernel slice can be configured to

다른 실시예에 따르면, 전자 장치는 수신 유닛, 입력 결정 유닛, 컨벌루션 레이어 트래버스 유닛, 컨벌루션 출력 결정 유닛 및 결과 출력 유닛을 포함할 수 있다.According to another embodiment, the electronic device may include a receiving unit, an input determining unit, a convolutional layer traverse unit, a convolutional output determining unit, and a result output unit.

수신 유닛은 사용자 입력의 이미지 및/또는 음성을 수신하도록 구성될 수 있다.The receiving unit may be configured to receive an image and/or voice of a user input.

입력 결정 유닛은 수신된 이미지 또는 음성을 뉴럴 네트워크의 제1 컨벌루션 레이어의 입력으로 사용하도록 구성될 수 있다.The input determining unit may be configured to use the received image or voice as an input of a first convolutional layer of the neural network.

컨벌루션 레이어 트래버스 유닛은 뉴럴 네트워크의 각 컨벌루션 레이어를 트래버스하도록 구성될 수 있다.The convolutional layer traverse unit may be configured to traverse each convolutional layer of the neural network.

컨벌루션 레이어의 각 입력 채널의 커널 슬라이스에 대해, 컨벌루션 출력 결정 유닛은 입력 채널의 커널 슬라이스의 인덱스에 따라 입력 채널의 커널 슬라이스가 대체 슬라이스인지 여부를 결정하도록 구성될 수 있다. For a kernel slice of each input channel of the convolutional layer, the convolutional output determining unit may be configured to determine whether the kernel slice of the input channel is a replacement slice according to an index of the kernel slice of the input channel.

입력 채널의 커널 슬라이스가 대체 슬라이스인 경우, 컨벌루션 출력 결정 유닛은 대체 슬라이스로 대체된 클리핑된 커널 슬라이스의 인덱스를 획득하고, 인덱스를 기반으로 컨벌루션 연산을 수행하고, 모든 입력 채널의 커널 슬라이스의 컨벌루션 연산의 결과의 누적 값을 컨벌루션 레이어의 컨벌루션 연산의 출력 결과로 출력하도록 구성될 수 있다.When the kernel slices of the input channels are replacement slices, the convolutional output determining unit obtains the indexes of the clipped kernel slices replaced with the replacement slices, performs a convolution operation based on the indexes, and performs convolution operation of the kernel slices of all input channels. It may be configured to output an accumulated value of a result of α as an output result of a convolution operation of the convolution layer.

컨벌루션 출력 결정 유닛은 대체 슬라이스로 대체된 입력 채널의 클리핑된 커널 슬라이스의 인덱스에 대응하는 커널 슬라이스를 결정하고, 결정된 커널 슬라이스로 대체된 클리핑된 커널 슬라이스의 인덱스에 대응하는 커널 슬라이스에 대해 합계 계산을 수행하고, 합계 계산의 결과와 커널 슬라이스에 대해 컨벌루션 연산을 수행하여, 컨벌루션 연산이 클리핑된 뉴럴 네트워크에서 구현되도록 구성될 수 있다.The convolutional output determining unit determines a kernel slice corresponding to the index of the clipped kernel slice of the input channel replaced with the replacement slice, and performs sum calculation for the kernel slice corresponding to the index of the clipped kernel slice replaced with the determined kernel slice. and perform a convolution operation on the result of the sum calculation and the kernel slice, so that the convolution operation is implemented in a clipped neural network.

입력 채널의 커널 슬라이스가 대체 슬라이스가 아닌 경우, 컨벌루션 출력 결정 유닛은 입력 채널의 원래의 커널 슬라이스의 인덱스에 대응하는 커널 슬라이스를 결정하고, 결정된 커널 슬라이스의 인덱스에 대응하는 커널 슬라이스 및 입력 채널의 커널 슬라이스에 대해 컨벌루션 계산을 수행하도록 구성될 수 있다.If the kernel slice of the input channel is not the replacement slice, the convolutional output determining unit determines a kernel slice corresponding to the index of the original kernel slice of the input channel, the kernel slice corresponding to the index of the determined kernel slice and the kernel of the input channel It may be configured to perform convolutional computations on slices.

결과 출력 유닛은 뉴럴 네트워크의 마지막 컨벌루션 레이어의 출력을 이미지 인식 결과 또는 음성 인식 결과로 취하도록 구성될 수 있다.The result output unit may be configured to take the output of the last convolutional layer of the neural network as an image recognition result or a speech recognition result.

이상에서 설명된 실시예들은 하드웨어 구성요소, 소프트웨어 구성요소, 및/또는 하드웨어 구성요소 및 소프트웨어 구성요소의 조합으로 구현될 수 있다. 예를 들어, 실시예들에서 설명된 장치, 방법 및 구성요소는, 예를 들어, 프로세서, 콘트롤러, ALU(arithmetic logic unit), 디지털 신호 프로세서(digital signal processor), 마이크로컴퓨터, FPGA(field programmable gate array), PLU(programmable logic unit), 마이크로프로세서, 또는 명령(instruction)을 실행하고 응답할 수 있는 다른 어떠한 장치와 같이, 범용 컴퓨터 또는 특수 목적 컴퓨터를 이용하여 구현될 수 있다. 처리 장치는 운영 체제(OS) 및 상기 운영 체제 상에서 수행되는 소프트웨어 애플리케이션을 수행할 수 있다. 또한, 처리 장치는 소프트웨어의 실행에 응답하여, 데이터를 접근, 저장, 조작, 처리 및 생성할 수도 있다. 이해의 편의를 위하여, 처리 장치는 하나가 사용되는 것으로 설명된 경우도 있지만, 해당 기술분야에서 통상의 지식을 가진 자는, 처리 장치가 복수 개의 처리 요소(processing element) 및/또는 복수 유형의 처리 요소를 포함할 수 있음을 알 수 있다. 예를 들어, 처리 장치는 복수 개의 프로세서 또는 하나의 프로세서 및 하나의 컨트롤러를 포함할 수 있다. 또한, 병렬 프로세서(parallel processor)와 같은, 다른 처리 구성(processing configuration)도 가능하다.The embodiments described above may be implemented by a hardware component, a software component, and/or a combination of a hardware component and a software component. For example, the apparatus, methods and components described in the embodiments may include, for example, a processor, a controller, an arithmetic logic unit (ALU), a digital signal processor, a microcomputer, a field programmable gate (FPGA) array), a programmable logic unit (PLU), a microprocessor, or any other device capable of executing and responding to instructions, may be implemented using a general purpose computer or special purpose computer. The processing device may execute an operating system (OS) and a software application running on the operating system. The processing device may also access, store, manipulate, process, and generate data in response to execution of the software. For convenience of understanding, although one processing device is sometimes described as being used, one of ordinary skill in the art will recognize that the processing device includes a plurality of processing elements and/or a plurality of types of processing elements. It can be seen that can include For example, the processing device may include a plurality of processors or one processor and one controller. Other processing configurations are also possible, such as parallel processors.

소프트웨어는 컴퓨터 프로그램(computer program), 코드(code), 명령(instruction), 또는 이들 중 하나 이상의 조합을 포함할 수 있으며, 원하는 대로 동작하도록 처리 장치를 구성하거나 독립적으로 또는 결합적으로(collectively) 처리 장치를 명령할 수 있다. 소프트웨어 및/또는 데이터는, 처리 장치에 의하여 해석되거나 처리 장치에 명령 또는 데이터를 제공하기 위하여, 어떤 유형의 기계, 구성요소(component), 물리적 장치, 가상 장치(virtual equipment), 컴퓨터 저장 매체 또는 장치, 또는 전송되는 신호 파(signal wave)에 영구적으로, 또는 일시적으로 구체화(embody)될 수 있다. 소프트웨어는 네트워크로 연결된 컴퓨터 시스템 상에 분산되어서, 분산된 방법으로 저장되거나 실행될 수도 있다. 소프트웨어 및 데이터는 컴퓨터 판독 가능 기록 매체에 저장될 수 있다.The software may comprise a computer program, code, instructions, or a combination of one or more thereof, which configures a processing device to operate as desired or is independently or collectively processed You can command the device. The software and/or data may be any kind of machine, component, physical device, virtual equipment, computer storage medium or device, to be interpreted by or to provide instructions or data to the processing device. , or may be permanently or temporarily embody in a transmitted signal wave. The software may be distributed over networked computer systems, and stored or executed in a distributed manner. Software and data may be stored in a computer-readable recording medium.

실시예에 따른 방법은 다양한 컴퓨터 수단을 통하여 수행될 수 있는 프로그램 명령 형태로 구현되어 컴퓨터 판독 가능 매체에 기록될 수 있다. 컴퓨터 판독 가능 매체는 프로그램 명령, 데이터 파일, 데이터 구조 등을 단독으로 또는 조합하여 저장할 수 있으며 매체에 기록되는 프로그램 명령은 실시예를 위하여 특별히 설계되고 구성된 것들이거나 컴퓨터 소프트웨어 당업자에게 공지되어 사용 가능한 것일 수도 있다. 컴퓨터 판독 가능 기록 매체의 예에는 하드 디스크, 플로피 디스크 및 자기 테이프와 같은 자기 매체(magnetic media), CD-ROM, DVD와 같은 광기록 매체(optical media), 플롭티컬 디스크(floptical disk)와 같은 자기-광 매체(magneto-optical media), 및 롬(ROM), 램(RAM), 플래시 메모리 등과 같은 프로그램 명령을 저장하고 수행하도록 특별히 구성된 하드웨어 장치가 포함된다. 프로그램 명령의 예에는 컴파일러에 의해 만들어지는 것과 같은 기계어 코드뿐만 아니라 인터프리터 등을 사용해서 컴퓨터에 의해서 실행될 수 있는 고급 언어 코드를 포함한다. The method according to the embodiment may be implemented in the form of program instructions that can be executed through various computer means and recorded in a computer-readable medium. The computer readable medium may store program instructions, data files, data structures, etc. alone or in combination, and the program instructions recorded on the medium may be specially designed and configured for the embodiment, or may be known and available to those skilled in the art of computer software. have. Examples of the computer readable recording medium include magnetic media such as hard disks, floppy disks and magnetic tapes, optical media such as CD-ROMs and DVDs, and magnetic media such as floppy disks. - includes magneto-optical media, and hardware devices specially configured to store and execute program instructions, such as ROM, RAM, flash memory, and the like. Examples of program instructions include not only machine language codes such as those generated by a compiler, but also high-level language codes that can be executed by a computer using an interpreter or the like.

위에서 설명한 하드웨어 장치는 실시예의 동작을 수행하기 위해 하나 또는 복수의 소프트웨어 모듈로서 작동하도록 구성될 수 있으며, 그 역도 마찬가지이다.The hardware devices described above may be configured to operate as one or a plurality of software modules to perform the operations of the embodiments, and vice versa.

이상과 같이 실시예들이 비록 한정된 도면에 의해 설명되었으나, 해당 기술분야에서 통상의 지식을 가진 자라면 이를 기초로 다양한 기술적 수정 및 변형을 적용할 수 있다. 예를 들어, 설명된 기술들이 설명된 방법과 다른 순서로 수행되거나, 및/또는 설명된 시스템, 구조, 장치, 회로 등의 구성요소들이 설명된 방법과 다른 형태로 결합 또는 조합되거나, 다른 구성요소 또는 균등물에 의하여 대치되거나 치환되더라도 적절한 결과가 달성될 수 있다.As described above, although the embodiments have been described with reference to the limited drawings, a person skilled in the art may apply various technical modifications and variations based thereon. For example, the described techniques are performed in a different order than the described method, and/or the described components of the system, structure, apparatus, circuit, etc. are combined or combined in a different form than the described method, or other components Or substituted or substituted by equivalents may achieve an appropriate result.

그러므로, 다른 구현들, 다른 실시예들 및 특허청구범위와 균등한 것들도 후술하는 특허청구범위의 범위에 속한다.Therefore, other implementations, other embodiments, and equivalents to the claims are also within the scope of the following claims.

Claims (10)

뉴럴 네트워크에 포함된 컨벌루션 레이어의 컨벌루션 매개 변수에 기초하여 상기 컨벌루션 레이어의 입력 채널의 커널 슬라이스(kernel slice)를 선택하는 동작;
상기 선택된 커널 슬라이스와 유사한 하나 이상의 커널 슬라이스를 결정하는 동작;
하나 이상의 상기 유사한 커널 슬라이스를 기초로 상기 선택된 커널 슬라이스를 대체하는 대체 슬라이스를 결정하는 동작; 및
상기 선택된 커널 슬라이스를 클리핑하고 상기 대체 슬라이스로 상기 클리핑된 커널 슬라이스를 대체하는 동작을 포함하고,
상기 컨벌루션 매개 변수는 상기 컨벌루션 레이어의 상기 입력 채널의 수, 출력 채널의 수, 컨벌루션 커널의 필터의 폭, 컨벌루션 커널의 필터의 높이를 포함하는,
뉴럴 네트워크의 클리핑 방법.
selecting a kernel slice of an input channel of the convolutional layer based on a convolution parameter of the convolutional layer included in the neural network;
determining one or more kernel slices similar to the selected kernel slice;
determining a replacement slice to replace the selected kernel slice based on one or more of the similar kernel slices; and
clipping the selected kernel slice and replacing the clipped kernel slice with the replacement slice;
The convolution parameters include the number of input channels of the convolutional layer, the number of output channels, the width of the filter of the convolutional kernel, the height of the filter of the convolutional kernel,
Neural network clipping method.
제1항에 있어서,
상기 클리핑된 커널 슬라이스의 인덱스를 저장하는 동작을 더 포함하는,
뉴럴 네트워크의 클리핑 방법.
According to claim 1,
Further comprising the operation of storing the index of the clipped kernel slice,
Neural network clipping method.
제1항에 있어서,
상기 유사한 하나 이상의 커널 슬라이스를 결정하는 동작은,
상기 컨벌루션 레이어의 각 입력 채널의 커널 슬라이스의 놈(norm)을 계산하는 동작; 및
상기 각 입력 채널의 커널 슬라이스의 놈을 기초로 상기 선택된 커널 슬라이스와 유사한 하나 이상의 커널 슬라이스를 결정하는 동작을 포함하는,
뉴럴 네트워크의 클리핑 방법.
According to claim 1,
The operation of determining the similar one or more kernel slices comprises:
calculating a norm of a kernel slice of each input channel of the convolutional layer; and
determining one or more kernel slices similar to the selected kernel slice based on the norm of the kernel slice of each input channel;
Neural network clipping method.
제3항에 있어서,
상기 놈을 기초로 상기 선택된 커널 슬라이스와 유사한 하나 이상의 커널 슬라이스를 결정하는 동작은,
상기 각 입력 채널의 커널 슬라이스의 놈을 기초로 상기 각 입력 채널의 커널 슬라이스를 하나 이상의 클래스로 분류하는 단계; 및
상기 선택된 커널 슬라이스가 속한 클래스로 분류된 하나 이상의 커널 슬라이스 간의 유사도를 기초로 상기 선택된 커널 슬라이스와 유사한 하나 이상의 커널 슬라이스를 결정하는 동작을 포함하는,
뉴럴 네트워크의 클리핑 방법.
4. The method of claim 3,
The operation of determining one or more kernel slices similar to the selected kernel slice based on the norm comprises:
classifying the kernel slice of each input channel into one or more classes based on the norm of the kernel slice of each input channel; and
determining one or more kernel slices similar to the selected kernel slice based on a similarity between one or more kernel slices classified into a class to which the selected kernel slice belongs,
Neural network clipping method.
제4항에 있어서,
상기 유사도를 기초로 상기 선택된 커널 슬라이스와 유사한 하나 이상의 커널 슬라이스를 결정하는 동작은,
상기 선택된 커널 슬라이스가 속한 클래스로 분류된 각각의 커널 슬라이스와 상기 선택된 커널 슬라이스 간의 차이의 놈을 계산함으로써 유사도를 결정하는 동작; 및
상기 유사도가 임계값 이하인 커널 슬라이스를 상기 선택된 커널 슬라이스와 유사한 커널 슬라이스로 결정하는 동작을 포함하는,
뉴럴 네트워크의 클리핑 방법.
5. The method of claim 4,
The operation of determining one or more kernel slices similar to the selected kernel slice based on the similarity includes:
determining similarity by calculating a norm of a difference between each kernel slice classified into a class to which the selected kernel slice belongs and the selected kernel slice; and
and determining a kernel slice having the similarity equal to or less than a threshold value as a kernel slice similar to the selected kernel slice.
Neural network clipping method.
제1항에 있어서,
상기 대체 슬라이스를 결정하는 동작은,
상기 선택된 커널 슬라이스 및 상기 하나 이상의 유사한 커널 슬라이스를 평균하여 평균 커널 슬라이스를 계산하는 동작; 및
상기 선택된 커널 슬라이스 및 상기 하나 이상의 유사한 커널 슬라이스 중 적어도 하나의 커널 슬라이스를 상기 평균 커널 슬라이스로 대체하는 동작을 포함하는,
뉴럴 네트워크의 클리핑 방법.
According to claim 1,
The operation of determining the replacement slice comprises:
calculating an average kernel slice by averaging the selected kernel slice and the one or more similar kernel slices; and
replacing at least one of the selected kernel slice and the one or more similar kernel slices with the average kernel slice;
Neural network clipping method.
제1항에 있어서,
상기 커널 슬라이스를 선택하는 동작은,
상기 입력 채널의 수를 기초로 상기 커널 슬라이스의 수를 결정하는 동작; 및
상기 결정된 커널 슬라이스의 수 및 상기 컨벌루션 매개 변수를 기초로 상기 컨벌루션 레이어의 컨벌루션 커널을 나타내는 텐서(tensor)로부터 상기 입력 채널의 커널 슬라이스를 추출하는 동작을 포함하는,
뉴럴 네트워크의 클리핑 방법.
According to claim 1,
The operation of selecting the kernel slice comprises:
determining the number of kernel slices based on the number of input channels; and
extracting the kernel slice of the input channel from a tensor representing the convolutional kernel of the convolutional layer based on the determined number of kernel slices and the convolution parameter,
Neural network clipping method.
뉴럴 네트워크에 포함된 컨벌루션 레이어의 인덱스 정보를 기초로 상기 각 입력 채널의 커널 슬라이스가 대체 슬라이스인지 판단하는 동작;
상기 커널 슬라이스가 대체 슬라이스인 경우 상기 인덱스 정보 중에서 상기 대체 슬라이스의 인덱스를 획득하는 동작; 및
상기 대체 슬라이스의 인덱스를 기초로 컨벌루션을 계산하는 동작을 포함하고,
상기 컨벌루션 레이어의 컨벌루션 매개 변수에 기초하여 선택된 커널 슬라이스와 유사한 커널 슬라이스는 클리핑되고 상기 대체 슬라이스로 대체된,
뉴럴 네트워크의 컨벌루션 계산 방법.
determining whether a kernel slice of each input channel is a replacement slice based on index information of a convolutional layer included in a neural network;
obtaining an index of the replacement slice from among the index information when the kernel slice is a replacement slice; and
calculating a convolution based on the index of the replacement slice,
A kernel slice similar to a kernel slice selected based on a convolution parameter of the convolutional layer is clipped and replaced with the replacement slice,
A method for computing convolutions in neural networks.
제1항 내지 제8항 중 어느 한 항의 방법을 실행하는 컴퓨터 프로그램을 저장하는 컴퓨터 판독가능 기록매체.A computer-readable recording medium storing a computer program for executing the method of any one of claims 1 to 8. 적어도 하나의 프로세서를 포함하고,
상기 프로세서는,
뉴럴 네트워크에 포함된 컨벌루션 레이어의 컨벌루션 매개 변수에 기초하여 상기 컨벌루션 레이어의 입력 채널의 커널 슬라이스(kernel slice)를 선택하는 동작;
상기 선택된 커널 슬라이스와 유사한 하나 이상의 커널 슬라이스를 결정하는 동작;
하나 이상의 상기 유사한 커널 슬라이스를 기초로 상기 선택된 커널 슬라이스를 대체하는 대체 슬라이스를 결정하는 동작; 및
상기 선택된 커널 슬라이스를 클리핑하고 상기 대체 슬라이스로 상기 클리핑된 커널 슬라이스를 대체하는 동작을 수행하고,
상기 컨벌루션 매개 변수는 상기 컨벌루션 레이어의 상기 입력 채널의 수, 출력 채널의 수, 컨벌루션 커널의 필터의 폭, 컨벌루션 커널의 필터의 높이를 포함하는,
전자 장치.

at least one processor;
The processor is
selecting a kernel slice of an input channel of the convolutional layer based on a convolution parameter of the convolutional layer included in the neural network;
determining one or more kernel slices similar to the selected kernel slice;
determining a replacement slice to replace the selected kernel slice based on one or more of the similar kernel slices; and
clip the selected kernel slice and replace the clipped kernel slice with the replacement slice;
The convolution parameters include the number of input channels of the convolutional layer, the number of output channels, the width of the filter of the convolutional kernel, the height of the filter of the convolutional kernel,
electronic device.

KR1020210020655A 2020-03-03 2021-02-16 Method for clipping neural networks, method for calculating convolution of neural networks and apparatus for performing the methods KR20210111677A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US17/190,642 US20210279586A1 (en) 2020-03-03 2021-03-03 Method and apparatus for clipping neural networks and performing convolution

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010140843.7 2020-03-03
CN202010140843.7A CN111414993B (en) 2020-03-03 2020-03-03 Convolutional neural network clipping and convolutional calculation method and device

Publications (1)

Publication Number Publication Date
KR20210111677A true KR20210111677A (en) 2021-09-13

Family

ID=71492777

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020210020655A KR20210111677A (en) 2020-03-03 2021-02-16 Method for clipping neural networks, method for calculating convolution of neural networks and apparatus for performing the methods

Country Status (2)

Country Link
KR (1) KR20210111677A (en)
CN (1) CN111414993B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113487012B (en) * 2021-06-24 2023-08-04 北京航空航天大学 FPGA-oriented deep convolutional neural network accelerator and design method

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018058426A1 (en) * 2016-09-29 2018-04-05 清华大学 Hardware neural network conversion method, computing device, compiling method and neural network software and hardware collaboration system
US10990648B2 (en) * 2017-08-07 2021-04-27 Intel Corporation System and method for an optimized winograd convolution accelerator
CN108510066B (en) * 2018-04-08 2020-05-12 湃方科技(天津)有限责任公司 Processor applied to convolutional neural network
CN109583564A (en) * 2018-10-31 2019-04-05 东华大学 Extremely similar animal origin automatic identifying method based on VGG convolutional neural networks
CN109598340A (en) * 2018-11-15 2019-04-09 北京知道创宇信息技术有限公司 Method of cutting out, device and the storage medium of convolutional neural networks
CN109359726A (en) * 2018-11-27 2019-02-19 华中科技大学 A kind of convolutional neural networks optimization method based on winograd algorithm
CN110084281B (en) * 2019-03-31 2023-09-12 华为技术有限公司 Image generation method, neural network compression method, related device and equipment
CN110348562B (en) * 2019-06-19 2021-10-15 北京迈格威科技有限公司 Neural network quantization strategy determination method, image identification method and device
CN110781948A (en) * 2019-10-22 2020-02-11 北京市商汤科技开发有限公司 Image processing method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN111414993A (en) 2020-07-14
CN111414993B (en) 2024-03-01

Similar Documents

Publication Publication Date Title
EP3340129B1 (en) Artificial neural network class-based pruning
US10740865B2 (en) Image processing apparatus and method using multi-channel feature map
Micikevicius et al. Mixed precision training
CN105960647B (en) Compact face representation
US11144823B1 (en) Method and system for hierarchical weight-sparse convolution processing
KR20180050928A (en) Convolutional neural network processing method and apparatus
US9563822B2 (en) Learning apparatus, density measuring apparatus, learning method, computer program product, and density measuring system
CN109086866B (en) Partial binary convolution method suitable for embedded equipment
CN110008853B (en) Pedestrian detection network and model training method, detection method, medium and equipment
KR20210093931A (en) Automated creation of machine learning models
US11113601B1 (en) Method and system for balanced-weight sparse convolution processing
CN113627389A (en) Target detection optimization method and device
WO2022152104A1 (en) Action recognition model training method and device, and action recognition method and device
KR20220045424A (en) Method and apparatus of compressing artificial neural network
US20230130638A1 (en) Computer-readable recording medium having stored therein machine learning program, method for machine learning, and information processing apparatus
US11410016B2 (en) Selective performance of deterministic computations for neural networks
CN114444668A (en) Network quantization method, network quantization system, network quantization apparatus, network quantization medium, and image processing method
KR20210111677A (en) Method for clipping neural networks, method for calculating convolution of neural networks and apparatus for performing the methods
CN112926697B (en) Abrasive particle image classification method and device based on semantic segmentation
CN116702835A (en) Neural network reasoning acceleration method, target detection method, device and storage medium
KR102127855B1 (en) Feature selection method with maximum repeatability
KR101953479B1 (en) Group search optimization data clustering method and system using the relative ratio of distance
KR102600086B1 (en) A Resource Efficient Integer-Arithmetic-Only FPGA-Based CNN Accelerator for Real-Time Facial Emotion Recognition
WO2022198606A1 (en) Deep learning model acquisition method, system and apparatus, and storage medium
CN115994572A (en) Model searching method and device and computer storage medium

Legal Events

Date Code Title Description
A201 Request for examination