KR20230059718A - Method and electronic device for performing deep neural network operations - Google Patents

Method and electronic device for performing deep neural network operations Download PDF

Info

Publication number
KR20230059718A
KR20230059718A KR1020220115794A KR20220115794A KR20230059718A KR 20230059718 A KR20230059718 A KR 20230059718A KR 1020220115794 A KR1020220115794 A KR 1020220115794A KR 20220115794 A KR20220115794 A KR 20220115794A KR 20230059718 A KR20230059718 A KR 20230059718A
Authority
KR
South Korea
Prior art keywords
layer
neural network
channel
feature map
electronic device
Prior art date
Application number
KR1020220115794A
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 KR1020220129039A priority Critical patent/KR20230059726A/en
Priority to PCT/KR2022/016375 priority patent/WO2023075372A1/en
Priority to US18/078,199 priority patent/US20230129845A1/en
Publication of KR20230059718A publication Critical patent/KR20230059718A/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/06Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons
    • G06N3/063Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons using electronic means
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/15Correlation function computation including computation of convolution operations
    • G06F17/153Multidimensional correlation or convolution
    • 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/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Mathematical Physics (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Evolutionary Computation (AREA)
  • Health & Medical Sciences (AREA)
  • Biophysics (AREA)
  • Biomedical Technology (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • Molecular Biology (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Computational Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Algebra (AREA)
  • Neurology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Medical Informatics (AREA)
  • Image Analysis (AREA)

Abstract

Provided is a method for performing neural network operations by an electronic device, the method comprising: a step of performing a first deformed operation extending the output channel of a first layer with respect to a feature map inputted into the first layer among layers of a deep neural network, wherein the first deformed operation includes a space-to-depth transformation operation; a step of performing a neural network operation corresponding to layers between the first layer and a second layer as a channel-extended neural network operation, wherein the second layer is a layer which is after the first layer in the deep neural network; and a step of performing a second deformed operation reducing the output channel of the second layer with respect to the channel-extended feature map inputted into the second layer, wherein the second deformed operation comprises a depth-to-space transformation operation; and a step of outputting the result of the operation of the deep neural network.

Description

심층 신경망 연산을 수행하는 방법 및 전자 장치{METHOD AND ELECTRONIC DEVICE FOR PERFORMING DEEP NEURAL NETWORK OPERATIONS}METHOD AND ELECTRONIC DEVICE FOR PERFORMING DEEP NEURAL NETWORK OPERATIONS}

신경망 연산의 효율을 증가시키는 알고리즘을 적용하는, 전자 장치 및 그 동작 방법이 제공된다.Provided is an electronic device and an operating method thereof applying an algorithm that increases the efficiency of neural network operation.

심층 신경망의 연산은, 연산을 수행하는 하드웨어 및 심층 신경망 모델의 아키텍처에 따라 좌우된다. 심층 신경망 연산의 효율을 증가시키기 위한 하드웨어의 성능은 시대에 따라 개선되고 있으며, 연산을 수행하기 위한 다양한 심층 신경망 모델 및 알고리즘 또한 개발되고 있다. 한편, 동일한 심층 신경망 모델을 사용하더라도, 심층 신경망 연산을 수행하는 하드웨어가 상이하면, 연산을 수행하는 하드웨어의 성능에 따라 연산의 속도, 하드웨어의 이용 효율 등이 상이할 수 있다. 심층 신경망 모델을 이용한 심층 신경망 연산에 있어서, 하드웨어의 사양에 따라 최적화된 연산을 수행하기 위한 다양한 알고리즘들이 최근 사용되고 있다.The operation of a deep neural network depends on the hardware performing the operation and the architecture of the deep neural network model. The performance of hardware to increase the efficiency of deep neural network calculations is improving over time, and various deep neural network models and algorithms for performing calculations are also being developed. Meanwhile, even if the same deep neural network model is used, if the hardware performing the deep neural network operation is different, the speed of operation, the utilization efficiency of the hardware, and the like may be different depending on the performance of the hardware performing the operation. In a deep neural network operation using a deep neural network model, various algorithms for performing an operation optimized according to hardware specifications have recently been used.

본 개시의 일 측면에 따르면, 전자 장치가 심층 신경망(Deep Neural Network; DNN) 연산을 수행하는 방법이 제공될 수 있다. 상기 방법은, 상기 심층 신경망의 레이어들 중 제1 레이어로 입력되는 피쳐맵에 대하여 상기 제1 레이어의 출력의 채널을 확장(extend)하는 제1 변형된 연산을 수행하는 단계를 포함할 수 있다. 상기 제1 변형된 연산은, 공간-깊이 변형(space-to-depth transformation) 연산을 포함할 수 있다. 상기 방법은, 상기 제1 레이어 및 제2 레이어 사이의 레이어들에 대응하는 신경망 연산을 채널-확장된 신경망 연산으로 수행하는 단계를 포함할 수 있다. 상기 제2 레이어는, 상기 심층 신경망 내에서 상기 제1 레이어보다 이후의 레이어인 것일 수 있다. 상기 방법은, 상기 제2 레이어로 입력되는 채널-확장된 피쳐맵에 대하여 상기 제2 레이어의 출력의 채널을 축소하는 제2 변형된 연산을 수행할 수 있다. 상기 제2 변형된 연산은, 깊이-공간 변형(depth-to-space transformation) 연산을 포함할 수 있다. 상기 방법은, 상기 심층 신경망의 연산의 결과를 출력하는 단계를 포함할 수 있다.According to one aspect of the present disclosure, a method for performing a deep neural network (DNN) operation by an electronic device may be provided. The method may include performing a first modified operation of extending a channel of an output of the first layer with respect to a feature map input to a first layer among layers of the deep neural network. The first transformed operation may include a space-to-depth transformation operation. The method may include performing a neural network operation corresponding to layers between the first layer and the second layer as a channel-extended neural network operation. The second layer may be a layer subsequent to the first layer in the deep neural network. The method may perform a second modified operation of reducing a channel of an output of the second layer with respect to a channel-extended feature map input to the second layer. The second transformed operation may include a depth-to-space transformation operation. The method may include outputting an operation result of the deep neural network.

본 개시의 일 측면에 따르면, 심층 신경망 연산을 수행하는 전자 장치가 제공될 수 있다. 상기 전자 장치는, 가속기, 하나 이상의 인스트럭션을 저장하도록 구성된 메모리, 및 상기 메모리에 저장된 상기 하나 이상의 인스트럭션을 실행하는 적어도 하나의 프로세서를 포함할 수 있다. 상기 적어도 하나의 프로세서는, 상기 하나 이상의 인스트럭션을 실행함으로써, 상기 심층 신경망의 레이어들 중 제1 레이어로 입력되는 피쳐맵에 대하여 상기 제1 레이어의 출력의 채널을 확장(extend)하는 제1 변형된 연산을 수행할 수 있다. 상기 제1 변형된 연산은, 공간-깊이 변형(space-to-depth transformation) 연산을 포함할 수 있다.According to one aspect of the present disclosure, an electronic device performing a deep neural network operation may be provided. The electronic device may include an accelerator, a memory configured to store one or more instructions, and at least one processor executing the one or more instructions stored in the memory. The at least one processor, by executing the one or more instructions, extends a channel of an output of the first layer with respect to a feature map input to a first layer among the layers of the deep neural network. calculations can be performed. The first transformed operation may include a space-to-depth transformation operation.

상기 적어도 하나의 프로세서는, 상기 하나 이상의 인스트럭션을 실행함으로써, 상기 가속기를 이용하여, 상기 제1 레이어 및 제2 레이어 사이의 레이어들에 대응하는 신경망 연산을 채널-확장된 신경망 연산으로 수행할 수 있다. 상기 제2 레이어는, 상기 심층 신경망 내에서 상기 제1 레이어보다 이후의 레이어인 것일 수 있다. 상기 적어도 하나의 프로세서는, 상기 하나 이상의 인스트럭션을 실행함으로써, 상기 제2 레이어로 입력되는 채널-확장된 피쳐맵에 대하여 상기 제2 레이어의 출력의 채널을 축소하는 제2 변형된 연산을 수행할 수 있다. 상기 제2 변형된 연산은, 깊이-공간 변형(depth-to-space transformation) 연산을 포함할 수 있다. 상기 적어도 하나의 프로세서는, 상기 하나 이상의 인스트럭션을 실행함으로써, 상기 심층 신경망의 연산의 결과를 출력할 수 있다.The at least one processor may perform a neural network operation corresponding to layers between the first layer and the second layer as a channel-extended neural network operation using the accelerator by executing the one or more instructions. . The second layer may be a layer subsequent to the first layer in the deep neural network. The at least one processor may perform a second transformed operation of reducing a channel of an output of the second layer with respect to a channel-extended feature map input to the second layer by executing the one or more instructions. there is. The second transformed operation may include a depth-to-space transformation operation. The at least one processor may output an operation result of the deep neural network by executing the one or more instructions.

본 개시의 일 측면에 따르면, 전자 장치가 심층 신경망 연산을 수행하는, 전술 및 후술하는 방법들 중 어느 하나를 실행시키기 위한 프로그램이 기록된 컴퓨터 판독 가능 기록매체를 제공할 수 있다.According to one aspect of the present disclosure, a computer-readable recording medium having a program recorded thereon for executing any one of the methods described above and below, in which an electronic device performs a deep neural network operation, may be provided.

도 1은 본 개시의 일 실시예에 따른 전자 장치가 심층 신경망 연산을 수행하는 특징을 개략적으로 설명하기 위한 도면이다.
도 2는 본 개시의 일 실시예에 따른 전자 장치가 심층 신경망 연산을 수행하는 방법을 설명하기 위한 흐름도이다.
도 3a는 본 개시의 일 실시예에 따른 전자 장치의 하드웨어 가속기를 이용한 신경망 연산 동작을 설명하기 위한 도면이다.
도 3b는 본 개시의 일 실시예에 따른 전자 장치의 하드웨어 가속기를 이용한 신경망 연산 동작을 더 설명하기 위한 도면이다.
도 4는 본 개시의 일 실시예에 따른 전자 장치가 신경망 연산을 수행하는 알고리즘을 개략적으로 도시한 도면이다.
도 5는 본 개시의 일 실시예에 따른 전자 장치가 수행하는 신경망 연산의 전반적인 아키텍처를 설명하기 위한 도면이다.
도 6은 본 개시의 일 실시예에 따른 신경망 연산의 제1 변형 및 제2 변형을 설명하기 위한 도면이다.
도 7은 본 개시의 일 실시예에 따른 전자 장치가 수행하는 심층 신경망 연산의 일 예를 설명하기 위한 도면이다.
도 8a는 내지 도 8c는 본 개시의 일 실시예에 따른 전자 장치가 수행하는 심층 신경망 연산이 컨볼루션 연산인 예시를 설명하기 위한 도면으로, 도 8a는 원본 컨볼루션 연산을 설명하기 위한 도면이다.
도 8b는 원본 컨볼루션 연산을 더 설명하기 위한 도면이다.
도 8c는 본 개시의 일 실시예에 따른 전자 장치가 컨볼루션 연산 수행을 위해 피쳐맵의 채널을 확장하는 것을 설명하기 위한 도면이다.
도 9a는 본 개시의 일 실시예에 따른 전자 장치가 수행하는, 채널-확장된 피쳐맵을 출력하는 변형된 연산을 설명하기 위한 도면이다.
도 9b는 도 9a를 구체적인 예시를 통해 설명하기 위한 도면이다.
도 9c는 본 개시의 일 실시예에 따른 전자 장치가 수행하는, 채널-확장된 피쳐맵을 입력으로 받는 변형된 연산을 설명하기 위한 도면이다.
도 9d는 도 9c를 구체적인 예시를 통해 설명하기 위한 도면이다.
도 10은 본 개시의 일 실시예에 따른 전자 장치의 구성을 도시한 블록도이다.
1 is a diagram for schematically explaining characteristics of an electronic device performing a deep neural network operation according to an embodiment of the present disclosure.
2 is a flowchart illustrating a method of performing a deep neural network operation by an electronic device according to an embodiment of the present disclosure.
3A is a diagram for explaining a neural network calculation operation using a hardware accelerator of an electronic device according to an embodiment of the present disclosure.
3B is a diagram for further explaining a neural network calculation operation using a hardware accelerator of an electronic device according to an embodiment of the present disclosure.
4 is a diagram schematically illustrating an algorithm for performing a neural network operation by an electronic device according to an embodiment of the present disclosure.
5 is a diagram for explaining an overall architecture of a neural network operation performed by an electronic device according to an embodiment of the present disclosure.
6 is a diagram for explaining a first modification and a second modification of a neural network operation according to an embodiment of the present disclosure.
7 is a diagram for explaining an example of a deep neural network operation performed by an electronic device according to an embodiment of the present disclosure.
8A to 8C are diagrams for explaining an example in which a deep neural network operation performed by an electronic device according to an embodiment of the present disclosure is a convolution operation, and FIG. 8A is a diagram for explaining an original convolution operation.
8B is a diagram for further explaining the original convolution operation.
8C is a diagram for explaining that an electronic device according to an embodiment of the present disclosure extends a channel of a feature map to perform a convolution operation.
9A is a diagram for explaining a modified operation of outputting a channel-extended feature map performed by an electronic device according to an embodiment of the present disclosure.
FIG. 9B is a diagram for explaining FIG. 9A through a specific example.
9C is a diagram for explaining a modified operation of receiving a channel-extended feature map as an input, which is performed by an electronic device according to an embodiment of the present disclosure.
FIG. 9D is a diagram for explaining FIG. 9C through a specific example.
10 is a block diagram illustrating the configuration of an electronic device according to an embodiment of the present disclosure.

본 개시에서, "a, b 또는 c 중 적어도 하나" 표현은 " a", " b", " c", "a 및 b", "a 및 c", "b 및 c", "a, b 및 c 모두", 혹은 그 변형들을 지칭할 수 있다.In this disclosure, the expression “at least one of a, b, or c” means “a”, “b”, “c”, “a and b”, “a and c”, “b and c”, “a, b” and c”, or variations thereof.

본 명세서에서 사용되는 용어에 대해 간략히 설명하고, 본 개시에 대해 구체적으로 설명하기로 한다. 본 개시에서 사용되는 용어는 본 개시에서의 기능을 고려하면서 가능한 현재 널리 사용되는 일반적인 용어들을 선택하였으나, 이는 당 분야에 종사하는 기술자의 의도 또는 판례, 새로운 기술의 출현 등에 따라 달라질 수 있다. 또한, 특정한 경우는 출원인이 임의로 선정한 용어도 있으며, 이 경우 해당되는 발명의 설명 부분에서 상세히 그 의미를 기재할 것이다. 따라서 본 개시에서 사용되는 용어는 단순한 용어의 명칭이 아닌, 그 용어가 가지는 의미와 본 개시의 전반에 걸친 내용을 토대로 정의되어야 한다.Terms used in this specification will be briefly described, and the present disclosure will be described in detail. The terms used in the present disclosure have been selected from general terms that are currently widely used as much as possible while considering the functions in the present disclosure, but they may vary according to the intention or precedent of a person skilled in the art, the emergence of new technologies, and the like. In addition, in a specific case, there is also a term arbitrarily selected by the applicant, and in this case, the meaning will be described in detail in the description of the invention. Therefore, terms used in the present disclosure should be defined based on the meaning of the term and the general content of the present disclosure, not simply the name of the term.

단수의 표현은 문맥상 명백하게 다르게 뜻하지 않는 한, 복수의 표현을 포함할 수 있다. 기술적이거나 과학적인 용어를 포함해서 여기서 사용되는 용어들은 본 명세서에 기재된 기술 분야에서 통상의 지식을 가진 자에 의해 일반적으로 이해되는 것과 동일한 의미를 가질 수 있다.Singular expressions may include plural expressions unless the context clearly dictates otherwise. Terms used herein, including technical or scientific terms, may have the same meaning as commonly understood by one of ordinary skill in the art described herein.

명세서 전체에서 어떤 부분이 어떤 구성요소를 "포함"한다고 할 때, 이는 특별히 반대되는 기재가 없는 한 다른 구성요소를 제외하는 것이 아니라 다른 구성요소를 더 포함할 수 있음을 의미한다. 또한, 명세서에 기재된 "부", "모듈" 등의 용어는 적어도 하나의 기능이나 동작을 처리하는 단위를 의미하며, 이는 하드웨어 또는 소프트웨어로 구현되거나 하드웨어와 소프트웨어의 결합으로 구현될 수 있다.When it is said that a certain part "includes" a certain component throughout the specification, it means that it may further include other components without excluding other components unless otherwise stated. In addition, terms such as “unit” and “module” described in the specification refer to a unit that processes at least one function or operation, and may be implemented as hardware or software or a combination of hardware and software.

아래에서는 첨부한 도면을 참고하여 본 개시의 실시예에 대하여 본 개시가 속하는 기술 분야에서 통상의 지식을 가진 자가 용이하게 실시할 수 있도록 상세히 설명한다. 그러나 본 개시는 여러 가지 상이한 형태로 구현될 수 있으며 여기에서 설명하는 실시예에 한정되지 않는다. 그리고 도면에서 본 개시를 명확하게 설명하기 위해서 설명과 관계없는 부분은 생략하였으며, 명세서 전체를 통하여 유사한 부분에 대해서는 유사한 도면 부호를 붙였다.Hereinafter, with reference to the accompanying drawings, embodiments of the present disclosure will be described in detail so that those skilled in the art can easily carry out the present disclosure. However, the present disclosure may be embodied in many different forms and is not limited to the embodiments described herein. And in order to clearly describe the present disclosure in the drawings, parts irrelevant to the description are omitted, and similar reference numerals are attached to similar parts throughout the specification.

도 1은 본 개시의 일 실시예에 따른 전자 장치가 심층 신경망 연산을 수행하는 특징을 개략적으로 설명하기 위한 도면이다.1 is a diagram for schematically explaining characteristics of an electronic device performing a deep neural network operation according to an embodiment of the present disclosure.

도 1을 참조하면, 전자 장치(2000)는 입력 데이터(101)를 입력 받고, 전자 장치에 탑재된 심층 신경망 모델(102)을 이용하여 신경망 연산을 수행하고, 추론 결과 등을 나타내는 출력 데이터(103)를 획득할 수 있다. 일 실시예에 따른 전자 장치(2000)는, 스마트 폰, 스마트 TV, 스마트 가전, 모바일 디바이스, 영상 디스플레이 디바이스, 데스크탑 컴퓨터, 서버 등을 포함할 수 있다. 다만, 이에 한정되는 것은 아니며 심층 신경망 모델의 연산이 가능한, 모든 전자 장치를 포함할 수 있다.Referring to FIG. 1 , an electronic device 2000 receives input data 101, performs a neural network operation using a deep neural network model 102 loaded in the electronic device, and outputs data 103 representing an inference result. ) can be obtained. The electronic device 2000 according to an embodiment may include a smart phone, a smart TV, a smart home appliance, a mobile device, an image display device, a desktop computer, a server, and the like. However, it is not limited thereto and may include any electronic device capable of calculating a deep neural network model.

일 실시예에 따른 전자 장치(2000)는 다양한 타입의 심층 신경망 모델(102)을 이용할 수 있으며, 이에 따라, 입력 데이터(101) 및 출력 데이터(103)도 다양할 수 있다. 예를 들어, 전자 장치(2000)는 심층 신경망 모델(102)을 이용하여, 이미지의 화질 개선, 객체 검출, 객체 분류, 화면 분류 등의 과제를 수행할 수 있다.The electronic device 2000 according to an embodiment may use various types of deep neural network models 102 , and accordingly, input data 101 and output data 103 may also vary. For example, the electronic device 2000 may perform tasks such as image quality improvement, object detection, object classification, and screen classification using the deep neural network model 102 .

일 실시예에서, 전자 장치(2000)가 수행하는 신경망 연산은, 가속기를 이용한 병렬 연산(예를 들어, 곱셈 등)이 포함될 수 있다. 전자 장치(2000)가 신경망 연산을 수행할 때, 가속기 내에서 유의미한 값 계산에 활용되는 곱셈-누산 유닛(Multiply-accumulate unit; MAC unit)은 피쳐맵의 채널에 비례한다. 이에 따라, 피쳐맵의 채널이 곱셈-누산 유닛 보다 작은 경우, 일부의 MAC에서만 유효 연산이 수행되므로 전자 장치(2000)의 가속기의 활용 효율이 낮다. 전자 장치(2000)는 가속기 활용 효율을 높이기 위해, 신경망 연산의 입출력 데이터의 채널을 확장시킨 상태에서 연산을 수행할 수 있다.In an embodiment, the neural network operation performed by the electronic device 2000 may include a parallel operation (eg, multiplication) using an accelerator. When the electronic device 2000 performs a neural network operation, a multiply-accumulate unit (MAC unit) used to calculate a significant value in the accelerator is proportional to the channel of the feature map. Accordingly, when the number of channels of the feature map is smaller than the multiply-accumulate unit, the utilization efficiency of the accelerator of the electronic device 2000 is low because effective operations are performed only in some MACs. The electronic device 2000 may perform an operation in a state in which a channel of input/output data of neural network operation is expanded in order to increase the efficiency of using the accelerator.

일 실시예에서, 전자 장치(2000)는 심층 신경망 모델(102)에서 수행되는 연산을 변형할 수 있다. 예를 들어, 전자 장치(2000)는 심층 신경망 모델(102)의 레이어들 중 제1 레이어(105)로 입력되는 피쳐맵에 대하여, 제1 레이어(105)의 출력의 채널이 확장되도록 하는, 제1 변형된 연산을 수행할 수 있다. 제1 변형된 연산은 공간-깊이 변형 연산을 포함할 수 있으며, 제1 레이어(105)의 원래의 신경망 연산과 동등한 결과를 도출할 수 있는 연산을 포함할 수 있다.In one embodiment, the electronic device 2000 may transform an operation performed in the deep neural network model 102 . For example, the electronic device 2000 expands a channel of an output of the first layer 105 with respect to a feature map input to the first layer 105 among the layers of the deep neural network model 102. 1 Can perform modified arithmetic. The first transformed operation may include a spatial-depth transformation operation, and may include an operation that may lead to an equivalent result to the original neural network operation of the first layer 105 .

전자 장치(2000)는 제1 레이어(105)로부터의 출력의 채널이 확장되면, 이후의 연산들은 채널-확장된 신경망 연산으로 수행할 수 있다. 전자 장치(2000)는 이후의 레이어들에서 수행되는 채널-확장된 신경망 연산을 종료하기 위해, 제2 레이어로 입력되는 채널-확장된 피쳐맵에 대하여 제2 레이어의 출력을 축소하는 제2 변형된 연산을 수행할 수 있다. 제2 변형된 연산은 깊이-공간 변형 연산을 포함할 수 있으며, 제2 레이어의 원래의 신경망 연산과 동등한 결과를 도출할 수 있는 연산을 포함할 수 있다.When the channel of the output from the first layer 105 is extended, the electronic device 2000 may perform subsequent operations through channel-extended neural network operations. In order to terminate channel-extended neural network operations performed in subsequent layers, the electronic device 2000 reduces the output of the second layer with respect to the channel-extended feature map input to the second layer. calculations can be performed. The second transformed operation may include a depth-space transformation operation, and may include an operation that can derive a result equivalent to the original neural network operation of the second layer.

이에 따라, 전자 장치(2000)가 변형된 연산을 적용하여 심층 신경망 모델(102)의 출력 데이터(103)를 획득하는 경우, 원래의 심층 신경망 모델(102)의 연산과 동일한 결과를 획득하면서도, 가속기 연산 효율을 증가시킬 수 있다.Accordingly, when the electronic device 2000 acquires the output data 103 of the deep neural network model 102 by applying the modified operation, while obtaining the same result as the operation of the original deep neural network model 102, the accelerator The computational efficiency can be increased.

도 2는 본 개시의 일 실시예에 따른 전자 장치가 심층 신경망 연산을 수행하는 방법을 설명하기 위한 흐름도이다.2 is a flowchart illustrating a method of performing a deep neural network operation by an electronic device according to an embodiment of the present disclosure.

단계 S210에서, 전자 장치(2000)는 심층 신경망의 레이어들 중 제1 레이어로 입력되는 피쳐맵에 대하여 제1 레이어의 출력의 채널을 확장하는 제1 변형된 연산을 수행한다.In step S210, the electronic device 2000 performs a first transformed operation of extending a channel of an output of the first layer with respect to the feature map input to the first layer among the layers of the deep neural network.

개시된 실시예에서, 심층 신경망은 머신러닝 기법에 활용되는 인공 신경망 알고리즘으로, 다수의 레이어들로 구성된다. 심층 신경망은 입력 레이어와 출력 레이어 사이에 다중의 은닉 레이어들을 포함할 수 있다.In the disclosed embodiment, a deep neural network is an artificial neural network algorithm used in machine learning techniques, and is composed of a plurality of layers. A deep neural network may include multiple hidden layers between an input layer and an output layer.

일 실시예에서, 전자 장치(2000)는 심층 신경망 연산을 수행함에 있어서, 원본 연산과 동일한 연산 결과를 도출할 수 있는, 변형된 연산을 수행할 수 있다. 원본 연산이란, 심층 신경망의 모델의 변형 없이, 심층 신경망 모델의 아키텍처 및 알고리즘에 따라 결정된, 심층 신경망 모델 그대로의 연산을 말한다.In one embodiment, the electronic device 2000 may perform a modified operation that can derive the same operation result as the original operation when performing the deep neural network operation. The original operation refers to the operation of the deep neural network model as it is, determined according to the architecture and algorithm of the deep neural network model, without modification of the deep neural network model.

제1 변형된 연산은 심층 신경망의 레이어들 중 제1 레이어로 입력되는 피쳐맵에 대하여, 제1 레이어에 대응하는 연산을 수행하되, 제1 레이어의 출력의 채널을 확장(extend)하는 공간-깊이 변형(space-to-depth transformation) 연산일 수 있다. 공간-깊이 변형 연산이란, 공간 데이터를 깊이 데이터로 재배열하는 것을 말한다. 예를 들어, 공간-깊이 변형 연산은 가로*세로 포맷의 값을 갖는 공간 데이터에 대하여, 깊이 차원으로 확장되도록 데이터를 재배열함으로써, 가로*세로*깊이 포맷의 데이터가 되도록 변형할 수 있다.The first transformed operation performs an operation corresponding to the first layer on the feature map input to the first layer among the layers of the deep neural network, but extends the channel of the output of the first layer. It may be a space-to-depth transformation operation. Spatial-depth transformation operation refers to rearranging spatial data into depth data. For example, the space-depth transformation operation may transform spatial data having a width*height format into data of a width*height*depth format by rearranging the data so as to extend to a depth dimension.

일 실시예에서, 제1 레이어는 심층 신경망에 포함되는 레이어들 중 첫번째 레이어인 입력 레이어일 수 있다. 또는, 제1 레이어는 심층 신경망에 포함되는 은닉 레이어들 중 첫번째 레이어일 수 있다. 또는, 제1 레이어는 심층 신경망에 포함되는 은닉 레이어들 중 어느 한 레이어일 수 있다.In one embodiment, the first layer may be an input layer that is a first layer among layers included in a deep neural network. Alternatively, the first layer may be a first layer among hidden layers included in the deep neural network. Alternatively, the first layer may be any one of hidden layers included in the deep neural network.

일 실시예에 따른 전자 장치(2000)는 제1 변형된 연산을 수행함으로써, 신경망 연산의 채널을 확장할 수 있다. 이에 따라, 신경망 연산을 수행하는 하드웨어 가속기의 연산기(예를 들어, 곱셉-누산 유닛(Multiply-accumulate unit; MAC unit) 등)의 이용 효율을 높일 수 있다.The electronic device 2000 according to an embodiment may expand a channel of neural network operation by performing the first modified operation. Accordingly, efficiency of use of an operator (eg, a multiply-accumulate unit (MAC unit), etc.) of the hardware accelerator for performing neural network operations may be increased.

단계 S220에서, 전자 장치(2000)는 제1 레이어 및 제2 레이어 사이의 레이어들에 대응하는 신경망 연산을, 채널-확장된 신경망 연산으로 수행한다.In step S220, the electronic device 2000 performs a neural network operation corresponding to layers between the first layer and the second layer as a channel-extended neural network operation.

일 실시예에서, 제2 레이어는, 심층 신경망 내에서 제1 레이어보다 이후의 레이어일 수 있다. 예를 들어, 제2 레이어는 심층 신경망에 포함되는 레이어들 중 마지막 레이어인 출력 레이어일 수 있다. 또는, 제2 레이어는 심층 신경망에 포함되는 은닉 레이어들 중 마지막 레이어일 수 있다.In one embodiment, the second layer may be a layer subsequent to the first layer in the deep neural network. For example, the second layer may be an output layer that is the last layer among layers included in the deep neural network. Alternatively, the second layer may be the last layer among hidden layers included in the deep neural network.

일 실시예에 따른 전자 장치(2000)가 단계 S210에서 제1 변형된 연산을 수행한 결과, 제1 레이어로부터의 출력은 채널-확장된 출력이다. 구체적인 예를 들면, 제1 레이어로부터 채널-확장된 출력 피쳐맵이 출력된다. 이 경우, 제1 레이어로부터의 채널-확장된 출력 피쳐맵이 다음 레이어로 입력된다. 이에 따라, 제1 레이어 및 제2 레이어 사이의 레이어들에서는, 각각의 레이어들에 대응하는 신경망 연산이, 채널-확장된 신경망 연산으로 수행된다. 즉, 신경망 연산이 채널-확장된 상태에서 연쇄적으로 수행된다.As a result of the electronic device 2000 according to an embodiment performing the first modified operation in step S210, an output from the first layer is a channel-extended output. For a specific example, a channel-extended output feature map is output from the first layer. In this case, the channel-extended output feature map from the first layer is input to the next layer. Accordingly, in the layers between the first layer and the second layer, neural network calculations corresponding to the respective layers are performed as channel-extended neural network calculations. That is, neural network operations are serially performed in a channel-extended state.

본 개시에서, 각각의 레이어들에 대응하는 신경망 연산은, 원본 연산 이라고도 지칭될 수 있으며, 채널-확장된 데이터들을 이용하여 수행하는 채널-확장된 신경망 연산은 와이드 연산이라고도 지칭될 수 있다. 다만, 와이드 연산은 설명의 편의를 위해 본 개시에서 선정한 단어일 뿐, 연산의 본질이 그 용어에 한정되는 것은 아니다.In the present disclosure, a neural network operation corresponding to each layer may also be referred to as an original operation, and a channel-extended neural network operation performed using channel-extended data may also be referred to as a wide operation. However, the wide operation is only a word selected in this disclosure for convenience of description, and the nature of the operation is not limited to the term.

일 실시예에 따른 전자 장치(2000)가 제1 레이어 및 제2 레이어 사이의 레이어들에서 채널-확장된 신경망 연산을 수행한 결과, 제2 레이어로 입력되는 데이터는 채널-확장된 피쳐맵이다.As a result of the electronic device 2000 according to an embodiment performing a channel-extended neural network operation on layers between the first layer and the second layer, data input to the second layer is a channel-extended feature map.

단계 S230에서, 전자 장치(2000)는 제2 레이어로 입력되는 채널-확장된 피쳐맵에 대하여, 제2 레이어의 출력의 채널을 축소하는 제2 변형된 연산을 수행한다. In step S230, the electronic device 2000 performs a second transformed operation of reducing a channel of an output of the second layer on the channel-extended feature map input to the second layer.

일 실시예에서, 제2 변형된 연산은 심층 신경망의 레이어들 중 제2 레이어로 입력되는 채널-확장된 피쳐맵에 대하여, 제2 레이어에 대응하는 연산을 수행하되, 제2 레이어의 출력의 채널을 축소하는 깊이-공간 변형(depth-to-space transformation) 연산일 수 있다. 깊이-공간 변형 연산이란, 깊이 데이터를 공간 데이터로 재배열하여 깊이 차원을 축소 및/또는 제거하는 것을 말한다.In one embodiment, the second modified operation performs an operation corresponding to the second layer on a channel-extended feature map input to the second layer among the layers of the deep neural network, and the channel of the output of the second layer is performed. It may be a depth-to-space transformation operation that reduces . A depth-space transformation operation refers to reducing and/or removing a depth dimension by rearranging depth data into spatial data.

일 실시예에 따른 전자 장치(2000)가 제2 변형된 연산을 수행한 결과, 제2 레이어로부터의 출력은 채널-감소된 출력이다. 이 경우, 제2 레이어로부터의 출력은, 전술한 제1 변형된 연산, 채널-확장된 신경망 연산 및 제2 변형된 연산을 하지 않은, 심층 신경망의 원래의 제2 레이어의 출력과 동일한 출력일 수 있다.As a result of the electronic device 2000 according to an embodiment performing the second modified operation, an output from the second layer is a channel-reduced output. In this case, the output from the second layer may be the same output as the output of the original second layer of the deep neural network without the above-described first transformed operation, channel-extended neural network operation, and second transformed operation. there is.

단계 S240에서, 전자 장치(2000)는 심층 신경망의 연산의 결과를 출력한다.In step S240, the electronic device 2000 outputs an operation result of the deep neural network.

일 실시예에서, 제2 레이어는 심층 신경망의 출력 레이어일 수 있으며, 제2 레이어는 심층 신경망에 포함되는 히든 레이어들 중 하나로써, 제2 레이어 이후에 출력 레이어가 위치할 수 있고, 제2 레이어 이후에 하나 이상의 히든 레이어 및 출력 레이어가 위치할 수 있다. 일 실시예에 따라 전자 장치(2000)가 제2 변형된 연산을 수행하여 제2 레이어로부터 심층 신경망의 출력을 획득하거나, 제2 레이어 이후에 위치하는 출력 레이어로부터 심층 신경망의 출력을 획득하는 경우, 전자 장치(2000)가 획득한 심층 신경망 연산의 결과는, 심층 신경망의 원본 연산 결과와 동일한 것일 수 있다. 여기서, 원본 연산 결과는 전술한 제1 변형된 연산, 채널-확장된 신경망 연산 및 제2 변형된 연산을 하지 않은, 심층 신경망의 원래의 연산 결과를 말한다.In one embodiment, the second layer may be an output layer of a deep neural network, and the second layer is one of hidden layers included in the deep neural network, and the output layer may be located after the second layer. After that, one or more hidden layers and output layers may be located. According to an embodiment, when the electronic device 2000 performs a second transformed operation to obtain the output of the deep neural network from the second layer or obtains the output of the deep neural network from the output layer positioned after the second layer, The deep neural network calculation result obtained by the electronic device 2000 may be the same as the original calculation result of the deep neural network. Here, the original operation result refers to an original operation result of the deep neural network without performing the above-described first transformed operation, channel-extended neural network operation, and second transformed operation.

일 실시예에서, 심층 신경망 연산의 출력은, 심층 신경망의 타입에 따라 다양할 수 있다. 예를 들어, 심층 신경망의 타입이 컨볼루션 신경망이고, 객체 분류(classification)를 위한 모델인 경우, 심층 신경망 연산의 출력은 객체 분류 결과(예를 들어, 클래스 확률 등)일 수 있다.In one embodiment, the output of a deep neural network operation may vary depending on the type of deep neural network. For example, when the type of deep neural network is a convolutional neural network and a model for object classification, an output of the deep neural network operation may be an object classification result (eg, class probability, etc.).

도 2의 각각의 단계들을 설명하기 위한 후술되는 도면들을 참조하면 도 2의 각각의 단계들의 동작이 보다 명확하게 이해될 것이다.The operation of each step of FIG. 2 will be more clearly understood by referring to the following drawings for explaining each step of FIG. 2 .

도 3a는 본 개시의 일 실시예에 따른 전자 장치의 하드웨어 가속기를 이용한 신경망 연산 동작을 설명하기 위한 도면이다.3A is a diagram for explaining a neural network calculation operation using a hardware accelerator of an electronic device according to an embodiment of the present disclosure.

도 3a 및 3b를 설명함에 있어서, 신경망 연산이 컨볼루션 연산인 것을 예시로 설명한다. 다만, 본 개시의 신경망 연산은 컨볼루션 연산에 한정되는 것은 아니다.In describing FIGS. 3A and 3B , the neural network operation is a convolution operation as an example. However, the neural network operation of the present disclosure is not limited to convolution operation.

일 실시예에 따른 전자 장치(2000)는 하드웨어 가속기를 포함할 수 있다. 하드웨어 가속기는 예를 들어, CPU(Central Processing Units), GPU(Graphics Processing Units), FPGA(Field-Programmable Gate Arrays), SoC(System-on-Chips), ASIC(Application-Specific Integrated Circuits), VPC(Vision Processing Units), 뉴로모픽 IC 등일 수 있으나, 이에 한정되는 것은 아니다.The electronic device 2000 according to an embodiment may include a hardware accelerator. Hardware accelerators include, for example, Central Processing Units (CPUs), Graphics Processing Units (GPUs), Field-Programmable Gate Arrays (FPGAs), System-on-Chips (SoCs), Application-Specific Integrated Circuits (ASICs), VPCs ( Vision Processing Units), neuromorphic ICs, etc., but are not limited thereto.

전자 장치(2000)의 가속기에는 데이터 연산을 처리할 수 있는 곱셈-누산 유닛 (Multiply-accumulate unit; MAC unit)(302)이 포함될 수 있다. 본 개시에서, 전자 장치(2000)에 포함되는 MAC 유닛(302)들의 집합은 곱셈-누산 처리 유닛(MAC Processing Unit; MPU)(300)이라고 지칭될 수 있다. 다만, MPU(300)는 설명의 편의를 위해 본 개시에서 선정한 용어일 뿐, 전자 장치(2000)의 구성으로써 한정하기 위한 것은 아니다.The accelerator of the electronic device 2000 may include a multiply-accumulate unit (MAC unit) 302 capable of processing data operations. In the present disclosure, a set of MAC units 302 included in the electronic device 2000 may be referred to as a MAC Processing Unit (MPU) 300 . However, MPU (300) is only a term selected in the present disclosure for convenience of description, and is not intended to be limited as a configuration of the electronic device (2000).

도 3a를 참조하면, 일 실시예에 따른 전자 장치(2000)의 MPU(300)는, 입력 피쳐맵(310)과 컨볼루션 커널(330)의 컨볼루션 연산을 통해, 출력 피쳐맵(320)을 출력한다. 보다 구체적이면서 직관적인 예시를 들면, 입력 피쳐맵(310)에 포함되는 피쳐 값들(312)과 컨볼루션 커널(330)에 포함되는 커널 값들(332)의 곱셈 및 덧셈 연산이 수행되어, 출력 피쳐 값(322)이 획득된다.Referring to FIG. 3A , the MPU 300 of the electronic device 2000 according to an embodiment generates an output feature map 320 through a convolution operation between an input feature map 310 and a convolution kernel 330. print out For a more specific and intuitive example, multiplication and addition operations are performed between the feature values 312 included in the input feature map 310 and the kernel values 332 included in the convolution kernel 330 to obtain output feature values (322) is obtained.

일 실시예에서, 전자 장치(2000)의 가속기 사양에 따라 MPU(300)의 MAC 유닛(302)들의 수가 결정된다. 예를 들어, MAC 유닛(302)들의 수가 N개인 경우, MPU(300)에서는 N개의 병렬 연산이 수행될 수 있다.In one embodiment, the number of MAC units 302 of the MPU 300 is determined according to the accelerator specifications of the electronic device 2000 . For example, if the number of MAC units 302 is N, the MPU 300 may perform N parallel operations.

도 3a의 컨볼루션 연산을 예로 들면, 입력 피쳐맵(310) 및 컨볼루션 커널(330)의 채널 수 만큼 병렬 연산이 축적된다. 이 때, 채널 수가 MPU(300)의 MAC 유닛(302)들의 수와 동일하면, MPU(300)의 모든 MAC 유닛(302)들이 사용되고, 채널 수가 MPU(300)의 MAC 유닛(302)들의 수를 초과하면, MAC 유닛(302)들의 수만큼 연산을 수행하고, MAC 유닛(302)들의 수를 초과하는 채널들은 다시 나머지 연산을 수행하여 이전 연산 결과와 병합하므로, 마찬가지로 MPU(300)의 모든 MAC 유닛(302)들이 사용될 수 있다.Taking the convolution operation of FIG. 3A as an example, parallel operations are accumulated as many as the number of channels of the input feature map 310 and the convolution kernel 330 . At this time, if the number of channels is equal to the number of MAC units 302 of the MPU 300, all MAC units 302 of the MPU 300 are used, and the number of channels is the number of MAC units 302 of the MPU 300. If it exceeds, the number of MAC units 302 is performed, and channels exceeding the number of MAC units 302 are merged with the previous calculation result by performing the remaining calculation again, so all MAC units of the MPU 300 are likewise 302 may be used.

한편, 채널 수가 상대적으로 적은 피쳐맵에 대한 연산의 경우에는, MPU(300)의 모든 MAC 유닛(302)들이 사용되지 않는다. 이를 도 3b를 참조하여 더 설명한다.Meanwhile, in the case of operation on a feature map with a relatively small number of channels, all MAC units 302 of the MPU 300 are not used. This will be further described with reference to FIG. 3B.

도 3b는 본 개시의 일 실시예에 따른 전자 장치의 하드웨어 가속기를 이용한 신경망 연산 동작을 더 설명하기 위한 도면이다.3B is a diagram for further explaining a neural network calculation operation using a hardware accelerator of an electronic device according to an embodiment of the present disclosure.

도 3b를 참조하면, 도 3a에서 전술한 컨볼루션 연산의 예시와 동일하나, 입력 피쳐맵(310) 및 컨볼루션 커널(330)의 채널이 도 3a에서 예시로 든 입력 피쳐맵(310) 및 컨볼루션 커널(330)의 채널보다 작음을 알 수 있다. 예를 들어, 도3b의 입력 피쳐맵(310) 및 컨볼루션 커널(330)의 채널은 2채널이고, 도 3a의 입력 피쳐맵(310) 및 컨볼루션 커널(330)의 채널은 N채널이며, N은 2보다 큰 수일 수 있다.Referring to FIG. 3B, the same as the example of the convolution operation described in FIG. 3A, but the input feature map 310 and the channel of the convolution kernel 330 are the input feature map 310 and the convolution It can be seen that it is smaller than the channel of the root kernel 330. For example, the channels of the input feature map 310 and the convolution kernel 330 in FIG. 3B are 2 channels, and the channels of the input feature map 310 and the convolution kernel 330 in FIG. 3A are N channels. N can be a number greater than 2.

MPU(300)에서 수행되는, 2채널의 입력 피쳐맵(310)과 컨볼루션 커널(330)의 컨볼루션 연산의 일부를 구체적으로 살펴보기로 한다. 입력 피쳐맵(310)의 채널 1의 피쳐 값이 컨볼루션 커널의 채널 1의 커널 값과 곱해지고, 입력 피쳐맵(310)의 채널 2의 피쳐 값은 컨볼루션 커널(330)의 채널 2의 커널 값과 곱해진 뒤, 두 곱 결과가 더해지고, 출력 피쳐 값(322)이 획득된다. 즉, 입력 피쳐맵(310)과 컨볼루션 커널(330)이 2채널이므로, MPU(300) MAC 유닛(302)들 중 2개만이 유의미한 연산에 사용된다. 이를 일반화하면, 채널 수가 작은 신경망 연산의 경우, MPU(300)의 연산 효율이 낮아짐을 의미한다. 일 실시예에 따른 전자 장치(2000)는, 알고리즘을 적용함으로써 채널 변형 연산 및 채널-확장된 신경망 연산을 수행하여, MPU(300)의 MAC 유닛(302)들의 활용도를 증가시킴으로써, 연산 효율을 향상시킬 수 있다.Part of the convolution operation performed by the MPU 300 between the two-channel input feature map 310 and the convolution kernel 330 will be described in detail. The feature value of channel 1 of the input feature map 310 is multiplied by the kernel value of channel 1 of the convolution kernel, and the feature value of channel 2 of the input feature map 310 is the kernel value of channel 2 of the convolution kernel 330. After being multiplied with the value, the two multiplied results are added, and the output feature value 322 is obtained. That is, since the input feature map 310 and the convolution kernel 330 have two channels, only two of the MAC units 302 of the MPU 300 are used for meaningful operations. Generalizing this, in the case of a neural network operation with a small number of channels, it means that the operation efficiency of the MPU (300) is lowered. The electronic device 2000 according to an embodiment performs a channel transformation operation and a channel-extended neural network operation by applying an algorithm to increase utilization of the MAC units 302 of the MPU 300, thereby improving operation efficiency. can make it

도 4는 본 개시의 일 실시예에 따른 전자 장치가 신경망 연산을 수행하는 알고리즘을 개략적으로 도시한 도면이다.4 is a diagram schematically illustrating an algorithm for performing a neural network operation by an electronic device according to an embodiment of the present disclosure.

도 4를 참조하면, 원본 입력 피쳐맵(410), 원본 출력 피쳐맵(420), 채널-확장된 입력 피쳐맵(430) 및 채널-확장된 출력 피쳐맵(440)이 도시되어 있다.Referring to FIG. 4 , an original input feature map 410 , an original output feature map 420 , a channel-extended input feature map 430 and a channel-extended output feature map 440 are illustrated.

일 실시예에서, 원본 입력 피쳐맵(410)은, HI*WI의 사이즈를 갖고, 채널 수는 CI일 수 있다.In one embodiment, the original input feature map 410 may have a size of H I *W I and the number of channels may be C I .

일 실시예에서, 전자 장치(2000)는 변형된 연산을 수행하여 채널-확장된 입력 피쳐맵(430)을 획득할 수 있다. 변형된 연산은 채널을 확장(extend)하는 공간-깊이 변형(space-to-depth transformation) 연산(402)일 수 있다. 예를 들어, 전자 장치(2000)는 원본 입력 피쳐맵(410)의 피쳐 값들이 재배열 되어 생성된, 채널-확장된 입력 피쳐맵(430)을 획득할 수 있다. 채널-확장된 입력 피쳐맵(430)은, (HI/BH)*(WI/BW)의 사이즈를 갖고 채널 수가 BH*BW*CI일 수 있다.In an embodiment, the electronic device 2000 may obtain the channel-extended input feature map 430 by performing a modified operation. The transformed operation may be a space-to-depth transformation operation 402 that extends the channel. For example, the electronic device 2000 may obtain a channel-extended input feature map 430 generated by rearranging feature values of the original input feature map 410 . The channel-extended input feature map 430 may have a size of (H I /B H )*(W I /B W ) and the number of channels may be B H *B W *C I.

일 실시예에서, 전자 장치(2000)는 채널-확장된 입력 피쳐맵(430)을 이용하여, 채널-확장된 신경망 연산(404)을 수행하고, 채널-확장된 출력 피쳐맵(440)을 획득할 수 있다. 채널-확장된 출력 피쳐맵(440)은, (Ho/BH)*(Wo/BW)의 사이즈를 갖고 채널 수가 BH*BW*Co일 수 있다.In one embodiment, the electronic device 2000 performs the channel-extended neural network operation 404 using the channel-extended input feature map 430 and obtains the channel-extended output feature map 440. can do. The channel-extended output feature map 440 may have a size of (H o /B H )*(W o /B W ) and the number of channels may be B H *B W *C o .

일 실시예에서, 전자 장치(2000)는 또다른 변형된 연산을 수행하여 원본 출력 피쳐맵(420)을 할 수 있다. 변형된 연산은 채널을 축소하는 깊이-공간 변형(depth-to-space transformation) 연산(406)일 수 있다. 예를 들어, 전자 장치(2000)는 채널-확장된 출력 피쳐맵(440)의 피쳐 값들이 재배열 되어 생성된, 원본 출력 피쳐맵(420)을 획득할 수 있다. 원본 출력 피쳐맵(420)은, HO*WO의 사이즈를 갖고, 채널 수는 CO일 수 있다.In one embodiment, the electronic device 2000 may perform another modified operation to produce the original output feature map 420 . The transformed operation may be a depth-to-space transformation operation 406 that reduces the channel. For example, the electronic device 2000 may obtain the original output feature map 420 generated by rearranging feature values of the channel-extended output feature map 440 . The original output feature map 420 may have a size of H O *W O and the number of channels may be C O .

일 실시예에서, 전자 장치(2000)가 공간-깊이 변형(space-to-depth transformation) 연산(402), 깊이-공간 변형(depth-to-space transformation) 연산(406) 및 채널-확장된 신경망 연산(404)을 수행한 결과는, 원본 입력 피쳐맵(410)으로부터 원본 출력 피쳐맵(420)을 획득하는 원본 연산(400)의 결과와 동일할 수 있다. 다만 이 경우, 연산 결과가 동일하더라도, 연산 방법에 따라 신경망 연산의 채널이 상이하므로, MPU에서 유의미한 값을 획득하기 위해 사용되는 MAC 유닛의 수는 상이할 수 있다.In one embodiment, the electronic device 2000 performs a space-to-depth transformation operation 402, a depth-to-space transformation operation 406, and a channel-expanded neural network. A result of performing the operation 404 may be the same as the result of the original operation 400 for obtaining the original output feature map 420 from the original input feature map 410 . However, in this case, even if the calculation result is the same, since the channel of neural network calculation is different according to the calculation method, the number of MAC units used to obtain a meaningful value in the MPU may be different.

도 5는 본 개시의 일 실시예에 따른 전자 장치가 수행하는 신경망 연산의 전반적인 아키텍처를 설명하기 위한 도면이다.5 is a diagram for explaining an overall architecture of a neural network operation performed by an electronic device according to an embodiment of the present disclosure.

도 5를 설명함에 있어서, 신경망 연산이 컨볼루션 연산인 것을 예시로 설명한다. 다만, 본 개시의 신경망 연산은 컨볼루션 연산에 한정되는 것은 아니다. 컨볼루션 신경망은 컨볼루션 레이어, 풀링 레이어, 완전 연결 레이어 등을 포함할 수 있다.In describing FIG. 5 , the neural network operation is a convolution operation as an example. However, the neural network operation of the present disclosure is not limited to convolution operation. A convolutional neural network may include a convolutional layer, a pooling layer, a fully connected layer, and the like.

일 실시예에서, 전자 장치(2000)는 컨볼루션 신경망의 레이어들 중 제1 레이어로 입력되는 피쳐맵(FM0)(510)에 대하여 제1 변형된 연산(Op1')(520)을 수행할 수 있다. 제1 변형된 연산(520) 결과, 채널-확장된 피쳐맵(FM1')(530)이 획득될 수 있다. 제1 변형된 연산(520)은 제1 레이어의 출력의 채널을 확장(extend)하는 공간-깊이 변형(space-to-depth transformation) 연산일 수 있다.In an embodiment, the electronic device 2000 may perform a first transformed operation (Op1') 520 on a feature map (FM0) 510 input to a first layer among the layers of the convolutional neural network. there is. As a result of the first modified operation 520 , a channel-extended feature map FM1′ 530 may be obtained. The first transformed operation 520 may be a space-to-depth transformation operation that extends a channel of an output of the first layer.

일 실시예에서, 제1 변형된 연산(520)이 수행되면, 전자 장치(2000)는 이후의 신경망 연산들을 채널-확장된 신경망 연산(540)으로 수행할 수 있다. 전자 장치(2000)는 제1 레이어와 제2 레이어 사이의 레이어들에 대응하는 신경망 연산을 채널-확장된 신경망 연산(540)으로 수행함으로써, 채널-확장된 상태에서 입출력 데이터가 연쇄적으로 신경망 레이어들에 입력 및 출력되도록 할 수 있다. 예를 들어, 채널-확장된 신경망 연산(540)은 2번째 연산(Op2'), ..., N-1번째 연산(Op(N-1)') 및 N번째 연산(OpN')을 포함할 수 있다. 채널-확장된 신경망 연산(540) 과정에서 획득되는 피쳐맵들은, 채널-확장된 피쳐맵들이다. 예를 들어, N-1번째 피쳐맵(FM(N-1) 및 N번째 피쳐맵(FMN')(550)이 채널-확장된 피쳐맵일 수 있다.In an embodiment, when the first modified operation 520 is performed, the electronic device 2000 may perform subsequent neural network operations as a channel-extended neural network operation 540 . The electronic device 2000 performs a neural network operation corresponding to layers between the first layer and the second layer as a channel-extended neural network operation 540, so that input/output data is serially transferred to the neural network layer in a channel-extended state. can be input and output. For example, the channel-extended neural network operation 540 includes the second operation (Op2'), ..., the N-1 operation (Op(N-1)') and the N-th operation (OpN'). can do. Feature maps obtained in the channel-extended neural network operation 540 are channel-extended feature maps. For example, the N−1 th feature maps FM(N−1) and the N th feature map FMN′ 550 may be channel-extended feature maps.

일 실시예에서, 전자 장치(2000)는 컨볼루션 신경망의 레이어들 중 제2 레이어로 입력되는 채널-확장된 피쳐맵(FMN')(550)에 대하여, 제2 변형된 연산(560)을 수행할 수 있다. 제2 변형된 연산(560)은, 제2 레이어의 출력의 채널을 축소하는 깊이-공간 변형(depth-to-space transformation) 연산일 수 있다. 제2 변형된 연산(560) 결과, 채널이 축소된 출력 피쳐맵(FMN)(570)이 획득될 수 있다. 이 경우, 출력 피쳐맵(529)은 컨볼루션 신경망의 원본 연산(580)의 결과와 동일하다. 예를 들어, 원본 연산(580)은 1번째 연산(Op1), 2번째 연산(Op2), ..., N-1번째 연산(Op(N-1)) 및 N번째 연산(OpN)을 포함할 수 있다. 이 경우, 원본 연산(580) 과정에서 획득되는 피쳐맵들은, 채널이 확장되지 않은 원본 피쳐맵들이다.In an embodiment, the electronic device 2000 performs a second transformed operation 560 on a channel-extended feature map (FMN') 550 input to a second layer among the layers of the convolutional neural network. can do. The second transformed operation 560 may be a depth-to-space transformation operation that reduces a channel of an output of the second layer. As a result of the second modified operation 560, an output feature map (FMN) 570 with reduced channels may be obtained. In this case, the output feature map 529 is identical to the result of the original operation 580 of the convolutional neural network. For example, original operation 580 includes 1st operation (Op1), 2nd operation (Op2), ..., N-1st operation (Op(N-1)) and Nth operation (OpN). can do. In this case, the feature maps obtained in the original operation 580 are original feature maps in which the channel is not extended.

일 실시예에서, 전자 장치(2000)는 출력 피쳐맵(570)을 획득하면, 신경망 연산의 결과를 출력할 수 있다. 일 실시예에서, 신경망 연산의 결과는 피쳐 값 및/또는 추론 결과 등을 모두 포함할 수 있다. 예를 들어, 전술한 방법에 따른 신경망 연산의 결과인 피쳐 값이 제2 레이어 이후의 또다른 레이어를 거치며 신경망 연산이 더 수행될 수 있고, 신경망 연산의 결과에 기초하여 신경망 모델의 추론 결과가 출력될 수 있다. 구체적으로, 도 5에 도시된 것은 컨볼루션 신경망이므로, 전자 장치(2000)는 출력 피쳐맵(570)의 피쳐 값들을 완전 연결 레이어들을 거치게 한 후, 이미지 분류 결과가 출력되도록 할 수 있다.In an embodiment, upon obtaining the output feature map 570, the electronic device 2000 may output a result of neural network operation. In one embodiment, the result of the neural network operation may include both feature values and/or inference results. For example, a feature value, which is a result of the neural network operation according to the above-described method, passes through another layer after the second layer, and the neural network operation may be further performed, and the inference result of the neural network model is output based on the result of the neural network operation. It can be. In detail, since the one shown in FIG. 5 is a convolutional neural network, the electronic device 2000 may pass the feature values of the output feature map 570 through fully connected layers, and then output an image classification result.

한편, 전자 장치(2000)는 심층 신경망의 타입에 기초하여, 제1 및/또는 제2 변형된 연산을 다른 연산으로 대체할 수 있다. 예를 들어, 심층 신경망이 컨볼루션 신경망인 경우, 전자 장치(2000)는 공간-깊이 변형 연산을 포함하는 제1 변형된 연산(520)을 컨볼루션 연산으로 대체할 수 있다. 즉, 전자 장치(2000)는 컨볼루션 연산 방식을 적용하여 채널-확장된 피쳐맵이 획득되도록 할 수 있다. 또한, 전자 장치(2000)는 깊이-공간 변형 연산을 포함하는 제2 변형된 연산(560)을 전치(transposed) 컨볼루션 연산으로 대체할 수 있다. 즉, 전자 장치(2000)는 전치 컨볼루션 연산 방식을 적용하여 채널-축소된 피쳐맵이 획득되도록 할 수 있다. 이에 대한 추가적인 설명은 후술하기로 한다.Meanwhile, the electronic device 2000 may replace the first and/or second modified operation with another operation based on the type of deep neural network. For example, when the deep neural network is a convolutional neural network, the electronic device 2000 may replace the first transformed operation 520 including the space-depth transformation operation with a convolution operation. That is, the electronic device 2000 may acquire a channel-extended feature map by applying a convolution operation method. Also, the electronic device 2000 may replace the second transformed operation 560 including the depth-space transformation operation with a transposed convolution operation. That is, the electronic device 2000 may acquire a channel-reduced feature map by applying a pre-convolution operation method. Further explanation on this will be described later.

일 실시예에 따른 전자 장치(2000)는 심층 신경망의 타입에 대응하는 변형된 연산을 선택 및 적용함으로써, 전자 장치(2000)의 연산 효율을 더 증가시킬 수 있다. 예를 들어, 채널 확장을 위해 컨볼루션 연산을 사용하고, 채널 축소를 위해 전치 컨볼루션 연산을 사용하면, 병렬 연산이 수행됨에 따라 가속기의 MAC 유닛들의 활용도를 증가시킬 수 있다.The electronic device 2000 according to an embodiment may further increase computational efficiency of the electronic device 2000 by selecting and applying a modified operation corresponding to a type of deep neural network. For example, if convolution operation is used for channel extension and preconvolution operation is used for channel reduction, utilization of MAC units of the accelerator can be increased as parallel operation is performed.

도 6은 본 개시의 일 실시예에 따른 신경망 연산의 제1 변형 및 제2 변형을 설명하기 위한 도면이다.6 is a diagram for explaining a first modification and a second modification of a neural network operation according to an embodiment of the present disclosure.

일 실시예에서, 전자 장치(2000)는 피쳐맵에 대하여 데이터를 재배열하는 변형된 연산을 수행할 수 있다. 변형된 연산은, 채널을 확장하는 확장(extend)하는 공간-깊이 변형(space-to-depth transformation) 연산 및 채널을 축소하는 깊이-공간 변형(depth-to-space transformation) 연산을 포함할 수 있다.In an embodiment, the electronic device 2000 may perform a modified operation of rearranging data with respect to the feature map. The transformed operation may include a space-to-depth transformation operation for extending a channel and a depth-to-space transformation operation for reducing a channel. .

예를 들어, 원본 피쳐맵(610)은 H*W의 사이즈를 갖고, 채널 수는 C일 수 있다. 전자 장치(2000)가 공간-깊이 변형을 수행하여 이 원본 피쳐맵(610)의 채널을 BH*BW 만큼 확장하고자 하는 경우, 전자 장치(2000)는 원본 피쳐맵(610)에서 인접한 BH*BW 개의 피쳐 값을 선택하고, 이를 단일 픽셀의 채널 방향으로 나열할 수 있다. 이 경우, (H,W,C) 차원의 원본 피쳐맵(610)은 (H/BH, W/BW, C*BH*BW) 차원의 채널-확장된 피쳐맵(620)으로 변형된다. 반대로, 전자 장치(2000)가 깊이-공간 변형을 수행하여 이 피쳐맵의 채널을 BH*BW 만큼 축소하고자 하는 경우, 전자 장치(2000)는 채널-확장된 피쳐맵(620)에서 단일 픽셀의 채널 방향으로 나열된 BH*BW 개의 피쳐 값을 선택하고, 이를 원본 피쳐맵(610)에서 픽셀 BH*BW 개의 인접한 픽셀이 되도록 나열할 수 있다. 이 경우, (H/BH, W/BW, C*BH*BW) 차원의 채널-확장된 피쳐맵(620)은 (H,W,C) 차원의 원본 피쳐맵(610)으로 변형된다.For example, the original feature map 610 may have a size of H*W and the number of channels may be C. If the electronic device 2000 wishes to expand the channel of the original feature map 610 by B H *B W by performing space-depth transformation, the electronic device 2000 may perform a spatial-depth transformation to expand the adjacent B H in the original feature map 610. *B You can choose W feature values and arrange them in the channel direction of a single pixel. In this case, the original feature map 610 of dimension (H, W, C) is transformed into a channel-extended feature map 620 of dimension (H/B H , W/B W , C*B H *B W ). Transformed. Conversely, if the electronic device 2000 wants to reduce the channel of this feature map by B H *B W by performing depth-space transformation, the electronic device 2000 will perform a single pixel in the channel-expanded feature map 620. B H *B W number of feature values arranged in the channel direction of , and these may be arranged to be pixel B H *B W number of adjacent pixels in the original feature map 610 . In this case, the (H/B H , W/B W , C*B H *B W )-dimensional channel-extended feature map 620 is transformed into the (H, W, C)-dimensional original feature map 610. Transformed.

도 6을 참조하면, 공간-깊이 변형을 통해 (6, 6, 2) 차원의 원본 피쳐맵(610)이 (3, 3, 8) 차원의 채널-확장된 피쳐맵(620)으로 변형될 수 있고, 또는, 그 역변형인 깊이-공간 변형을 통해, 채널-확장된 피쳐맵(620)이 원본 피쳐맵(610)으로 변형될 수 있다.Referring to FIG. 6 , the (6, 6, 2) dimension original feature map 610 may be transformed into a (3, 3, 8) dimension channel-extended feature map 620 through space-depth transformation. The channel-extended feature map 620 may be transformed into the original feature map 610 through depth-space transformation, which is present or an inverse transformation thereof.

도 7은 본 개시의 일 실시예에 따른 전자 장치가 수행하는 심층 신경망 연산의 일 예를 설명하기 위한 도면이다.7 is a diagram for explaining an example of a deep neural network operation performed by an electronic device according to an embodiment of the present disclosure.

일 실시예에서, 신경망 연산은 요소별 연산(예를 들어, 요소별 곱셈 등)일 수 있다. 요소별 연산은 같은 크기의 입출력 피쳐맵을 가지며, 출력 피쳐맵에서의 하나의 피쳐 값은 입력 피쳐맵들에서 동일한 위치의 피쳐 값에 의존한다. 예를 들어, 제1 피쳐맵(710)과 제2 피쳐맵(720)의 요소별 연산이 수행되어, 제3 피쳐맵(730)이 획득될 수 있다.In one embodiment, neural network operations may be element-wise operations (eg, element-wise multiplication, etc.). Element-by-element operation has input and output feature maps of the same size, and a feature value in the output feature map depends on a feature value in the same position in the input feature maps. For example, a third feature map 730 may be obtained by performing calculations for each element of the first feature map 710 and the second feature map 720 .

일 실시예에 따른 전자 장치(2000)는 심층 신경망의 레이어들 중 제1 레이어로 입력되는 피쳐맵에 대하여 제1 변형된 연산을 수행한다. 전자 장치(2000)는 제1 레이어로 입력되는 피쳐맵에 대하여, 제1 레이어에 대응하는 연산을 수행하되, 제1 레이어의 출력의 채널이 확장되도록 할 수 있다.The electronic device 2000 according to an embodiment performs a first transformed operation on a feature map input to a first layer among layers of a deep neural network. The electronic device 2000 may perform an operation corresponding to the first layer on the feature map input to the first layer, but expand the channel of the output of the first layer.

예를 들어, 제1 레이어가 요소별 연산을 위한 레이어인 경우, 전자 장치(2000)는 제1 피쳐맵(710) 및 제2 피쳐맵(720) 블록의 공간 데이터를 깊이 방향으로 재배열할 수 있다. 전자 장치(2000)는 제1 피쳐맵(710) 및 제2 피쳐맵(720)의 피쳐 값들을 재배열하여 채널을 확장한 뒤, 요소별 연산이 수행된 결과인 채널-확장된 데이터를 획득할 수 있다. 채널 확장된 데이터란, 제3 피쳐맵(730)의 피쳐 값들을 재배열한 것일 수 있으며, 제1 피쳐맵(710) 및 제2 피쳐맵(720)에 대하여 채널을 확장한 것과 동일한 방법으로 제3 피쳐맵(730)의 채널을 확장한 결과일 수 있다.For example, when the first layer is a layer for element-by-element operation, the electronic device 2000 may rearrange spatial data of blocks of the first feature map 710 and the second feature map 720 in the depth direction. there is. The electronic device 2000 rearranges the feature values of the first feature map 710 and the second feature map 720 to extend the channel, and then acquires channel-extended data as a result of element-by-element operation. can The channel-extended data may be rearranged feature values of the third feature map 730, and the third feature map 710 and the second feature map 720 are channel-extended by the same method. This may be a result of extending the channel of the feature map 730 .

일 실시예에서, 전자 장치(2000)는 채널-확장된 데이터를 입출력 데이터로 하여 채널-확장된 신경망 연산을 수행할 수 있다. 이는, 전술하였으므로 동일한 설명은 생략한다.In an embodiment, the electronic device 2000 may perform a channel-extended neural network operation using the channel-extended data as input/output data. Since this has been described above, the same description will be omitted.

한편, 도 7에서는 신경망 연산의 예시를 요소별 연산으로 설명하였으나, 신경망 연산의 종류는 이에 한정되는 것은 아니다.Meanwhile, in FIG. 7, an example of neural network operation is described as an element-by-element operation, but the type of neural network operation is not limited thereto.

도 8a는 내지 도 8c는 본 개시의 일 실시예에 따른 전자 장치가 수행하는 심층 신경망 연산이 컨볼루션 연산인 예시를 설명하기 위한 도면이다.8A to 8C are diagrams for explaining an example in which a deep neural network operation performed by an electronic device according to an embodiment of the present disclosure is a convolution operation.

도 8a는 원본 컨볼루션 연산을 설명하기 위한 도면이다.8A is a diagram for explaining an original convolution operation.

일 실시예에서, 신경망 연산은 컨볼루션 연산일 수 있다. 도 8a에서, 본 개시에서 지칭하는 원본 연산인 컨볼루션 연산을 간략하게 설명한다.In one embodiment, the neural network operation may be a convolution operation. In FIG. 8A, a convolution operation, which is an original operation referred to in this disclosure, is briefly described.

일 실시예에서, 원본 입력 피쳐맵(810)에 대하여 원본 커널(820)이 스트라이드되어 원본 출력 피쳐맵(830)이 획득된다. 예를 들어, 원본 입력 피쳐맵(710)의 사이즈는 HI*WI=4*4, 원본 커널(820)의 사이즈는 KH*KW=3*3, 원본 입력 피쳐맵(810) 및 원본 커널(820)의 채널은 CI=2, 원본 출력 피쳐맵(830)의 사이즈는 HO*WO=2*2, 원본 출력 피쳐맵(830)의 채널은 CO=1일 수 있다. In one embodiment, the original kernel 820 is strided against the original input feature map 810 to obtain the original output feature map 830 . For example, the size of the original input feature map 710 is H I *W I =4*4, the size of the original kernel 820 is K H *K W =3*3, the original input feature map 810 and The channel of the original kernel 820 may be C I =2, the size of the original output feature map 830 may be H O *W O =2 * 2, and the channel of the original output feature map 830 may be C O =1. .

도 8b는 원본 컨볼루션 연산을 더 설명하기 위한 도면이다.8B is a diagram for further explaining the original convolution operation.

일 실시예에서, 원본 출력 피쳐맵(830)은 피쳐 값 A(832), 피쳐 값 B(834), 피쳐 값 C(836), 피쳐 값 D(838)을 포함할 수 있다.In one embodiment, the original output feature map 830 may include feature value A 832 , feature value B 834 , feature value C 836 , and feature value D 838 .

개시된 실시예에서, 4*4 크기를 갖는 원본 입력 피쳐맵(810)의 피쳐 값을 요소들을 지칭하기 위해, 행렬 표현 방식을 도입한다. 구체적으로, 원본 입력 피쳐맵(810)의 채널 1의 피쳐 값 요소를 행렬 요소 Aij, 입력 피쳐맵(810)의 채널 2의 피쳐 값 요소를 행렬 요소 Bij로 하여 설명한다. 또한, 패딩=0, 스트라이드=1이 예시로 적용하며, 구체적인 컨볼루션 연산의 동작은 통상의 기술자에게 자명하므로 이하 간략하게만 설명한다.In the disclosed embodiment, a matrix representation is introduced to designate feature values of the original input feature map 810 having a size of 4*4 as elements. Specifically, a feature value element of channel 1 of the original input feature map 810 is described as a matrix element A ij , and a feature value element of channel 2 of the input feature map 810 is a matrix element B ij . In addition, padding = 0 and stride = 1 are applied as an example, and since the operation of a specific convolution operation is obvious to those skilled in the art, it will only be briefly described below.

일 실시예에서, 원본 출력 피쳐맵(830)의 피쳐 값 A(832)는, 원본 입력 피쳐맵(810)의 피쳐 값들 A11, A12, A13, A21, A22, A23, A31, A32, A33, 과 커널 값 1, 2, 3, 4, 5, 6, 7, 8, 9 의 요소별 곱셈 결과 및 원본 입력 피쳐맵(810)의 피쳐 값들 B11, B12, B13, B21, B22, B23, B31, B32, B33, 과 커널 값 1, 2, 3, 4, 5, 6, 7, 8, 9 의 요소별 곱셈 결과를 모두 더함으로써 획득된다.In one embodiment, the feature values A 832 of the original output feature map 830 are the feature values A 11, A 12, A 13, A 21, A 22, A 23, A of the original input feature map 810. 31, A 32, A 33, element-wise multiplication results of kernel values 1, 2, 3, 4, 5, 6, 7, 8, 9 and feature values of the original input feature map 810 B 11, B 12, By adding all the element-by-element multiplication results of B 13, B 21, B 22, B 23, B 31, B 32, B 33, and kernel values 1, 2, 3, 4, 5, 6, 7, 8, 9 is obtained

일 실시예에서, 원본 출력 피쳐맵(830)의 피쳐 값 B(834)는, 원본 입력 피쳐맵(810)의 피쳐 값들 A12, A13, A14, A22, A23, A24, A32, A33, A34, 과 커널 값 1, 2, 3, 4, 5, 6, 7, 8, 9 의 요소별 곱셈 결과 및 원본 입력 피쳐맵(810)의 피쳐 값들 B12, B13, B14, B22, B23, B24, B32, B33, B34, 과 커널 값 1, 2, 3, 4, 5, 6, 7, 8, 9 의 요소별 곱셈 결과를 모두 더함으로써 획득된다.In one embodiment, the feature values B 834 of the original output feature map 830 are the feature values A 12, A 13, A 14, A 22, A 23, A 24, A of the original input feature map 810. 32, A 33, A 34, element-wise multiplication results of kernel values 1, 2, 3, 4, 5, 6, 7, 8, 9 and feature values of the original input feature map 810 B 12, B 13, By adding all the element-by-element multiplication results of B 14, B 22, B 23, B 24, B 32, B 33, B 34, and kernel values 1, 2, 3, 4, 5, 6, 7, 8, 9 is obtained

같은 방식으로, 원본 출력 피쳐맵(830)의 피쳐 값 C(836) 및 피쳐 값 D(838)가 획득될 수 있다. 즉, 원본 연산은 블록 840에 도시된 것과 같이, 원본 커널(820)이 원본 입력 피쳐맵(810)을 스트라이드하며 연산이 수행된다.In the same way, feature values C 836 and feature values D 838 of the original output feature map 830 can be obtained. That is, the original operation is performed while the original kernel 820 strides the original input feature map 810 as shown in block 840 .

한편, 일 실시예에 따른 전자 장치(2000)는, 원본 연산과 동일한 효과를 얻을 수 있는, 변형된 연산 및 채널-확장된 신경망 연산을 수행한다. 즉, 전자 장치(2000)는 전술한 실시예들에 따른 신경망 연산 방법을 수행함으로써, 연산되는 데이터의 채널 수를 확장하되, 원본 연산과 동일한 결과를 획득할 수 있다. 이에 대한 예시를 도 8c를 참조하여 더 설명한다.Meanwhile, the electronic device 2000 according to an embodiment performs a modified operation and a channel-extended neural network operation that can obtain the same effect as the original operation. That is, the electronic device 2000 may expand the number of channels of data to be calculated by performing the neural network calculation method according to the above-described embodiments, but obtain the same result as the original calculation. An example of this will be further described with reference to FIG. 8C.

도 8c는 본 개시의 일 실시예에 따른 전자 장치가 컨볼루션 연산 수행을 위해 피쳐맵의 채널을 확장하는 것을 설명하기 위한 도면이다.8C is a diagram for explaining that an electronic device according to an embodiment of the present disclosure extends a channel of a feature map to perform a convolution operation.

일 실시예에 따른 전자 장치(2000)는, 컨볼루션 신경망의 레이어의 출력의 채널을 확장하기 위한, 제1 변형된 연산을 수행할 수 있다. 제1 변형된 연산은 피쳐맵의 채널을 확장하는 공간-깊이 변형 연산을 포함할 수 있다. 또한, 제1 변형된 연산은 컨볼루션 신경망의 커널을 변형하는, 커널 변형 연산을 포함할 수 있다. 또한, 제1 변형된 연산은 컨볼루션 연산 방식을 적용하는 것을 포함할 수 있다. 예를 들어, 전자 장치(2000)는 채널-확장된 피쳐맵(850)과 채널-확장된 커널(860)을 기초로, 컨벌루션 연산 방식을 적용함으로써 채널-확장된 출력 피쳐맵(870)을 획득할 수 있다.The electronic device 2000 according to an embodiment may perform a first modified operation for extending a channel of an output of a layer of a convolutional neural network. The first transform operation may include a space-depth transform operation that expands a channel of the feature map. Also, the first transformed operation may include a kernel transformation operation that transforms the kernel of the convolutional neural network. Also, the first modified operation may include applying a convolution operation method. For example, the electronic device 2000 obtains a channel-extended output feature map 870 by applying a convolution operation method based on the channel-extended feature map 850 and the channel-extended kernel 860. can do.

일 실시예에서, 전자 장치(2000)는 원본 입력 피쳐맵(810)에 대하여, 공간-깊이 변형 연산을 수행하여 채널-확장된 입력 피쳐맵(850)을 획득할 수 있다. 전자 장치(2000)가 공간-깊이 변형 연산을 수행하는 것은 도 6에서 설명하였으므로, 동일한 설명은 생략한다.In an embodiment, the electronic device 2000 may obtain a channel-extended input feature map 850 by performing a spatial-depth transformation operation on the original input feature map 810 . Since the space-depth transform operation performed by the electronic device 2000 has been described with reference to FIG. 6 , the same description will be omitted.

일 실시예에서, 전자 장치(2000)는 커널 변형 연산을 수행하여 채널-확장된 커널(860)을 획득한다. 채널-확장된 커널(860)은 원본 커널(820)의 커널 값을 재배열함으로써 획득될 수 있다.In one embodiment, the electronic device 2000 obtains the channel-extended kernel 860 by performing a kernel transformation operation. The channel-extended kernel 860 can be obtained by rearranging the kernel values of the original kernel 820 .

설명의 편의를 위하여, 채널-확장된 출력 피쳐맵(870)의 피쳐 값 A(872)를 획득하기 위한, 채널-확장된 커널 중 일부인 커널 A1(861), 커널 A2(862), 커널 A3(863), 커널 A4(864), 커널 A5(865), 커널 A6(866), 커널 A7(867), 커널 A8(868)를 대표적으로 설명한다. 해당 설명을 읽은 통상의 기술자에게는, 도 8c를 참조한다면 채널-확장된 피쳐맵(870)의 피쳐 값 B, 피쳐 값 C, 및 피쳐 값 D를 구하는 방법 또한 명확하게 이해될 수 있을 것이다.For convenience of description, kernels A1 861, kernel A2 862, and kernel A3, which are some of the channel-extended kernels, for obtaining the feature value A 872 of the channel-extended output feature map 870 ( 863), kernel A4 (864), kernel A5 (865), kernel A6 (866), kernel A7 (867), and kernel A8 (868) are representatively described. For those of ordinary skill in the art who have read the description, referring to FIG. 8C , a method of obtaining the feature value B, feature value C, and feature value D of the channel-extended feature map 870 will also be clearly understood.

개시된 실시예에서, 2*2 크기를 갖는 커널 A1(861) 내지 커널 A8(868)의 커널 값 요소들을 지칭하기 위해, 행렬 표현 방식을 도입한다.In the disclosed embodiment, a matrix representation is introduced to refer to kernel value elements of kernel A1 (861) to kernel A8 (868) having a size of 2*2.

일 실시예에서, 전자 장치(2000)는 원본 커널(820)의 채널 1의 커널 값 1, 3, 7, 9(여기서, 값은 위치를 나타내기 위한 수치이며 실제적인 값을 나타내는 것은 아니다. 이하도 동일)를 커널 A1(861)의 A111, A112, A121, A122로 재배열한다. 같은 방식으로, 전자 장치(2000)는 원본 커널(820)의 채널 2의 커널 값 1, 3, 7, 9를 커널 A2(862)의 A211, A212, A221, A222로 재배열한다.In one embodiment, the electronic device 2000 uses kernel values 1, 3, 7, and 9 of channel 1 of the original kernel 820 (here, the values are numerical values representing locations and do not represent actual values. Below ) is rearranged into A1 11 , A1 12 , A1 21 , A1 22 of the kernel A1 (861). In the same way, the electronic device 2000 rearranges the kernel values 1, 3, 7, and 9 of channel 2 of the original kernel 820 into A2 11 , A2 12 , A2 21 , and A2 22 of the kernel A2 862 . .

또한, 전자 장치(2000)는 원본 커널(820)의 채널 1의 커널 값 2, 8을 커널 A3(863)의 A311, A321로 재배열하고, 나머지 값 A312, A322 에는 0을 패딩한다. 같은 방식으로, 전자 장치(2000)는 원본 커널(820)의 채널 2의 커널 값 2, 8을 커널 A4(864)의 A411, A421로 재배열하고, 나머지 값 A412, A422 에는 0을 패딩한다.In addition, the electronic device 2000 rearranges the kernel values 2 and 8 of channel 1 of the original kernel 820 to A3 11 and A3 21 of the kernel A3 863, and pads the remaining values A3 12 and A3 22 with 0. do. In the same way, the electronic device 2000 rearranges the kernel values 2 and 8 of channel 2 of the original kernel 820 to A4 11 and A4 21 of the kernel A4 864, and the remaining values A4 12 and A4 22 are 0 pad the

또한, 전자 장치(2000)는 원본 커널(820)의 채널 1의 커널 값 4, 6을 커널 A5(865)의 A511, A512로 재배열하고, 나머지 값 A521, A522 에는 0을 패딩한다. 같은 방식으로, 전자 장치(2000)는 원본 커널(820)의 채널 2의 커널 값 4, 6을 커널 A6(866)의 A611, A612로 재배열하고, 나머지 값 A621, A622 에는 0을 패딩한다.In addition, the electronic device 2000 rearranges the kernel values 4 and 6 of channel 1 of the original kernel 820 to A5 11 and A5 12 of the kernel A5 865, and pads the remaining values A5 21 and A5 22 with 0. do. In the same way, the electronic device 2000 rearranges the kernel values 4 and 6 of channel 2 of the original kernel 820 to A6 11 and A6 12 of the kernel A6 866, and the remaining values A6 21 and A6 22 are 0 pad the

또한, 전자 장치(2000)는 원본 커널(820)의 채널 1의 커널 값 5를 커널 A7(867)의 A711, 로 재배열하고, 나머지 값 A712, A721, A722 에는 0을 패딩한다. 같은 방식으로, 전자 장치(2000)는 원본 커널(820)의 채널 2의 커널 값 5를 커널 A8(868)의 A811, 로 재배열하고, 나머지 값 A812, A821, A822 에는 0을 패딩한다.In addition, the electronic device 2000 rearranges the kernel value 5 of channel 1 of the original kernel 820 to A7 11 , of the kernel A7 867, and pads the remaining values A7 12 , A7 21 , and A7 22 with 0. . In the same way, the electronic device 2000 rearranges the kernel value 5 of channel 2 of the original kernel 820 to A8 11 , of the kernel A8 868, and assigns 0 to the remaining values A8 12 , A8 21 and A8 22 . pad

일 실시예에 따른 전자 장치(2000)는, 채널-확장된 입력 피쳐맵(850)과 채널-확장된 커널(860)에 컨볼루션 연산 방식을 적용할 수 있다. 예를 들어, 전자 장치(2000)는 채널 확장된 입력 피쳐맵(850)과 커널 A1(861) 내지 커널 A8(868)의 요소별 곱셈을 수행하고, 결과 값을 모두 더함으로써, 채널-확장된 출력 피쳐맵(870)의 피쳐 값 A(872)를 획득할 수 있다. 같은 방식으로, 전자 장치(2000)는 채널-확장된 출력 피쳐맵(870)의 피쳐 값 B, C, D를 획득함으로써, 채널-확장된 출력 피쳐맵(870)의 모든 요소들을 구할 수 있다. 채널-확장된 출력 피쳐맵(870)의 각각의 요소 값들은, 원본 출력 피쳐맵(830)의 각각의 요소 값들과 동일하다. 즉, 전자 장치(2000)는 원본 신경망 연산과 동일한 연산을, 채널 확장된 형태의 다른 방식으로 연산할 수 있다.The electronic device 2000 according to an embodiment may apply a convolution operation method to the channel-extended input feature map 850 and the channel-extended kernel 860 . For example, the electronic device 2000 performs element-by-element multiplication of the channel-extended input feature map 850 and kernel A1 861 to kernel A8 868, and adds all of the resulting values to obtain a channel-extended input feature map 850. A feature value A 872 of the output feature map 870 may be obtained. In the same way, the electronic device 2000 may obtain all elements of the channel-extended output feature map 870 by acquiring feature values B, C, and D of the channel-extended output feature map 870 . Each element value of the channel-extended output feature map 870 is the same as each element value of the original output feature map 830 . That is, the electronic device 2000 may perform the same operation as the original neural network operation in a different method in a channel-extended form.

일 실시예에서, 채널-확장된 입력 피쳐맵(850) 및 채널-확장된 커널(860)을 이용하여 채널-확장된 출력 피쳐맵(870)이 획득된다. 예를 들어, 채널-확장된 입력 피쳐맵(850)의 사이즈는 (HI/BH)*(WI/BW)=2*2, 채널-확장된 커널(860)의 사이즈는 KH*KW=2*2, 채널-확장된 입력 피쳐맵(850) 및 채널-확장된 커널(860)의 채널은 CI=2, 채널-확장된 출력 피쳐맵(870)의 사이즈는 (HO/BH)*(WO/BH)=1*1, 채널-확장된 출력 피쳐맵(870)의 채널은 CO=1일 수 있다.In one embodiment, channel-extended output feature map 870 is obtained using channel-extended input feature map 850 and channel-extended kernel 860 . For example, the size of the channel-extended input feature map 850 is (H I /B H )*(W I /B W )=2*2, and the size of the channel-extended kernel 860 is K H *K W =2*2, the channel of the channel-extended input feature map 850 and the channel-extended kernel 860 is C I =2, the size of the channel-extended output feature map 870 is (H O /B H )*(W O /B H )=1*1, the channel of the channel-extended output feature map 870 may be C O =1.

전자 장치(2000)는 변형된 연산을 사용하여 채널-확장된 신경망 연산을 수행함으로써, 가속기의 성능 이득을 얻을 수 있다. 컨볼루션 연산을 예로 들면, 채널이 Cfix로 고정된 MPU에서의 컨볼루션 연산의 성능은, 그 곱셈 연산의 수인 (HI*WI*Cfix*Kw*Kh*Co)/(STRh*STRw)에 비례한다. (여기서, STRh, STRw 은 스트라이드를 의미한다.)The electronic device 2000 may obtain a performance gain of the accelerator by performing a channel-extended neural network operation using the modified operation. Taking the convolution operation as an example, the performance of the convolution operation in an MPU where the channel is fixed to C fix is (H I *W I *C fix *K w *K h *C o )/( Proportional to STR h *STR w ). (Here, STR h and STR w mean strides.)

구체적 예로써, 채널이 32로 고정된 가속기에서, 피쳐맵의 크기가 (HI, WI, CI) = (256, 256, 8)인 피쳐맵에 대하여, 커널의 크기가 (Kh, Kw, Co) = (3, 3, 8)인 변형된 연산을 적용하려는 경우를 가정한다(패딩은 동일하게 유지되며, 스트라이드=1인 일반적인 경우를 가정). 이 경우, 원본 컨볼루션 연산은 MPU에서 256*256*32*3*3*8=150,994,944 회의 곱셈 연산이 수행된다. 반면, (Bh, Bw) = (2, 2)를 가정하여 변형된 연산을 적용하는 경우, 채널-확장된 피쳐맵의 크기가 (HI, WI, CI) = (128, 128, 32)가 되고, 채널-확장된 커널의 크기가 (Kh, Kw, Co) = (2, 2, 32)로 변경된다. 이 경우, 변형된 연산은 MPU에서 128*128*32*2*2*32=67,108,864 회의 곱셈 연산이 수행되므로, 연산 횟수가 기존의 원본 연산 대비 55.6% 절감된다. 이는, 하나의 레이어에 대한 연산의 예시이므로, 작은 채널들로 구성되는 신경망 모델들에 대해서는, 모델 내 많은 레이어들의 입출력 피쳐맵의 채널을 확장하여, 채널-확장된 신경망 연산을 수행하므로, 가속기의 성능 이득을 증가시킬 수 있다.As a specific example, in an accelerator with a fixed channel of 32, for a feature map with a feature map size of (H I , W I , C I ) = (256, 256, 8), a kernel size of (K h , Suppose we want to apply a modified operation where K w , C o ) = (3, 3, 8) (assuming the general case where the padding remains the same and stride = 1). In this case, as for the original convolution operation, 256*256*32*3*3*8 = 150,994,944 multiplication operations are performed in the MPU. On the other hand, when the transformed operation is applied assuming (B h , B w ) = (2, 2), the size of the channel-extended feature map is (H I , W I , C I ) = (128, 128 , 32), and the size of the channel-extended kernel is changed to (K h , K w , C o ) = (2, 2, 32). In this case, since 128 * 128 * 32 * 2 * 2 * 32 = 67,108,864 multiplication operations are performed in the MPU, the number of operations is reduced by 55.6% compared to the original operation. Since this is an example of operation for one layer, for neural network models composed of small channels, channels of the input/output feature maps of many layers in the model are expanded to perform channel-extended neural network calculations, so that the accelerator's It can increase the performance gain.

도 9a는 본 개시의 일 실시예에 따른 전자 장치가 수행하는, 채널-확장된 피쳐맵을 출력하는 변형된 연산을 설명하기 위한 도면이다.9A is a diagram for explaining a modified operation of outputting a channel-extended feature map performed by an electronic device according to an embodiment of the present disclosure.

일 실시예에서, 전자 장치(2000)가 원본 입력 피쳐맵(910)에 대하여 원본 신경망 연산을 수행하면, 원본 출력 피쳐맵(920)이 획득될 수 있다.In an embodiment, when the electronic device 2000 performs an original neural network operation on the original input feature map 910, the original output feature map 920 may be obtained.

일 실시예에서, 전자 장치(2000)가 원본 입력 피쳐맵(910)에 대하여 변형된 연산(제1 변형된 연산)을 수행하면, 채널-확장된 출력 피쳐맵(930)이 획득될 수 있다. 여기서, 원본 출력 피쳐맵(920) 및 채널-확장된 출력 피쳐맵(930)은 공간-깊이 변형 연산 또는 깊이-공간 변형 연산을 통해 상호적으로 전환될 수 있다.In an embodiment, when the electronic device 2000 performs a transformed operation (first transformed operation) on the original input feature map 910, a channel-extended output feature map 930 may be obtained. Here, the original output feature map 920 and the channel-extended output feature map 930 may be mutually converted through space-depth transformation operation or depth-space transformation operation.

일 실시예에 따른 전자 장치(2000)가 원본 입력 피쳐맵(910)에 대하여 변형된 연산을 수행하면 채널-확장된 출력 피쳐맵(930)이 획득되므로, 변형된 연산은 공간-깊이 변형 연산이 포함될 수 있다. 또한, 원본 입력 피쳐맵(910)을 이용하여 채널-확장된 출력 피쳐맵(930)을 획득하는 것이므로(즉, 원본 연산과 동일한 값을 얻기 위한 것이므로), 변형된 연산은 신경망 레이어에 대응하는 신경망 연산(예를 들어, 컨볼루션 연산, 요소별 연산 등)을 포함할 수 있다.When the electronic device 2000 according to an embodiment performs a transformed operation on the original input feature map 910, the channel-extended output feature map 930 is obtained, so the transformed operation is a space-depth transformation operation. can be included In addition, since the channel-extended output feature map 930 is acquired using the original input feature map 910 (that is, to obtain the same value as the original operation), the transformed operation is performed by the neural network corresponding to the neural network layer. It may include operations (eg, convolution operations, element-wise operations, etc.).

도 9b는 도 9a를 구체적인 예시를 통해 설명하기 위한 도면이다.FIG. 9B is a diagram for explaining FIG. 9A through a specific example.

일 실시예에서, 신경망 연산이 컨볼루션 연산인 경우, 전자 장치(2000)는 원본 커널(이하, 커널 1)(912)을 변형하여 변형된 커널(이하, 커널 2)(914)를 획득할 수 있다. 여기서, 커널 1(912)은 기존에 학습된 신경망 모델의 커널이며, 커널 2(914)는 원본 입력 피쳐맵(910)에 대하여 원본 컨볼루션 연산과 동일한 값을 획득하면서, 채널-확장된 출력 피쳐맵(930)을 획득하기 위한 커널이다.In an embodiment, when the neural network operation is a convolution operation, the electronic device 2000 may obtain a modified kernel (hereinafter, kernel 2) 914 by modifying an original kernel (hereinafter, kernel 1) 912. there is. Here, Kernel 1 912 is a kernel of a previously trained neural network model, and Kernel 2 914 obtains the same value as the original convolution operation with respect to the original input feature map 910, while channel-extended output feature This is a kernel for obtaining the map 930.

이 경우, 커널 2(914)는 수학식(901)로 표현될 수 있다. 수학식(901)의 구체적인 도출은 아래와 같다.In this case, kernel 2 914 can be expressed as Equation 901. The specific derivation of Equation 901 is as follows.

Given,Given,

IFM depth: Di IFM depth: D i

Original OFM depth: Do Original OFM depth: D o

OFM S2D’s block size: Bh, Bw (height and width respectively)OFM S2D's block size: B h , B w (height and width respectively)

Original convolution:Original convolution:

Stride: STRh1, STRw1 Stride: STR h1 , STR w1

Padding: PADt1, PADb1, PADl1, PADr1 (top, bottom, left and right respectively)Padding: PAD t1 , PAD b1 , PAD l1 , PAD r1 (top, bottom, left and right respectively)

Kernel size: Kh1, Kw1 Kernel size: K h1 , K w1

Kernel data: KER1 as 4D tensor in shape of [Kh1,Kw1,Di,Do]Kernel data: KER 1 as 4D tensor in shape of [K h1 ,K w1 ,D i ,D o ]

Output channel extended convolution can be set as following:Output channel extended convolution can be set as follows:

Stride: STRh2, STRw2 where STRh2=STRh1*Bh, STRw2=STRw1*Bw Stride: STR h2 , STR w2 where STR h2 =STR h1 *B h , STR w2 =STR w1 *B w

Padding: PADt2, PADb2, PADl2, PADr2 where PADt2=PADt1, PADb2=PADb1, PADl2=PADl1, PADr2=PADr1 Padding: PAD t2 , PAD b2 , PAD l2 , PAD r2 where PAD t2 =PAD t1 , PAD b2 =PAD b1 , PAD l2 =PAD l1 , PAD r2 = PAD r1

Kernel size: Kh2, Kw2 where Kh2=Kh1+STRh1*(Bh-1), Kw2=Kw1+STRw1*(Bw-1)Kernel size: K h2 , K w2 where K h2 =K h1 +STR h1 *(B h -1), K w2 =K w1 +STR w1 *(B w -1)

Kernel data: KER2 as 4D tensor in shape of [Kh2,Kw2,Di,Do Bh Bw]Kernel data: KER 2 as 4D tensor in shape of [K h2 ,K w2 ,D i ,D o B h B w ]

Figure pat00001
Figure pat00001

Figure pat00002
Figure pat00002

Figure pat00003
Figure pat00003

도 9c는 본 개시의 일 실시예에 따른 전자 장치가 수행하는, 채널-확장된 피쳐맵을 입력으로 받는 변형된 연산을 설명하기 위한 도면이다.9C is a diagram for explaining a modified operation of receiving a channel-extended feature map as an input, performed by an electronic device according to an embodiment of the present disclosure.

일 실시예에서, 전자 장치(2000)가 원본 입력 피쳐맵(910)에 대하여 원본 신경망 연산을 수행하면, 원본 출력 피쳐맵(920)이 획득될 수 있다.In an embodiment, when the electronic device 2000 performs an original neural network operation on the original input feature map 910, the original output feature map 920 may be obtained.

일 실시예에서, 전자 장치(2000)가 채널-확장된 입력 피쳐맵(940)에 대하여 변형된 연산(제2 변형된 연산)을 수행하면, 원본 출력 피쳐맵(920)이 획득될 수 있다. 여기서, 원본 입력 피쳐맵(910) 및 채널-확장된 입력 피쳐맵(940)은 공간-깊이 변형 연산 또는 깊이-공간 변형 연산을 통해 상호적으로 전환될 수 있다.In an embodiment, when the electronic device 2000 performs a transformed operation (second transformed operation) on the channel-extended input feature map 940, an original output feature map 920 may be obtained. Here, the original input feature map 910 and the channel-extended input feature map 940 may be mutually converted through space-depth transformation operation or depth-space transformation operation.

일 실시예에 따른 전자 장치(2000)가 채널-확장된 입력 피쳐맵(940)에 대하여 변형된 연산을 수행하면 원본 출력 피쳐맵(920)이 획득되므로, 변형된 연산은 깊이-공간 변형 연산이 포함될 수 있다. 또한, 채널-확장된 입력 피쳐맵(940)을 이용하여 원본 출력 피쳐맵(930)을 획득하는 것이므로(즉, 원본 연산과 동일한 값을 얻기 위한 것이므로), 변형된 연산은 신경망 레이어에 대응하는 신경망 연산(예를 들어, 컨볼루션 연산, 요소별 연산 등)을 포함할 수 있다.When the electronic device 2000 according to an embodiment performs a transformed operation on the channel-extended input feature map 940, the original output feature map 920 is obtained, so the transformed operation is a depth-space transformation operation. can be included In addition, since the original output feature map 930 is obtained using the channel-extended input feature map 940 (that is, to obtain the same value as the original operation), the modified operation is performed by the neural network corresponding to the neural network layer. It may include operations (eg, convolution operations, element-wise operations, etc.).

도 9d는 도 9c를 구체적인 예시를 통해 설명하기 위한 도면이다.FIG. 9D is a diagram for explaining FIG. 9C through a specific example.

일 실시예에서, 신경망 연산이 컨볼루션 연산인 경우, 전자 장치(2000)는 원본 커널(이하, 커널 1)(912)을 변형하여 변형된 커널(이하, 커널 2)(914)를 획득할 수 있다. 여기서, 커널 1(912)은 기존에 학습된 신경망 모델의 커널이며, 커널 2(914)는 채널-확장된 입력 피쳐맵(940)에 대하여 원본 컨볼루션 연산과 동일한 값을 획득하면서, 원본 출력 피쳐맵(920)을 획득하기 위한 커널이다.In an embodiment, when the neural network operation is a convolution operation, the electronic device 2000 may obtain a modified kernel (hereinafter, kernel 2) 914 by modifying an original kernel (hereinafter, kernel 1) 912. there is. Here, kernel 1 912 is the kernel of the previously trained neural network model, and kernel 2 914 obtains the same value as the original convolution operation for the channel-extended input feature map 940, and the original output feature. This is a kernel for obtaining the map 920.

이 경우, 커널 2(914)는 수학식(902)로 표현될 수 있다. 수학식(902)의 구체적인 도출은 아래와 같다.In this case, kernel 2 (914) can be expressed as Equation (902). The specific derivation of Equation 902 is as follows.

Given,Given,

Original IFM depth: Di Original IFM depth: D i

IFM S2D’s block size: Bh, Bw (height and width respectively)IFM S2D's block size: B h , B w (height and width respectively)

OFM depth: Do OFM depth: D o

Original convolution:Original convolution:

Stride: STRh1, STRw1 Stride: STR h1 , STR w1

Padding: PADt1, PADb1, PADl1, PADr1 (top, bottom, left and right respectively)Padding: PAD t1 , PAD b1 , PAD l1 , PAD r1 (top, bottom, left and right respectively)

Kernel size: Kh1, Kw1 Kernel size: K h1 , K w1

Kernel data: KER1 as 4D tensor in shape of [Kh1,Kw1,Di,Do]Kernel data: KER 1 as 4D tensor in shape of [K h1 ,K w1 ,D i ,D o ]

(Requirement) Input channel extension for convolution can only be found when:(Requirement) Input channel extension for convolution can only be found when:

Bh divides STRh1 B h divides STR h1

Bw Divides STRw1 B w Divides STR w1

Input channel extended convolution can be set as following:Input channel extended convolution can be set as follows:

Stride: STRh2, STRw2 where STRh2=STRh1/Bh, STRw2=STRw1/Bw Stride: STR h2 , STR w2 where STR h2 =STR h1 /B h , STR w2 =STR w1 /B w

Padding: PADt2, PADb2, PADl2, PADr2 where PADt2=[PADt1/Bh], PADb2=[PADb/Bh], PADl2=[PADl1/Bw], PADr2=[PADr1/Bw]Padding: PAD t2 , PAD b2 , PAD l2 , PAD r2 where PAD t2 =[PAD t1 /B h ], PAD b2 =[PAD b /B h ], PAD l2 =[PAD l1 /B w ], PAD r2 = [PAD r1 /B w ]

Kernel size: Kh2, Kw2 where Kh2=[(Kh1-1-PADt1)/Bh]-[-PADt1/Bh]+1, Kw2=[(Kw1-1-PADl1)/Bw]-[-PADl1/Bw]+1, Kernel size: K h2 , K w2 where K h2 =[(K h1 -1-PAD t1 )/B h ]-[-PAD t1 /B h ]+1, K w2 =[(K w1 -1-PAD l1 )/B w ]-[-PAD l1 /B w ]+1,

Kernel data: KER2 as 4D tensor in shape of [Kh2,Kw2,Di*Bh*Bw,Do]Kernel data: KER 2 as 4D tensor in shape of [K h2 ,K w2 ,D i *B h *B w ,D o ]

Figure pat00004
Figure pat00004

Figure pat00005
,
Figure pat00006
is expression for the least non-negative remainder of division P
Figure pat00007
Q,
Figure pat00005
,
Figure pat00006
is expression for the least non-negative remainder of division P
Figure pat00007
Q,

And,

Figure pat00008
And,
Figure pat00008

도 10은 본 개시의 일 실시예에 따른 전자 장치의 구성을 도시한 블록도이다.10 is a block diagram illustrating the configuration of an electronic device according to an embodiment of the present disclosure.

일 실시예에서, 전자 장치(2000)는 가속기(2100), 메모리(2200) 및 프로세서(2300)를 포함할 수 있다.In one embodiment, the electronic device 2000 may include an accelerator 2100, a memory 2200, and a processor 2300.

일 실시예에 따른 가속기(2100)는 심층 신경망 모델의 심층 신경망 연산을 수행할 수 있다. 가속기(2100)는 예를 들어, CPU(Central Processing Units), GPU(Graphics Processing Units), FPGA(Field-Programmable Gate Arrays), SoC(System-on-Chips), ASIC(Application-Specific Integrated Circuits), VPC(Vision Processing Units), 뉴로모픽 IC 등일 수 있으나, 이에 한정되는 것은 아니다.The accelerator 2100 according to an embodiment may perform a deep neural network operation of a deep neural network model. The accelerator 2100 may include, for example, Central Processing Units (CPUs), Graphics Processing Units (GPUs), Field-Programmable Gate Arrays (FPGAs), System-on-Chips (SoCs), Application-Specific Integrated Circuits (ASICs), It may be vision processing units (VPCs), neuromorphic ICs, etc., but is not limited thereto.

전자 장치(2000)의 가속기(2100)에는 데이터 연산을 처리할 수 있는 곱셈-누산 유닛 (Multiply-accumulate unit; MAC unit)이 포함될 수 있다. 가속기(2100) 사양은 가속기(2100)에 포함되는 MAC 유닛들의 수를 포함한다. 예를 들어, MAC 유닛들의 수가 N개인 경우, 가속기(2100)에서는 N개의 병렬 연산이 수행될 수 있다.The accelerator 2100 of the electronic device 2000 may include a multiply-accumulate unit (MAC unit) capable of processing data operations. Accelerator 2100 specifications include the number of MAC units included in accelerator 2100 . For example, when the number of MAC units is N, the accelerator 2100 may perform N parallel operations.

일 실시예에서, 가속기(2100)는 그 하드웨어 타입에 따라 (예를 들어, CPU 등) 후술하는 프로세서(2300)의 역할을 적어도 일부 수행할 수 있다.In one embodiment, the accelerator 2100 may perform at least part of the role of the processor 2300 to be described later according to its hardware type (eg, CPU, etc.).

메모리(2200)는 전자 장치(2000)를 구동하고 제어하기 위한 다양한 데이터, 프로그램 또는 어플리케이션을 저장할 수 있다. 메모리(2200)에 저장되는 프로그램은 하나 이상의 명령어들을 포함할 수 있다. 메모리(2200)에 저장된 프로그램(하나 이상의 명령어들) 또는 어플리케이션은 프로세서(2300)에 의해 실행될 수 있다.The memory 2200 may store various data, programs, or applications for driving and controlling the electronic device 2000 . A program stored in memory 2200 may include one or more instructions. A program (one or more instructions) or application stored in memory 2200 may be executed by processor 2300 .

메모리(2200)는 플래시 메모리 타입(flash memory type), 하드디스크 타입(hard disk type), 멀티미디어 카드 마이크로 타입(multimedia card micro type), 카드 타입의 메모리(예를 들어 SD 또는 XD 메모리 등)를 포함할 수 있으며, 롬(ROM, Read-Only Memory), EEPROM(Electrically Erasable Programmable Read-Only Memory), PROM(Programmable Read-Only Memory), 자기 메모리, 자기 디스크, 광디스크 중 적어도 하나를 포함하는 비 휘발성 메모리 및 램(RAM, Random Access Memory) 또는 SRAM(Static Random Access Memory)과 같은 휘발성 메모리를 포함할 수 있다.The memory 2200 includes a flash memory type, a hard disk type, a multimedia card micro type, and a card type memory (eg SD or XD memory). Non-volatile memory including at least one of ROM (Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), PROM (Programmable Read-Only Memory), magnetic memory, magnetic disk, and optical disk and volatile memory such as RAM (Random Access Memory) or SRAM (Static Random Access Memory).

일 실시예에 따른 메모리(2200)는 전자 장치(2000)가 신경망 연산을 수행하도록 하는 하나 이상의 인스트럭션 및/또는 프로그램을 저장할 수 있다. 예를 들어, 메모리(2200)에는 연산 변형 모듈(2210), 인공지능 모듈(2220) 및 심층 신경망 모델(2222)이 저장될 수 있다.The memory 2200 according to an embodiment may store one or more instructions and/or programs for allowing the electronic device 2000 to perform a neural network operation. For example, the memory 2200 may store an operation transformation module 2210, an artificial intelligence module 2220, and a deep neural network model 2222.

프로세서(2300)는 전자 장치(2000)를 전반적으로 제어할 수 있다. 프로세서(2300)는 메모리(2200)에 저장되는 하나 이상의 프로그램들을 실행할 수 있다. 프로세서(2300)는 하나 이상일 수 있다.The processor 2300 may control the electronic device 2000 as a whole. The processor 2300 may execute one or more programs stored in the memory 2200. The processor 2300 may be one or more.

본 개시에 따른 하나 이상의 프로세서는 CPU (Central Processing Unit), GPU (Graphics Processing Unit), APU (Accelerated Processing Unit), MIC (Many Integrated Core), DSP (Digital Signal Processor), 및 NPU (Neural Processing Unit) 중 적어도 하나를 포함할 수 있다. 하나 이상의 프로세서는, 하나 이상의 전자부품을 포함하는 집적된 시스템 온 칩(SoC) 형태로 구현될 수 있다. 하나 이상의 프로세서 각각은 별개의 하드웨어(H/W)로 구현될 수도 있다.One or more processors according to the present disclosure include a central processing unit (CPU), a graphics processing unit (GPU), an accelerated processing unit (APU), a many integrated core (MIC), a digital signal processor (DSP), and a neural processing unit (NPU). may include at least one of them. One or more processors may be implemented in the form of an integrated system on a chip (SoC) including one or more electronic components. Each of the one or more processors may be implemented as separate hardware (H/W).

프로세서(2300)는 연산 변형 모듈(2210)을 실행하여, 전자 장치(2000)가 신경망 연산을 변형하도록 할 수 있다. 예를 들어, 프로세서(2300)는 변형된 연산의 적용을 시작할 제1 레이어 및 변형된 연산의 적용을 종료할 제2 레이어를 결정할 수 있다. 프로세서(2300)는 심층 신경망 레이어의 출력의 채널을 확장하기 위한 변형된 연산을 수행할 수 있다. 변형된 연산은 공간-깊이 변형 연산을 포함할 수 있다. 프로세서(2300)는 채널-확장된 입력을 받아 심층 신경망 레이어의 출력의 채널을 축소하기 위한 변형된 연산을 수행할 수 있다. 변형된 연산은 깊이-공간 변형 연산을 포함할 수 있다. 프로세서(2300)는 변형된 연산을 수행하기 위해, 메모리(2200)에 포함되는 RAM 등에 저장된 데이터의 순서를 변경할 수 있다.The processor 2300 may execute the calculation transformation module 2210 to allow the electronic device 2000 to transform the neural network calculation. For example, the processor 2300 may determine a first layer to start applying the transformed operation and a second layer to end the application of the transformed operation. The processor 2300 may perform a modified operation for extending a channel of an output of a deep neural network layer. Transformation operations may include space-depth transformation operations. The processor 2300 may receive a channel-expanded input and perform a modified operation for reducing a channel of an output of a deep neural network layer. Transformation operations may include depth-space transformation operations. The processor 2300 may change the order of data stored in RAM or the like included in the memory 2200 to perform the modified operation.

프로세서(2300)가 연산 변형 모듈(2210)을 실행하여, 피쳐맵의 채널을 확장 또는 축소할 때, 변형된 연산이 피쳐맵의 채널을 확장 또는 축소하는 크기는, 가속기(2100)에 포함되는 MAC 유닛들의 사양에 기초하여 결정될 수 있다. 예를 들어, MAC 유닛의 수가 N개인 경우, 프로세서(2300)는 채널 변형 크기를 N으로 설정할 수 있으나, 이에 한정되는 것은 아니다. When the processor 2300 executes the operation transformation module 2210 to expand or contract a channel of the feature map, the amount by which the transformed operation expands or contracts the channel of the feature map is the MAC included in the accelerator 2100. It can be determined based on the specifications of the units. For example, when the number of MAC units is N, the processor 2300 may set the channel modification size to N, but is not limited thereto.

프로세서(2300)는 인공지능 모듈(2220)을 실행하여, 전자 장치(2000)가 심층 신경망 모델(2222)의 출력을 획득하도록 할 수 있다. 프로세서(2300)는 심층 신경망 모델(2222)의 실행 코드를 실행함으로써, 심층 신경망 모델에서의 출력(예를 들어, 컨볼루션 신경망 모델의 이미지 분류 결과 추론 등)을 획득하기 위한 연산들이 수행되도록 할 수 있다. 이 경우, 심층 신경망 모델(2222)의 연산은 변형된 연산이 적용될 수 있다. 또한, 변형된 연산이 적용된 경우 채널-확장된 신경망 연산이 적용될 수 있다. 이에 대하여는 전술하였으므로, 동일한 설명은 생략하기로 한다. 이 때, 신경망 연산은 가속기(2100)를 이용하여 수행될 수 있다.The processor 2300 may execute the artificial intelligence module 2220 so that the electronic device 2000 obtains an output of the deep neural network model 2222 . The processor 2300 executes the execution code of the deep neural network model 2222 so that operations for obtaining an output from the deep neural network model (eg, image classification result inference of the convolutional neural network model, etc.) may be performed. there is. In this case, a modified operation may be applied to the operation of the deep neural network model 2222 . In addition, when a modified operation is applied, a channel-extended neural network operation may be applied. Since this has been described above, the same description will be omitted. In this case, neural network calculation may be performed using the accelerator 2100 .

본 개시의 일 실시예에 따른 방법이 복수의 동작을 포함하는 경우, 복수의 동작은 하나의 프로세서에 의해 수행될 수도 있고, 복수의 프로세서에 의해 수행될 수도 있다. 예를 들어, 일 실시예에 따른 방법에 의해 제1 동작, 제2 동작, 제3 동작이 수행될 때, 제1 동작, 제2 동작, 및 제3 동작 모두 제1 프로세서에 의해 수행될 수도 있고, 제1 동작 및 제2 동작은 제1 프로세서(예를 들어, 범용 프로세서)에 의해 수행되고 제3 동작은 제2 프로세서(예를 들어, 인공지능 전용 프로세서)에 의해 수행될 수도 있다. 여기서, 제2 프로세서의 예시인 인공지능 전용 프로세서는, 가속기(2100)로 대체될 수도 있다. 그러나, 본 개시의 실시예들이 이에 한정되는 것은 아니다.When a method according to an embodiment of the present disclosure includes a plurality of operations, the plurality of operations may be performed by one processor or a plurality of processors. For example, when the first operation, the second operation, and the third operation are performed by the method according to an embodiment, the first operation, the second operation, and the third operation may all be performed by the first processor, or , The first operation and the second operation may be performed by a first processor (eg, a general-purpose processor), and the third operation may be performed by a second processor (eg, an artificial intelligence processor). Here, the artificial intelligence dedicated processor, which is an example of the second processor, may be replaced by the accelerator 2100. However, embodiments of the present disclosure are not limited thereto.

본 개시에 따른 하나 이상의 프로세서는 싱글 코어 프로세서(single core processor)로 구현될 수도 있고, 멀티 코어 프로세서(multicore processor)로 구현될 수도 있다.One or more processors according to the present disclosure may be implemented as a single core processor or as a multicore processor.

본 개시의 일 실시예에 따른 방법이 복수의 동작을 포함하는 경우, 복수의 동작은 하나의 코어에 의해 수행될 수도 있고, 하나 이상의 프로세서에 포함된 복수의 코어에 의해 수행될 수도 있다.When a method according to an embodiment of the present disclosure includes a plurality of operations, the plurality of operations may be performed by one core or by a plurality of cores included in one or more processors.

본 개시는 신경망 연산을 수행하는 방법에 있어서, 신경망 연산 시 획득되는 입/출력 데이터의 채널을 확장시켜 신경망 연산을 수행함으로써, 신경망 연산을 위한 하드웨어의 효율을 증가시키기 위한 방법을 제공하고자 한다. 다만 본 개시에서 이루고자 하는 기술적 과제는, 이상에서 언급한 것으로 제한되지 않으며, 언급되지 않은 또 다른 기술적 과제들은 본 개시의 기재로부터 본 개시가 속하는 기술분야에서 통상의 지식을 가진 자에게 명확하게 이해될 수 있을 것이다.An object of the present disclosure is to provide a method for increasing the efficiency of hardware for neural network calculation by performing the neural network calculation by extending a channel of input/output data obtained during the neural network calculation. However, the technical problem to be achieved in the present disclosure is not limited to those mentioned above, and other technical problems not mentioned above will be clearly understood by those skilled in the art from the description of the present disclosure. You will be able to.

본 개시의 일 측면에 따르면, 전자 장치가 심층 신경망(Deep Neural Network; DNN) 연산을 수행하는 방법이 제공될 수 있다. 상기 방법은, 상기 심층 신경망의 레이어들 중 제1 레이어로 입력되는 피쳐맵에 대하여 상기 제1 레이어의 출력의 채널을 확장(extend)하는 제1 변형된 연산을 수행하는 단계를 포함할 수 있다. 상기 제1 변형된 연산은, 공간-깊이 변형(space-to-depth transformation) 연산을 포함할 수 있다. 상기 방법은, 상기 제1 레이어 및 제2 레이어 사이의 레이어들에 대응하는 신경망 연산을 채널-확장된 신경망 연산으로 수행하는 단계를 포함할 수 있다. 상기 제2 레이어는, 상기 심층 신경망 내에서 상기 제1 레이어보다 이후의 레이어인 것일 수 있다. 상기 방법은, 상기 제2 레이어로 입력되는 채널-확장된 피쳐맵에 대하여 상기 제2 레이어의 출력의 채널을 축소하는 제2 변형된 연산을 수행할 수 있다. 상기 제2 변형된 연산은, 깊이-공간 변형(depth-to-space transformation) 연산을 포함할 수 있다. 상기 방법은, 상기 심층 신경망의 연산의 결과를 출력하는 단계를 포함할 수 있다.According to one aspect of the present disclosure, a method for performing a deep neural network (DNN) operation by an electronic device may be provided. The method may include performing a first modified operation of extending a channel of an output of the first layer with respect to a feature map input to a first layer among layers of the deep neural network. The first transformed operation may include a space-to-depth transformation operation. The method may include performing a neural network operation corresponding to layers between the first layer and the second layer as a channel-extended neural network operation. The second layer may be a layer subsequent to the first layer in the deep neural network. The method may perform a second modified operation of reducing a channel of an output of the second layer with respect to a channel-extended feature map input to the second layer. The second transformed operation may include a depth-to-space transformation operation. The method may include outputting an operation result of the deep neural network.

제1 변형된 연산 및 상기 제2 변형된 연산의 채널 변형 크기는, 상기 전자 장치에 포함되는 가속기의 MAC 유닛들(Multiply-accumulate units)의 사양에 기초하여 기 설정된 것일 수 있다.Channel modification sizes of the first modified operation and the second modified operation may be preset based on specifications of multiply-accumulate units (MACs) of an accelerator included in the electronic device.

상기 제1 변형된 연산 및 상기 제2 변형된 연산을 적용한 심층 신경망 연산의 출력은, 상기 심층 신경망의 원본(original) 연산 결과와 동일한 것일 수 있다.An output of the deep neural network operation to which the first modified operation and the second modified operation are applied may be the same as an original operation result of the deep neural network.

상기 제1 레이어는, 상기 심층 신경망에 포함되는 레이어들 중 첫번째 레이어일 수 있다. 상기 제2 레이어는, 상기 심층 신경망에 포함되는 레이어들 중 마지막 레이어일 수 있다.The first layer may be a first layer among layers included in the deep neural network. The second layer may be the last layer among layers included in the deep neural network.

상기 제1 레이어 및 제2 레이어 사이의 레이어들에 대응하는 신경망 연산을, 채널-확장된 신경망 연산으로 수행하는 단계는, 채널-확장된 입력 피쳐맵을 이용하여 레이어 연산을 수행하고, 채널-확장된 출력 피쳐맵을 다음 레이어로 전달하는 단계를 포함할 수 있다.In the performing of the neural network operation corresponding to the layers between the first layer and the second layer as a channel-extended neural network operation, layer operation is performed using the channel-extended input feature map, and the channel-extended neural network operation is performed. and passing the resulting output feature map to the next layer.

상기 제1 변형된 연산 및 상기 제2 변형된 연산은, 상기 심층 신경망의 연산 타입에 대응하는 것일 수 있다.The first modified operation and the second modified operation may correspond to an operation type of the deep neural network.

상기 심층 신경망은, 하나 이상의 컨볼루션 레이어를 포함하는 컨볼루션 신경망(Convolutional Neural Network; CNN)인 것일 수 있다.The deep neural network may be a convolutional neural network (CNN) including one or more convolutional layers.

상기 제1 레이어는 컨볼루션 레이어일 수 있다. 상기 제1 변형된 연산을 수행하는 단계는, 상기 컨볼루션 신경망의 상기 제1 레이어의 커널을 변형하는 단계를 포함할 수 있다. 상기 제1 변형된 연산을 수행하는 단계는, 상기 제1 레이어로 입력되는 입력 피쳐맵 및 상기 제1 레이어의 변형된 커널을 이용하여, 채널-확장된 출력 피쳐맵을 획득하는 단계를 더 포함할 수 있다.The first layer may be a convolutional layer. The performing of the first transformed operation may include transforming a kernel of the first layer of the convolutional neural network. The performing of the first transformed operation may further include obtaining a channel-extended output feature map using an input feature map input to the first layer and a transformed kernel of the first layer. can

상기 제2 레이어는 컨볼루션 레이어일 수 있다. 상기 제2 변형된 연산을 수행하는 단계는, 상기 컨볼루션 신경망의 상기 제2 레이어의 커널을 변형하는 단계를 포함할 수 있다. 상기 제2 변형된 연산을 수행하는 단계는, 상기 제2 레이어로 입력되는 상기 채널-확장된 피쳐맵 및 상기 제2 레이어의 변형된 커널을 이용하여, 채널 축소된 출력 피쳐맵을 획득하는 단계를 더 포함할 수 있다.The second layer may be a convolutional layer. The performing of the second transformed operation may include transforming a kernel of the second layer of the convolutional neural network. The performing of the second transformed operation may include obtaining a channel-reduced output feature map using the channel-extended feature map input to the second layer and the transformed kernel of the second layer. can include more.

상기 제1 변형된 연산은 컨볼루션 연산 방식을 적용하는 것을 포함할 수 있다. 상기 제2 변형된 연산은 전치(transposed) 컨볼루션 연산 방식을 적용하는 것을 포함할 수 있다.The first modified operation may include applying a convolution operation method. The second modified operation may include applying a transposed convolution operation method.

한편, 본 개시의 실시예들은 컴퓨터에 의해 실행되는 프로그램 모듈과 같은 컴퓨터에 의해 실행 가능한 명령어를 포함하는 기록 매체의 형태로도 구현될 수 있다. 컴퓨터 판독 가능 매체는 컴퓨터에 의해 액세스 될 수 있는 임의의 가용 매체일 수 있고, 휘발성 및 비휘발성 매체, 분리형 및 비분리형 매체를 모두 포함한다. 또한, 컴퓨터 판독 가능 매체는 컴퓨터 저장 매체 및 통신 매체를 포함할 수 있다. 컴퓨터 저장 매체는 컴퓨터 판독 가능 명령어, 데이터 구조, 프로그램 모듈 또는 기타 데이터와 같은 정보의 저장을 위한 임의의 방법 또는 기술로 구현된 휘발성 및 비휘발성, 분리형 및 비분리형 매체를 모두 포함한다. 통신 매체는 전형적으로 컴퓨터 판독 가능 명령어, 데이터 구조, 또는 프로그램 모듈과 같은 변조된 데이터 신호의 기타 데이터를 포함할 수 있다.Meanwhile, the embodiments of the present disclosure may be implemented in the form of a recording medium including instructions executable by a computer, such as program modules executed by a computer. Computer readable media can be any available media that can be accessed by a computer and includes both volatile and nonvolatile media, removable and non-removable media. Also, computer readable media may include computer storage media and communication media. Computer storage media includes both volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Communication media may typically include computer readable instructions, data structures, or other data in a modulated data signal such as program modules.

또한, 컴퓨터에 의해 읽을 수 있는 저장매체는, 비일시적(non-transitory) 저장매체의 형태로 제공될 수 있다. 여기서, '비일시적 저장매체'는 실재(tangible)하는 장치이고, 신호(signal)(예: 전자기파)를 포함하지 않는다는 것을 의미할 뿐이며, 이 용어는 데이터가 저장매체에 반영구적으로 저장되는 경우와 임시적으로 저장되는 경우를 구분하지 않는다. 예로, '비일시적 저장매체'는 데이터가 임시적으로 저장되는 버퍼를 포함할 수 있다.Also, the computer-readable storage medium may be provided in the form of a non-transitory storage medium. Here, 'non-temporary storage medium' only means that it is a tangible device and does not contain signals (e.g., electromagnetic waves), and this term refers to the case where data is stored semi-permanently in the storage medium and temporary It does not discriminate if it is saved as . For example, a 'non-temporary storage medium' may include a buffer in which data is temporarily stored.

일 실시예에 따르면, 본 문서에 개시된 다양한 실시예들에 따른 방법은 컴퓨터 프로그램 제품(computer program product)에 포함되어 제공될 수 있다. 컴퓨터 프로그램 제품은 상품으로서 판매자 및 구매자 간에 거래될 수 있다. 컴퓨터 프로그램 제품은 기기로 읽을 수 있는 저장 매체(예: compact disc read only memory (CD-ROM))의 형태로 배포되거나, 또는 어플리케이션 스토어를 통해 또는 두개의 사용자 장치들(예: 스마트폰들) 간에 직접, 온라인으로 배포(예: 다운로드 또는 업로드)될 수 있다. 온라인 배포의 경우에, 컴퓨터 프로그램 제품(예: 다운로더블 앱(downloadable app))의 적어도 일부는 제조사의 서버, 어플리케이션 스토어의 서버, 또는 중계 서버의 메모리와 같은 기기로 읽을 수 있는 저장 매체에 적어도 일시 저장되거나, 임시적으로 생성될 수 있다.According to one embodiment, the method according to various embodiments disclosed in this document may be provided by being included in a computer program product. Computer program products may be traded between sellers and buyers as commodities. A computer program product is distributed in the form of a device-readable storage medium (eg compact disc read only memory (CD-ROM)), or through an application store or between two user devices (eg smartphones). It can be distributed (e.g., downloaded or uploaded) directly or online. In the case of online distribution, at least a part of a computer program product (eg, a downloadable app) is stored on a device-readable storage medium such as a memory of a manufacturer's server, an application store server, or a relay server. It can be temporarily stored or created temporarily.

전술한 본 개시의 설명은 예시를 위한 것이며, 본 개시가 속하는 기술분야의 통상의 지식을 가진 자는 본 개시의 기술적 사상이나 필수적인 특징을 변경하지 않고서 다른 구체적인 형태로 쉽게 변형이 가능하다는 것을 이해할 수 있을 것이다. 그러므로 이상에서 기술한 실시예들은 모든 면에서 예시적인 것이며 한정적이 아닌 것으로 이해해야만 한다. 예를 들어, 단일형으로 설명되어 있는 각 구성 요소는 분산되어 실시될 수도 있으며, 마찬가지로 분산된 것으로 설명되어 있는 구성 요소들도 결합된 형태로 실시될 수 있다.The description of the present disclosure described above is for illustrative purposes, and those skilled in the art can understand that it can be easily modified into other specific forms without changing the technical spirit or essential features of the present disclosure. will be. Therefore, the embodiments described above should be understood as illustrative in all respects and not limiting. For example, each component described as a single type may be implemented in a distributed manner, and similarly, components described as distributed may be implemented in a combined form.

본 개시의 범위는 상기 상세한 설명보다는 후술하는 특허청구범위에 의하여 나타내어지며, 특허청구범위의 의미 및 범위 그리고 그 균등 개념으로부터 도출되는 모든 변경 또는 변형된 형태가 본 개시의 범위에 포함되는 것으로 해석되어야 한다.The scope of the present disclosure is indicated by the following claims rather than the detailed description above, and all changes or modifications derived from the meaning and scope of the claims and equivalent concepts should be interpreted as being included in the scope of the present disclosure. do.

Claims (20)

전자 장치가 심층 신경망(Deep Neural Network; DNN) 연산을 수행하는 방법에 있어서,
상기 심층 신경망의 레이어들 중 제1 레이어로 입력되는 피쳐맵에 대하여 상기 제1 레이어의 출력의 채널을 확장(extend)하는 제1 변형된 연산을 수행하되, 상기 제1 변형된 연산은, 공간-깊이 변형(space-to-depth transformation) 연산을 포함하는 것인, 단계(S210);
상기 제1 레이어 및 제2 레이어 사이의 레이어들에 대응하는 신경망 연산을 채널-확장된 신경망 연산으로 수행하되, 상기 제2 레이어는, 상기 심층 신경망 내에서 상기 제1 레이어보다 이후의 레이어인 것인, 단계(S220);
상기 제2 레이어로 입력되는 채널-확장된 피쳐맵에 대하여 상기 제2 레이어의 출력의 채널을 축소하는 제2 변형된 연산을 수행하되, 상기 제2 변형된 연산은, 깊이-공간 변형(depth-to-space transformation) 연산을 포함하는 것인, 단계(S230); 및
상기 심층 신경망의 연산의 결과를 출력하는 단계(S240)를 포함하는, 방법.
A method for an electronic device to perform a deep neural network (DNN) operation,
A first transformed operation of extending a channel of an output of the first layer is performed on a feature map input to a first layer among the layers of the deep neural network, and the first transformed operation is performed on a spatial- Step (S210) comprising a space-to-depth transformation operation;
The neural network operation corresponding to the layers between the first layer and the second layer is performed as a channel-extended neural network operation, wherein the second layer is a layer later than the first layer in the deep neural network , step (S220);
A second transformed operation for reducing a channel of an output of the second layer is performed on the channel-extended feature map input to the second layer, wherein the second transformed operation is performed in depth-space transformation (depth-space transformation). to-space transformation) operation, step (S230); and
And outputting a result of the operation of the deep neural network (S240).
제1항에 있어서,
제1 변형된 연산 및 상기 제2 변형된 연산의 채널 변형 크기는,
상기 전자 장치에 포함되는 가속기의 MAC 유닛들(Multiply-accumulate units)의 사양에 기초하여 기 설정된 것인, 방법.
According to claim 1,
The channel transformation magnitudes of the first transformed operation and the second transformed operation are
Method that is preset based on specifications of MAC units (Multiply-accumulate units) of an accelerator included in the electronic device.
제1항 내지 제2항 중 어느 한 항에 있어서,
상기 제1 변형된 연산 및 상기 제2 변형된 연산을 적용한 심층 신경망 연산의 출력은,
상기 심층 신경망의 원본(original) 연산 결과와 동일한 것인, 방법.
According to any one of claims 1 to 2,
The output of the deep neural network operation to which the first modified operation and the second modified operation are applied,
The same as the original operation result of the deep neural network.
제1항 내지 제3항 중 어느 한 항에 있어서,
상기 제1 레이어는, 상기 심층 신경망에 포함되는 레이어들 중 첫번째 레이어이고,
상기 제2 레이어는, 상기 심층 신경망에 포함되는 레이어들 중 마지막 레이어인, 방법.
According to any one of claims 1 to 3,
The first layer is a first layer among layers included in the deep neural network,
The second layer is the last layer among the layers included in the deep neural network.
제1항 내지 제4항 중 어느 한 항에 있어서,
상기 제1 레이어 및 제2 레이어 사이의 레이어들에 대응하는 신경망 연산을, 채널-확장된 신경망 연산으로 수행하는 단계는,
채널-확장된 입력 피쳐맵을 이용하여 레이어 연산을 수행하고, 채널-확장된 출력 피쳐맵을 다음 레이어로 전달하는 단계를 포함하는, 방법.
According to any one of claims 1 to 4,
The step of performing the neural network operation corresponding to the layers between the first layer and the second layer as a channel-extended neural network operation,
A method comprising performing a layer operation using a channel-extended input feature map and passing the channel-extended output feature map to a next layer.
제1항 내지 제5항 중 어느 한 항에 있어서,
상기 제1 변형된 연산 및 상기 제2 변형된 연산은,
상기 심층 신경망의 연산 타입에 대응하는 것인, 방법.
According to any one of claims 1 to 5,
The first modified operation and the second modified operation,
Corresponding to the operation type of the deep neural network.
제1항 내지 제6항 중 어느 한 항에 있어서,
상기 심층 신경망은, 하나 이상의 컨볼루션 레이어를 포함하는 컨볼루션 신경망(Convolutional Neural Network; CNN)인 것인, 방법.
According to any one of claims 1 to 6,
The deep neural network is a convolutional neural network (CNN) including one or more convolutional layers.
제7항에 있어서,
상기 제1 레이어는 컨볼루션 레이어이고,
상기 제1 변형된 연산을 수행하는 단계는,
상기 컨볼루션 신경망의 상기 제1 레이어의 커널을 변형하는 단계; 및
상기 제1 레이어로 입력되는 입력 피쳐맵 및 상기 제1 레이어의 변형된 커널을 이용하여, 채널-확장된 출력 피쳐맵을 획득하는 단계를 포함하는, 방법.
According to claim 7,
The first layer is a convolution layer,
Performing the first modified operation,
transforming a kernel of the first layer of the convolutional neural network; and
and obtaining a channel-extended output feature map using an input feature map input to the first layer and a modified kernel of the first layer.
제7항 내지 제8항 중 어느 한 항에 있어서,
상기 제2 레이어는 컨볼루션 레이어이고,
상기 제2 변형된 연산을 수행하는 단계는,
상기 컨볼루션 신경망의 상기 제2 레이어의 커널을 변형하는 단계; 및
상기 제2 레이어로 입력되는 상기 채널-확장된 피쳐맵 및 상기 제2 레이어의 변형된 커널을 이용하여, 채널 축소된 출력 피쳐맵을 획득하는 단계를 포함하는, 방법.
According to any one of claims 7 to 8,
The second layer is a convolution layer,
The step of performing the second modified operation,
transforming a kernel of the second layer of the convolutional neural network; and
and obtaining a channel-reduced output feature map using the channel-extended feature map input to the second layer and a modified kernel of the second layer.
제7항 내지 제9항 중 어느 한 항에 있어서,
상기 제1 변형된 연산은 컨볼루션 연산 방식을 적용하는 것을 포함하고,
상기 제2 변형된 연산은 전치(transposed) 컨볼루션 연산 방식을 적용하는 것을 포함하는, 방법.
According to any one of claims 7 to 9,
The first modified operation includes applying a convolution operation method,
Wherein the second transformed operation comprises applying a transposed convolution operation scheme.
심층 신경망(Deep Neural Network; DNN) 연산을 수행하는 전자 장치(2000)에 있어서,
가속기(2100);
하나 이상의 인스트럭션을 저장하도록 구성된 메모리(2200); 및
상기 메모리(2200)에 저장된 상기 하나 이상의 인스트럭션을 실행하는 적어도 하나의 프로세서(2300)를 포함하고,
상기 적어도 하나의 프로세서(2300)는, 상기 하나 이상의 인스트럭션을 실행함으로써,
상기 심층 신경망의 레이어들 중 제1 레이어로 입력되는 피쳐맵에 대하여 상기 제1 레이어의 출력의 채널을 확장(extend)하는 제1 변형된 연산을 수행하되, 상기 제1 변형된 연산은, 공간-깊이 변형(space-to-depth transformation) 연산을 포함하고,
상기 가속기(2100)를 이용하여, 상기 제1 레이어 및 제2 레이어 사이의 레이어들에 대응하는 신경망 연산을 채널-확장된 신경망 연산으로 수행하되, 상기 제2 레이어는, 상기 심층 신경망 내에서 상기 제1 레이어보다 이후의 레이어인 것이며,
상기 제2 레이어로 입력되는 채널-확장된 피쳐맵에 대하여 상기 제2 레이어의 출력의 채널을 축소하는 제2 변형된 연산을 수행하되, 상기 제2 변형된 연산은, 깊이-공간 변형(depth-to-space transformation) 연산을 포함하는 것이고,
상기 심층 신경망의 연산의 결과를 출력하는, 전자 장치.
In an electronic device 2000 that performs a deep neural network (DNN) operation,
accelerator 2100;
memory 2200 configured to store one or more instructions; and
at least one processor (2300) to execute the one or more instructions stored in the memory (2200);
The at least one processor 2300, by executing the one or more instructions,
A first transformed operation of extending a channel of an output of the first layer is performed on a feature map input to a first layer among the layers of the deep neural network, and the first transformed operation is performed on a spatial- Include a space-to-depth transformation operation,
Using the accelerator 2100, a neural network operation corresponding to layers between the first layer and the second layer is performed as a channel-extended neural network operation, and the second layer is the first layer in the deep neural network. It is a layer after layer 1,
A second transformed operation for reducing a channel of an output of the second layer is performed on the channel-extended feature map input to the second layer, wherein the second transformed operation is performed in depth-space transformation (depth-space transformation). to-space transformation) operation,
An electronic device that outputs a result of an operation of the deep neural network.
제11항에 있어서,
제1 변형된 연산 및 상기 제2 변형된 연산의 채널 변형 크기는,
상기 전자 장치에 포함되는 가속기의 MAC 유닛들(Multiply-accumulate units)의 사양에 기초하여 기 설정된 것인, 전자 장치.
According to claim 11,
The channel transformation magnitudes of the first transformed operation and the second transformed operation are
An electronic device that is preset based on specifications of multiply-accumulate units (MACs) of an accelerator included in the electronic device.
제11항 내지 제12항 중 어느 한 항에 있어서,
상기 제1 변형된 연산 및 상기 제2 변형된 연산을 적용한 상기 심층 신경망 연산의 출력은,
상기 심층 신경망의 원본(original) 연산 결과와 동일한 것인, 전자 장치.
According to any one of claims 11 to 12,
The output of the deep neural network operation to which the first modified operation and the second modified operation are applied,
The electronic device, which is the same as the original operation result of the deep neural network.
제11항 내지 제13항 중 어느 한 항에 있어서,
상기 제1 레이어는, 상기 심층 신경망에 포함되는 레이어들 중 첫번째 레이어이고,
상기 제2 레이어는, 상기 심층 신경망에 포함되는 레이어들 중 마지막 레이어인, 전자 장치.
According to any one of claims 11 to 13,
The first layer is a first layer among layers included in the deep neural network,
The second layer is the last layer among the layers included in the deep neural network.
제11항 내지 제14항 중 어느 한 항에 있어서,
상기 적어도 하나의 프로세서는, 상기 하나 이상의 인스트럭션을 실행함으로써,
상기 가속기를 이용하여 상기 채널-확장된 신경망 연산이 수행될 때, 채널-확장된 입력 피쳐맵을 이용하여 레이어 연산을 수행하고, 채널-확장된 출력 피쳐맵을 다음 레이어로 전달하는, 전자 장치.
According to any one of claims 11 to 14,
The at least one processor, by executing the one or more instructions,
When the channel-extended neural network operation is performed using the accelerator, layer operation is performed using the channel-extended input feature map, and the channel-extended output feature map is passed to the next layer.
제11항 내지 제15항 중 어느 한 항에 있어서,
상기 제1 변형된 연산 및 상기 제2 변형된 연산은,
상기 심층 신경망의 연산 타입에 대응하는 것인, 전자 장치.
According to any one of claims 11 to 15,
The first modified operation and the second modified operation,
Corresponding to the operation type of the deep neural network, the electronic device.
제11항 내지 제16항 중 어느 한 항에 있어서,
상기 심층 신경망은, 하나 이상의 컨볼루션 레이어를 포함하는 컨볼루션 신경망(Convolutional Neural Network; CNN)인 것인, 전자 장치.
According to any one of claims 11 to 16,
The deep neural network is a convolutional neural network (CNN) including one or more convolutional layers, the electronic device.
제17항에 있어서,
상기 제1 레이어는 컨볼루션 레이어이고,
상기 적어도 하나의 프로세서는, 상기 하나 이상의 인스트럭션을 실행함으로써,
상기 컨볼루션 신경망의 상기 제1 레이어의 커널을 변형하고,
상기 제1 레이어로 입력되는 입력 피쳐맵 및 상기 제1 레이어의 변형된 커널을 상기 가속기에 적용하여, 채널-확장된 출력 피쳐맵을 획득하는, 전자 장치.
According to claim 17,
The first layer is a convolution layer,
The at least one processor, by executing the one or more instructions,
transforming the kernel of the first layer of the convolutional neural network;
The electronic device of claim 1, wherein a channel-extended output feature map is obtained by applying an input feature map input to the first layer and a modified kernel of the first layer to the accelerator.
제17항 내지 제18항 중 어느 한 항에 있어서,
상기 제2 레이어는 컨볼루션 레이어이고,
상기 적어도 하나의 프로세서는, 상기 하나 이상의 인스트럭션을 실행함으로써,
상기 컨볼루션 신경망의 상기 제2 레이어의 커널을 변형하고,
상기 제2 레이어로 입력되는 상기 채널-확장된 피쳐맵 및 상기 제2 레이어의 변형된 커널을 상기 가속기에 적용하여, 채널 축소된 출력 피쳐맵을 획득하는, 전자 장치.
According to any one of claims 17 to 18,
The second layer is a convolution layer,
The at least one processor, by executing the one or more instructions,
transforming the kernel of the second layer of the convolutional neural network;
and obtaining a channel-reduced output feature map by applying the channel-extended feature map input to the second layer and the modified kernel of the second layer to the accelerator.
제1항 내지 제10항 중 어느 한 항의 방법을 컴퓨터에서 실행시키기 위한 프로그램을 기록한 컴퓨터로 읽을 수 있는 기록매체. A computer-readable recording medium recording a program for executing the method of any one of claims 1 to 10 in a computer.
KR1020220115794A 2021-10-26 2022-09-14 Method and electronic device for performing deep neural network operations KR20230059718A (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
KR1020220129039A KR20230059726A (en) 2021-10-26 2022-10-07 Method and electronic device for performing deep neural network operations
PCT/KR2022/016375 WO2023075372A1 (en) 2021-10-26 2022-10-25 Method and electronic device for performing deep neural network operation
US18/078,199 US20230129845A1 (en) 2021-10-26 2022-12-09 Method and electronic device for performing deep neural network operation

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
KR20210143993 2021-10-26
KR1020210143993 2021-10-26

Publications (1)

Publication Number Publication Date
KR20230059718A true KR20230059718A (en) 2023-05-03

Family

ID=86381120

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020220115794A KR20230059718A (en) 2021-10-26 2022-09-14 Method and electronic device for performing deep neural network operations

Country Status (1)

Country Link
KR (1) KR20230059718A (en)

Similar Documents

Publication Publication Date Title
JP7021904B2 (en) Convolutional neuropil processing method and equipment
CN111476360A (en) Apparatus and method for Winograd transform convolution operation of neural network
CN111338695B (en) Data processing method based on pipeline technology and related product
US10956535B2 (en) Operating a neural network defined by user code
CN111382859A (en) Method and apparatus for processing convolution operations in a neural network
US11921822B2 (en) Image processing device for improving details of an image, and operation method of the same
US10755169B2 (en) Hybrid non-uniform convolution transform engine for deep learning applications
US11562046B2 (en) Neural network processor using dyadic weight matrix and operation method thereof
EP4024290A1 (en) Implementing fully-connected neural-network layers in hardware
JP7414930B2 (en) Information processing device, information processing method
JP6955598B2 (en) Parallel extraction method of image data in multiple convolution windows, devices, equipment and computer readable storage media
US11380081B2 (en) Image processing apparatus and operating method of the same
US11900577B2 (en) Processing apparatus for performing processing using a convolutional neural network
US20210287070A1 (en) Data processing apparatus, data processing method, and non-transitory computer-readable storage medium
KR20230059718A (en) Method and electronic device for performing deep neural network operations
EP4083874A1 (en) Image processing device and operating method therefor
CN111507456A (en) Method and apparatus with convolutional neural network processing
KR20230059726A (en) Method and electronic device for performing deep neural network operations
WO2023122896A1 (en) Data processing method and apparatus
US20230129845A1 (en) Method and electronic device for performing deep neural network operation
CN110930290B (en) Data processing method and device
CN111723917B (en) Operation method, device and related product
CN110610227B (en) Artificial neural network adjusting method and neural network computing platform
CN113902088A (en) Method, device and system for searching neural network structure
CN113821471A (en) Processing method of neural network and electronic device