WO2023053222A1 - データ変換装置、データ変換方法、及びプログラムが格納された非一時的なコンピュータ可読媒体 - Google Patents

データ変換装置、データ変換方法、及びプログラムが格納された非一時的なコンピュータ可読媒体 Download PDF

Info

Publication number
WO2023053222A1
WO2023053222A1 PCT/JP2021/035710 JP2021035710W WO2023053222A1 WO 2023053222 A1 WO2023053222 A1 WO 2023053222A1 JP 2021035710 W JP2021035710 W JP 2021035710W WO 2023053222 A1 WO2023053222 A1 WO 2023053222A1
Authority
WO
WIPO (PCT)
Prior art keywords
node
nodes
data
layer
input
Prior art date
Application number
PCT/JP2021/035710
Other languages
English (en)
French (fr)
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 JP2023550805A priority Critical patent/JPWO2023053222A5/ja
Priority to PCT/JP2021/035710 priority patent/WO2023053222A1/ja
Publication of WO2023053222A1 publication Critical patent/WO2023053222A1/ja

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
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Definitions

  • the present disclosure relates to a data conversion device, a data conversion method, and a non-transitory computer-readable medium storing a program.
  • CNN deep neural networks
  • CNNs Convolutional Neural Networks
  • RNNs recurrent neural networks
  • DNN By training on a large server with a large amount of training data, DNN can achieve higher recognition compared to non-DNN methods.
  • DNN inference requires real-time processing in environments with limited power such as edge devices and mobile terminals.
  • ASIC Application Specific Integrated Circuit
  • GPUs Graphics Processing Units
  • CPUs Central Processing Units
  • Non-Patent Document 1 proposed a systolic array for RNN.
  • the technique described in this paper reduces the number of memory accesses to the weights by changing the computation order in the MV product (Matrix Vector product) of two times at adjacent times t and t+1. 2.1 times faster than without this technology.
  • the technique described in Non-Patent Document 2 reduces the number of sum-of-products operations by skipping the multiplication of the zero values of the vector elements and the weights, thereby achieving faster processing.
  • Non-Patent Document 3 and Non-Patent Document 4 report the speeding up of computation in the RNN layer in general-purpose GPUs and CPUs.
  • RNN requires processing of a huge number of RNN layers and FC layers (Fully Connected Layers).
  • the RNN layer and FC layer are composed of MV products, and in order to process the neural network including these layers in real time, it is necessary to speed up the calculation of the MV products.
  • the problem is that with existing ASIC devices and GPUs for neural networks, the execution efficiency of the MV product is worse than that of the MM product (Matrix Matrix product), and it is difficult to execute a large amount of MV products at high speed. That's what it means.
  • Many existing GPUs and ASIC devices are specialized for MM multiplication, and assuming a sufficiently large matrix as input, the time required for memory access to refer to the weights is the time required for the sum of products of the input matrix and the weights. designed to be much smaller than
  • the MV product is a small one-dimensional vector, unlike the MM product, where the input data are small. Therefore, the time required for memory access to frequently occurring weight matrices becomes longer than the time required for the sum-of-products operation between the input vector and the weight matrix.
  • Non-Patent Document 1 and Non-Patent Document 2 are proposals for RNN-dedicated circuits and cannot be applied to widely used DNN devices. Also, since the circuits described in these documents are dedicated to the RNN layer, they cannot be implemented for the FC layer or the convolutional layer without additional circuit modifications.
  • Non-Patent Document 3 and Non-Patent Document 4 report speeding up of computation of the RNN layer in general-purpose GPUs and CPUs. However, these studies focus on high-speed methods (such as tiling on devices) for servers with high power consumption and large memory. For this reason, it is difficult to apply such speed-up methods to ASIC devices, which accept only instructions for executing basic convolutional layers and FC layers, and have difficulty handling detailed instructions such as memory control.
  • a data conversion device includes: structural data acquisition means for acquiring structural data, which is data representing the structure of the neural network; node extracting means for extracting a plurality of nodes for matrix-vector multiplication from the structural data; a conversion means for converting the plurality of extracted nodes into convolutional layer nodes; and structural data output means for outputting the converted structural data.
  • Acquire structural data which is data representing the structure of the neural network, extracting a plurality of nodes for matrix-vector multiplication from the structural data; Transform the extracted nodes into convolutional layer nodes, Output the converted structural data.
  • a program according to the third aspect of the present disclosure, a structural data acquisition step of acquiring structural data, which is data representing the structure of the neural network; a node extraction step of extracting a plurality of nodes for matrix-vector multiplication from the structural data; a transformation step of transforming the extracted plurality of nodes into convolutional layer nodes; and a structural data output step of outputting the converted structural data.
  • FIG. 4 is a schematic diagram for explaining a calculation method of a convolutional layer;
  • FIG. 4 is a schematic diagram for explaining a calculation method of an FC layer;
  • 1 is a block diagram showing an example of a configuration of a data conversion device according to Embodiment 1;
  • FIG. 4 is a table showing an example of structural data of a neural network including two FC layers;
  • FIG. 5 is a schematic diagram showing a connection relationship of nodes represented by the structure data shown in FIG. 4;
  • FIG. 4 is a table showing an example of structural data of a neural network including two RNN layers (LSTM layers);
  • FIG. 7 is a schematic diagram showing a connection relationship of nodes represented by the structure data shown in FIG. 6;
  • FIG. 7 is a table showing an example of structural data representing the structure of a neural network after decomposition processing has been performed on the neural network represented by the structural data shown in FIG. 6;
  • FIG. FIG. 9 is a schematic diagram showing a connection relationship of nodes represented by the structure data shown in FIG. 8;
  • FIG. 10 is a table showing an example of structural data generated by the MV product transforming unit for a neural network from which a set of two FC layers is extracted;
  • FIG. FIG. 11 is a schematic diagram showing a connection relationship of nodes represented by the structure data shown in FIG. 10;
  • FIG. 10 is a table showing an example of structural data generated by the MV product transformation unit for a neural network from which a set of two LSTM layers is extracted;
  • FIG. 13 is a schematic diagram showing a connection relationship of nodes represented by the structure data shown in FIG. 12; 4 is a flow chart showing an operation example of the data conversion device according to the first exemplary embodiment; 2 is a block diagram showing an example of the hardware configuration of the data conversion device according to the first exemplary embodiment;
  • FIG. 1 is a schematic diagram showing an example of the structure of a neural network comprising a first set of FC layers and a second set of FC layers connected in series with the first set;
  • FIG. 17 is a schematic diagram showing an example of a structure after conversion for the structure shown in FIG. 16;
  • 2 is a block diagram showing an example of the configuration of a data conversion device according to a second embodiment;
  • a CNN mainly includes a convolutional layer and a fully connected layer (FC layer). Also, the RNN mainly includes an RNN layer and an FC layer. First, the calculation method of the convolution layer will be described with reference to FIG.
  • FIG. 1 is a schematic diagram illustrating a method of calculating a convolutional layer.
  • the batch size is 1, the height of the input data and the height of the output data are the same size H, and their widths are the same size W will be explained.
  • M is the number of input data channels
  • N is the number of output data channels
  • k is the kernel size
  • b is the bias value.
  • N weighting filters and input data are convoluted, a bias value is added to the result, and a nonlinear activation function f act is applied. .
  • convolution is realized by converting the input data and weights into two-dimensional matrices and calculating the matrix-matrix product (MM product) between the two-dimensional matrices.
  • MM product matrix-matrix product
  • the convolution layer can be expressed by adding the MM product of the two-dimensional input matrix D and the two-dimensional weight matrix F, the bias value, and the calculation of the nonlinear activation function f act .
  • the weight matrix F is a one-dimensional vector of weight filters
  • the convolutional layer consists of the previously mentioned input matrix D, weight matrix F, bias values , using a nonlinear activation function f act , can be defined as in the following equation (1).
  • f act a ReLU (Rectified Linear Unit) function or the like is generally used.
  • FIG. 2 is a schematic diagram for explaining the calculation method of the FC layer.
  • the convolution of the two-dimensional weights and the one-dimensional input vector d is calculated, the bias is added to the result, and the nonlinear activation function f act is applied.
  • Convolution in the FC layer is equivalent to the matrix-vector product (MV product).
  • the FC layer is represented by the following equation (2) using an input vector d, a weight matrix F, a bias value b, and a nonlinear activation function f act (see the lower diagram in FIG. 2).
  • d[i] is the i-th element d i of the input vector
  • r[i] is the i-th element r i of the output vector.
  • the LSTM layer (Long Short-term Memory), which is a type of RNN layer.
  • the LSTM layer is represented by the following formulas (3) to (5).
  • the element operation is an operation performed independently for each element of the tensor, and means an operation other than the MV product and the MM product.
  • the element operations are the sigmoid function ⁇ , the hyperbolic tangent function tanh, the element-wise product, and the element-wise sum.
  • Equation (3) the matrix F cat of 4Q rows and P+Q columns that concatenates the input weights F 0 , . . . , F 3 and the recurrent weights G 0 , .
  • Equation (7) the calculation of the LSTM layer in Equation (3) is expressed as in Equation (7) below, using vector b' in which vector x't with the number of elements P+Q and bias values b 0 to b 3 are concatenated. can be done.
  • Fcat, x' t , and b' are represented by the following equation (6).
  • Equation (8) Equation (8)
  • structural data is data that represents the structure of a neural network, and more specifically, data that defines the connection relationship between nodes of the neural network and the processing content of each node.
  • FIG. 4 shows an example of structural data of a neural network including two FC layers.
  • FIG. 5 is a schematic diagram showing the connection relationship of nodes represented by the structure data shown in FIG.
  • FIG. 6 shows an example of structural data of a neural network including two RNN layers (LSTM layers).
  • FIG. 7 is a schematic diagram showing the connection relationship of nodes represented by the structure data shown in FIG.
  • the three inputs (input 0, input 1 , input 2 ) of the node of the LSTM layer in FIG. , two outputs (output 0, output 1) indicate the output vector h t and the internal state c t in turn.
  • An operator name is information for specifying an operation to be executed at a node, and indicates the type of operation used at that node.
  • the operator name in the structural data is read, and the read operator name corresponds to this operator name. converted to machine language.
  • the conversion of structural data by the data conversion device 100 is a modification of the neural network structure with a high degree of abstraction, and does not change the implementation of the operator itself. Therefore, the conversion result by the data conversion device 100 can be applied to any device, such as a CPU, GPU, or ASIC, which uses completely different machine languages.
  • the input node number indicates the connection relationship on the input side.
  • the input node number is information indicating which output of which node for each input to the node. For example, if the input node numbers indicated in the structure data are "x1:y1, x2:y2", the 0th input is connected to the y1th output of the node with node number x1, and the 1st input is Indicates that it is connected to the y2-th output of the node with node number x2.
  • Attribute information includes parameters, input shapes, and output shapes.
  • the parameters of the attribute information indicate parameters necessary for calculation, such as weights, bias values, and kernel sizes (when convolutional layer calculations are performed). That is, the parameter of attribute information is a parameter for calculation.
  • the weight IDs and bias value IDs in FIGS. 4 and 6 are file or memory pointer addresses in which the weight parameters F and F cat and the bias parameters b and b′ are stored. Referenced when the LSTM layer or FC layer is computed on the device.
  • a parameter f_act in FIG. 4 represents the type of activation function.
  • the input shape indicates the shape of the data input to the node
  • the output shape indicates the shape of the data output from the node.
  • the shape of data to be input or output is the shape of data as a tensor.
  • the input shape in the attribute information is information indicating the shape of data for each input to the node
  • the output shape in the attribute information is information indicating the shape of data for each output from the node. For example, if the input (output) shape shown in the structure data is "x':y'", it indicates that the x'-th input (output) data shape of the node is y'.
  • the notation of shapes in this paper will be explained.
  • '(x')' represents a vector with x' number of elements
  • '(y',x')' represents a two-dimensional matrix with y' rows and x' columns
  • '(z' ,y',x')" represents a tensor with number of channels z', height y' and width x'.
  • the input shape “0:(512)” shown in FIG. 4 indicates that the 0th input is a one-dimensional vector with 512 elements.
  • the node extraction unit 101 extracts, from the input structure data 91, a plurality of nodes that satisfy predetermined conditions and are nodes for matrix-vector multiplication. Specifically, the node extraction unit 101 extracts a set of two or more RNN layers (or FC layers) that satisfy all of the following three conditions. That is, the node extraction unit 101 extracts a set of multiple RNN layers that satisfy conditions 1 to 3 below. Alternatively, the node extraction unit 101 extracts a set consisting of a plurality of FC layers that satisfy conditions 1 to 3 below.
  • Condition 1 In each RNN layer (or FC layer), the number of mutually corresponding input vector elements is the same, and the number of mutually corresponding output vector elements is also the same.
  • the mutually corresponding input vector (output vector) is the i-th input vector (output vector) in the first RNN layer (FC layer) and the i-th input vector in the second RNN layer (FC layer).
  • Condition 2 The weights and bias values used in each RNN layer (or FC layer) are the same.
  • Condition 3 There is no input/output dependency in each RNN layer (or FC layer).
  • the number of input and output elements corresponding to each other is the same (that is, condition 1 is satisfied), and the same weight (ID: 1) and the same bias (ID: 2) are used.
  • Two FC layers nodes 10 and 11 are extracted (that is, satisfies condition 2).
  • the number of input and output elements corresponding to each other is the same (that is, condition 1 is satisfied), and the same weight (ID: 1) and the same bias (ID: 2) are used.
  • Two LSTM layers (nodes 10, 11) are extracted (ie, satisfying condition 2).
  • the nodes 10 and 11 satisfy condition 3 described above.
  • Condition 3 is a condition that requires that the output of the extracted node is not directly or indirectly connected to the input of another extracted node.
  • the node extraction unit 101 recursively repeats the search for child nodes for each node that satisfies condition 1 and condition 2, and confirms that the node is not connected to the input of another node that satisfies condition 1 and condition 2. .
  • the node extraction unit 101 sequentially searches for child nodes, grandchild nodes, etc. of the node 10 and confirms that the output of the node 10 is not connected to the input of the node 11 .
  • the node extraction unit 101 sequentially searches for child nodes, grandchild nodes, etc.
  • d l and r l are the input vector d and output vector r of the node identified by index l (l represents the letter ell).
  • the weight matrix F and the bias value b used in the extracted nodes are the same regardless of l. This corresponds to condition 2 being satisfied.
  • x l,t , h l,t , c l,t indicates the input vector x t , output vector h t , and internal state c t of the node identified by index l.
  • x' l,t , m l,t , g i,l,t is a vector that stores the temporary calculation result of the calculation process
  • x' l,t is a vector that concatenates the input vector and the output vector
  • m l,t is the sum of products operation and bias addition
  • g 0,l,t to g 3,l,t represent vectors obtained by dividing m l,t by the number of elements Q.
  • the node decomposition unit 102 divides the extracted nodes of the RNN layer into the first type nodes that are matrix-vector multiplication nodes and the nodes other than the matrix-vector multiplication nodes. and a node of the second kind. That is, when the L nodes extracted by the node extraction unit 101 are RNN layer nodes, the node decomposition unit 102 executes the RNN layer node decomposition processing described below. Therefore, when the node extraction unit 101 extracts the nodes of the fully connected layer (FC layer), the node decomposition unit 102 may be omitted in the data conversion device 100 .
  • the node decomposition unit 102 divides each of the plurality of RNN layer nodes that satisfy the conditions 1 to 3 described above into MV product nodes (first type nodes) and other computation nodes (second type nodes). nodes).
  • the number of nodes and operator names after node decomposition processing differ depending on the type of RNN layer.
  • each node extracted by the node extraction unit 101 includes the MV product node shown in Equation (12) and the other operations (elements operation) nodes.
  • the computation represented by Equation (12) is the same as the computation of the FC layer when the identity function is used as fact . Therefore, it should be explained that the node decomposition unit 102 decomposes the nodes extracted by the node extraction unit 101 into nodes that perform elemental operations and nodes of fully connected layers that use identity functions as nonlinear activation functions. can also
  • the node decomposition unit 102 generates structural data representing the structure of the neural network after decomposition processing from the input structural data 91 .
  • FIG. 8 shows an example of structural data representing the structure of the neural network after performing decomposition processing on the neural network represented by the structural data shown in FIG.
  • FIG. 9 is a schematic diagram showing the connection relationship of the nodes represented by the structure data shown in FIG. Note that the numbers of the new nodes replaced by the decomposition are chosen so as not to duplicate the numbers of other nodes.
  • the concatenation processing performed at the nodes 10-1 and 11-1 in FIGS. 8 and 9 corresponds to the above-mentioned formula (11).
  • the FC layer processing performed at nodes 10-2 and 11-2 corresponds to equation (12) above, that is, MV product and bias addition.
  • the division processing performed by the nodes 10-3 and 11-3 corresponds to the above-described equation (13).
  • the element operation processing performed at the nodes 10-4 and 11-4 corresponds to the above equation (14), and the element operation processing performed at the nodes 10-5 and 11-5 corresponds to the above equation (15).
  • the node decomposition unit 102 decomposes the nodes of the RNN layer into the following type 1 nodes and type 2 nodes. That is, in this case, the nodes of the first kind are the nodes 10-2 and 11-2 of the FC layer (fully connected layer) using the identity function as the nonlinear activation function.
  • the nodes of the second type are connection nodes 10-1 and 11-1, which are the preceding nodes of the FC layer nodes and connect data, and the following nodes of the FC layer nodes, which divide the data. These are split nodes 10-3 and 11-3, and element operation nodes 10-4, 11-4, 10-5 and 11-5 which are subsequent nodes of the split nodes and perform predetermined operations.
  • Node 10-1 is a node to which part of the input to node 10 of the LSTM layer (specifically, two inputs of x t and h t-1 ) is input, and a concatenation that concatenates the input vectors process. dim: 0 described in the parameter of the concatenation process in FIG.
  • the node 10-2 is a node to which the output of the node 10-1 that performs the concatenation process is input, and performs the FC layer process using the identity function as the nonlinear activation function on the input vector. Since equation (12) is expressed as an FC layer without an activation function f act , the FC layer (nodes 10-2, 11-2) in FIG. 8 has the parameter "f_act: none". From the structure data for the node 10-2 shown in FIG. 8, the following is defined for the node 10-2. The input of node 10-2 is connected to the 0th output of node 10-1. Then, the node 10-2 processes the FC layer using the weight designated by weight ID: 1, the bias designated by bias ID: 2, and the activation function that is the identity function. As a result, the node 10-2 generates output data represented by "0: (2048)" from input data represented by "0: (1024)".
  • the node 10-3 is a node to which the output of the node 10-2 that performs FC layer processing is input, and divides the output of the node 10-2.
  • dim: 0 described in the division processing parameter in FIG. 8 indicates that the processing performed by the node having this parameter is the division processing for the 0th dimension.
  • the division process is the opposite of the concatenation process, and the division process of dim: p' is the process of dividing the elements of the p'-th dimension. From the structure data for the node 10-3 shown in FIG. 8, the following is defined for the node 10-3.
  • the input of node 10-3 is connected to the 0th output of node 10-2.
  • node 10-3 divides the input data represented by "0: (2048)" into "0: (512), 1: (512), 2: (512) , 3: Generate the output data represented by (512)”.
  • Node 10-4 is a node to which part of the output of node 10-3 that performs splitting processing and part of the input to node 10 of the LSTM layer (specifically, c t-1 ) are input. , performs the element operation f ew1 .
  • the node 10-5 is a node to which the output of the node 10-4 that performs the element operation f ew1 and part of the output of the node 10-3 that performs the division processing are input, and performs the element operation f ew2 . . Note that the following is defined for the node 10-4 from the structure data for the node 10-4 shown in FIG.
  • the input of node 10-4 is connected to the 0th output of node 10-3, the 1st output of node 10-3, the 2nd output of node 10-3, and the 0th output of node 3. there is Then, the node 10-4 performs the element operation f ew1 , from the input data represented by "0: (512), 1: (512), 2: (512), 3: (512)", Generates output data represented by "0: (512)”. Also, from the structural data for node 10-5 shown in FIG. 8, the following is defined for node 10-5. The input of node 10-5 is connected to the 0th output of node 10-4 and the 3rd output of node 10-3.
  • the node 10-5 converts the input data represented by "0: (512), 1: (512)” to the output represented by “0: (512)” by performing the element operation f ew2 Generate data.
  • element operations f ew1 and f ew2 that combine a plurality of processes cannot be used, further decomposition into operators such as a finer sigmoid function or a product of each element may be performed.
  • the MV product conversion unit 103 converts the extracted multiple nodes into convolutional layer nodes. However, when the node decomposition unit 102 performs decomposition processing on a plurality of extracted nodes, the MV product transformation unit 103 transforms the nodes subjected to the decomposition processing into nodes of the convolution layer. More specifically, the MV product transformation unit 103 replaces the L FC layer nodes that satisfy conditions 1 to 3 with a single MM product (convolution layer) node. In addition, the MV product conversion unit 103 converts the MV product and the bias addition nodes obtained by performing decomposition processing on the nodes of the L RNN layers (LSTM layers) that satisfy the conditions 1 to 3 into a single MM product (convolution layer) node.
  • L RNN layers L RNN layers
  • the MV product conversion unit 103 inserts adjustment nodes that adjust the data format before and after the converted convolutional layer nodes.
  • FIG. 10 shows an example of structural data generated by the MV product conversion unit 103 for a neural network from which a set of two FC layers is extracted.
  • FIG. 11 is a schematic diagram showing the connection relationship of nodes represented by the structure data shown in FIG.
  • the MV product transformation unit 103 transforms the FC layer nodes 10 and 11 shown in FIGS. 4 and 5 into a single convolution layer node 10-3.
  • the node 10-3 is a node to which the output of the node 10-2 that performs shape deformation processing, which will be described later, is input, and performs convolutional layer processing on the input data. From the structure data for the node 10-3 shown in FIG. 10, the following is defined for the node 10-3.
  • the input of node 10-3 is connected to the 0th output of node 10-2.
  • the node 10-3 processes a convolution layer with a kernel size of 1 using the weight designated by weight ID: 1, the bias designated by bias ID: 2, and the ReLu function.
  • the node 10-3 generates output data represented by "0: (512, 1, 2)" from input data represented by "0: (512, 1, 2)".
  • the node 10-1 that performs the connection process is a node to which the input to the node 10 and the input to the node 11 of the FC layer are input, and connects the input vectors. Specifically, this combining process combines d l described above. is output.
  • the connection processing of dim: 1 processing of node 10-1) shown in FIG. 10 means performing the connection processing of the same parameter dim: 1 after adding a new dimension to the first dimension. That is, the join operation specified by the parameter dim: 1 inserts a new first dimension for each of the two vectors of shape (512) to produce two matrices of shape (512, 1). Then, two matrices of shape (512, 1) are concatenated with dim: 1 to output one matrix of shape (512, 2).
  • the structure data for the node 10-1 shown in FIG. 10 defines the following for the node 10-1.
  • the input of node 10-1 is connected to the 0th output of node 1 and the 0th output of node 2. Then, the node 10-1 converts the input data represented by "0: (512), 1: (512)" to "0: (512, 2) generate the output data represented by
  • the number of elements of the shape tensor specified by the parameter shape: (512, 1, 2) is 1024, which is equal to the number of elements of the input data of shape (512, 2), 1024.
  • the input of node 10-2 is connected to the 0th output of node 10-1.
  • the node 10-2 converts the input data represented by "0: (512, 2)" to "0: (512, 1, 2)”.
  • a node 10-5 is a node to which the output of the node 10-4 that performs shape deformation processing is input, and performs division processing on the output of the node 10-4. Specifically, this splitting process is performed by is divided and r l is output. From the structure data for the node 10-5 shown in FIG. 10, the following is defined for the node 10-5. The input of node 10-5 is connected to the 0th output of node 10-4. Then, the node 10-5 divides the input data represented by "(512, 2)" into “0: (512), 1: (512)” by dividing the first dimension. Generates output data that is
  • the MV product transforming unit 103 inserts the shape transformation processing (node 10-4) and the division processing (node 10-5) to change the shape of the output data of the last node (Fig. 10 and Fig. 11).
  • the shape of the output data of the node 10-5) should be the same as the shape of the output of the input structure (the shape of the output data of the nodes 10 and 11 in FIGS. 4 and 5).
  • the MV product transformation unit 103 expresses the processing of a plurality of split nodes originating from nodes of different RNN layers as processing of one node, and expresses the processing of a plurality of split nodes originating from nodes of different RNN layers. Processing of a plurality of element operation nodes may be expressed as processing of one node. Specifically, the MV product conversion unit 103 processes a plurality of split nodes (nodes 10-3 and 11-3 in FIG.
  • a node 10'-7 is a node to which a part of the output of the node 10'-4 that performs the division process and the output of the node 10'-6 that performs the shape deformation process are input, and performs the element operation f ew1 .
  • Node 10'-8 is a node to which the output of node 10'-7 that performs element operation f ew1 and part of the output of node 10'-4 that performs division processing are input. do ew2 . From the structure data for the node 10'-7 shown in FIG. 12, the following is defined for the node 10'-7.
  • node 10'-7 The inputs of node 10'-7 are the 0th output of node 10'-4, the 1st output of node 10'-4, the 2nd output of node 10'-4, and the 0 of node 10'-6. th output. Then, node 10'-7 performs element operation f ew1 to obtain "0: (512, 1, 2), 1: (512, 1, 2), 2: (512, 1, 2), 3 Generates output data represented by “0: (512, 1, 2)” from input data represented by :(512, 1, 2)”. Also, from the structural data for the node 10'-8 shown in FIG. 12, the following is defined for the node 10'-8.
  • step S1 the neural network structure is read. That is, structural data of the neural network to be transformed is acquired.
  • step S2 the node extraction unit 101 extracts data of the FC layer or RNN layer from the structural data.
  • step S3 the node extraction unit 101 extracts a set of FC layers or a set of RNN layers that satisfy all of the conditions 1 to 3 described above from the FC layers or RNN layers extracted in step S2. . If a set satisfying all conditions 1 to 3 is extracted (Yes in step S3), the process proceeds to step S4, and if such a set is not extracted (No in step S3), the process proceeds to step S8. Move to
  • step S4 the node decomposition unit 102 confirms whether the set extracted in step S3 is a set of RNN layers. If the extracted set is the set of RNN layers, the process proceeds to step S5; otherwise, the process of step S5 is skipped and the process proceeds to step S6.
  • step S5 the node decomposing unit 102 performs RNN layer decomposing processing. After step S5, the process proceeds to step S6.
  • step S7 the MV product conversion unit 103 adds adjustment nodes to the structure data. Moreover, the MV product conversion unit 103 corrects the structural data so as to share the nodes of the element calculations, if necessary. After step S7, the process proceeds to step S8.
  • step S9 a neural network structure in which some or all of the MV products are converted to MM products is output. That is, the structure data after conversion by the data conversion device 100 is output.
  • FIG. 15 is a block diagram showing an example of the hardware configuration of the data conversion device 100.
  • the data conversion device 100 includes an input/output interface 151, a memory 152, and a processor 153.
  • FIG. 15 is a block diagram showing an example of the hardware configuration of the data conversion device 100.
  • the data conversion device 100 includes an input/output interface 151, a memory 152, and a processor 153.
  • FIG. 15 is a block diagram showing an example of the hardware configuration of the data conversion device 100.
  • the data conversion device 100 includes an input/output interface 151, a memory 152, and a processor 153.
  • the memory 152 is configured by, for example, a combination of volatile memory and nonvolatile memory.
  • the memory 152 is used to store software (computer program) including one or more instructions executed by the processor 153, data used for various processes, and the like.
  • a program includes a set of instructions (or software code) that, when read into a computer, cause the computer to perform one or more of the functions described in the embodiments.
  • the program may be stored in a non-transitory computer-readable medium or tangible storage medium.
  • computer readable media or tangible storage media may include random-access memory (RAM), read-only memory (ROM), flash memory, solid-state drives (SSD) or other memory technology, CDs - ROM, digital versatile disc (DVD), Blu-ray disc or other optical disc storage, magnetic cassette, magnetic tape, magnetic disc storage or other magnetic storage device.
  • the program may be transmitted on a transitory computer-readable medium or communication medium.
  • transitory computer readable media or communication media include electrical, optical, acoustic, or other forms of propagated signals.
  • the data conversion device 100 performs the above-described processing on structural data of a neural network including layers having MV products, thereby realizing calculation of MV products by calculation of MM products. outputs structural data that can be That is, the data conversion device 100 converts MV products of multiple RNN layers or MV products of multiple FC layers into MM products, which are operations suitable for general devices that process neural networks. Therefore, by using the structural data converted by the data conversion device 100, the device can process a neural network equivalent to a neural network including layers having MV products at high speed. In particular, in the conversion by the data conversion device 100, the model structure of the neural network is changed rather than the data flow and memory access inside the layers. Therefore, it is possible to process neural networks at high speed with ASIC devices as well as general-purpose CPUs or GPUs. Also, even if the conversion by the data conversion device 100 is performed, the equivalence of neural network calculations is maintained.
  • FIGS. 16 and 17 when a set of layers that can be converted to MV products are serially arranged, omitting an intermediate coordination node reduces the execution time required to process this coordination node.
  • FIG. 16 includes a first set of FC layers (node 10, node 12) and a second set of FC layers (node 11, node 13) connected in series with the first set.
  • 1 is a schematic diagram showing an example of the structure of a neural network composed of
  • FIG. 17 is a schematic diagram showing an example of the structure of the neural network after conversion by the data conversion device 100.
  • FIG. 18 is a block diagram showing an example of the configuration of the data conversion device 1 according to the second embodiment.
  • the data conversion device 1 has a structure data acquisition unit 2 , a node extraction unit 3 , a conversion unit 4 and a structure data output unit 5 .
  • the structural data acquisition unit 2 acquires structural data, which is data representing the structure of the neural network.
  • the structural data acquisition unit 2 may acquire structural data by reading structural data from a storage device such as a memory, or may acquire structural data by receiving structural data from another device.
  • the node extraction unit 3 extracts a plurality of nodes for the matrix-vector product from the structural data acquired by the structural data acquisition unit 2.
  • the node for the matrix-vector product is a node in which processing including the calculation of the matrix-vector product is performed, and corresponds to, for example, a node in the FC layer or a node in the RNN layer.
  • the node extraction unit 3 extracts nodes that satisfy a predetermined condition. More specifically, the predetermined conditions are conditions 1 to 3 described above.
  • the node extracting unit 3 determines that each node has the same number of input elements and the same number of output elements, that each node uses the same parameters (weights and bias values), and that each node Extract nodes that satisfy the condition that there is no dependency between them. In addition, it can be said that the calculation result of each node does not affect the calculation result of other nodes when there is no dependency between the nodes.
  • the conversion unit 4 converts a plurality of nodes extracted by the node extraction unit 3 into convolutional layer nodes. Then, the structure data output unit 5 outputs the structure data converted by the conversion unit 4 .
  • the structural data output unit 5 may, for example, output the structural data to a storage device such as a memory, or transmit it to another device (for example, a device that executes neural network processing using the converted structural data). You may
  • the present embodiment it is possible to convert structural data of a neural network including layers having MV products into structural data capable of executing a neural network by calculating MM products and output the data. Therefore, it is possible to process neural networks containing layers having MV products at high speed.
  • the node extracting means has the same number of input elements for each node, the same number of output elements for each node, the same parameters used at each node, and 1.
  • the data conversion device extracting a node that satisfies a condition that there is no dependency relationship between .
  • Appendix 3 The data conversion device according to appendix 2, wherein the conversion means inserts an adjustment node for adjusting a data format before and after the converted convolutional layer node.
  • Appendix 4 3.
  • the data conversion device according to any one of appendices 1 to 4, wherein the node extracting means extracts a node of a fully connected layer as a node for matrix-vector product.
  • the node extracting means extracts a node of an RNN (Recurrent Neural Network) layer as a node for matrix-vector multiplication
  • the data conversion device further includes decomposing means for decomposing the extracted RNN layer nodes into a first type node that is a matrix-vector product node and a second type node that is a node other than the matrix-vector product node. have 6.
  • the data conversion apparatus converts the plurality of nodes of the first type into nodes of the convolutional layer.
  • the nodes of the first kind are nodes of a fully connected layer using an identity function as a nonlinear activation function;
  • the nodes of the second type include a concatenating node preceding the node of the fully connected layer and connecting data, a split node succeeding the node of the fully connected layer and dividing the data;
  • the data conversion device according to appendix 6, wherein the node is an element operation node that performs a predetermined operation and is a node subsequent to the split node.
  • the conversion means represents processing of the plurality of split nodes derived from nodes of different RNN layers as processing of one node, and processing of the plurality of element operation nodes derived from nodes of different RNN layers into processing of one node.
  • Appendix 9 Acquire structural data, which is data representing the structure of the neural network, extracting a plurality of nodes for matrix-vector multiplication from the structural data; Transform the extracted nodes into convolutional layer nodes, A data conversion method for outputting the converted structural data.
  • a non-transitory computer-readable medium storing a program for causing a computer to execute a structural data output step of outputting the converted structural data.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Evolutionary Computation (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Artificial Intelligence (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Neurology (AREA)
  • Complex Calculations (AREA)

Abstract

MV積を有する層を含むニューラルネットワークを高速に処理することが可能な新規な技術を提供する。データ変換装置(1)は、ニューラルネットワークの構造を表すデータである構造データを取得する構造データ取得部(2)と、前記構造データから、行列ベクトル積についてのノードを複数抽出するノード抽出部(3)と、抽出した複数のノードを畳み込み層のノードに変換する変換部(4)と、変換が行われた前記構造データを出力する構造データ出力(5)とを有する。

Description

データ変換装置、データ変換方法、及びプログラムが格納された非一時的なコンピュータ可読媒体
 本開示は、データ変換装置、データ変換方法、及びプログラムが格納された非一時的なコンピュータ可読媒体に関する。
 深層ニューラルネットワーク(DNN: Deep Neural Network)による自然言語処理や画像認識等に関する技術開発が活発に行われている。静止画像を扱う画像認識分野では、畳み込みニューラルネットワーク(CNN: Convolutional Neural Network)が多く用いられる。また、動画や音声などの時系列データを扱う画像認識分野や自然言語処理分野では再帰型ニューラルネットワーク(RNN: Recurrent Neural Network)が多く用いられる。
 大量の学習データを用いて大規模なサーバで訓練することで、DNNは非DNNの手法と比較して高い認識を達成することができる。一方でDNNの推論では、エッジデバイスやモバイル端末など電力の限られた環境下でリアルタイムに処理を実行する必要がある。そのような環境下でDNNを効率的に実行できるハードウェアとして、ASIC(Application Specific Integrated Circuit)デバイスが注目されている。ASICデバイスは畳み込み専用回路を搭載することで汎用のGPU(Graphics Processing Unit)やCPU(Central Processing Unit)よりも電力効率に優れている。
 非特許文献1は、RNN向けのシストリックアレイを提案した。この文献に記載された技術は、隣接する時間tおよびt+1における2つの時間のMV積(Matrix Vector product:行列ベクトル積)において計算順序を変更することで、重みへのメモリアクセス回数を削減し、この技術を用いない場合と比較して2.1倍の高速化を実現した。また、非特許文献2に記載された技術は、ベクトル要素のゼロ値と重みの乗算をスキップすることで積和演算数を削減し、処理の高速化を実現した。また、非特許文献3及び非特許文献4によって、汎用のGPUやCPUにおいてRNN層の演算の高速化が報告されている。
 例えば、RNNでは膨大な数のRNN層やFC層(Fully Connected Layer:全結合層)の処理が要求される。RNN層やFC層はMV積で構成され、これらの層を含むニューラルネットワークをリアルタイムに処理するためにはMV積の計算の高速化が必要となる。
 問題点は、ニューラルネットワークのための既存のASICデバイスやGPUでは、MV積の実行効率がMM積(Matrix Matrix product:行列行列積)よりも悪く、大量のMV積を高速に実行することは困難ということである。既存のGPUやASICデバイスは、MM積に特化したものが多く、十分に大きな行列を入力に想定し、重みを参照するためのメモリアクセスに要する時間は入力行列と重みの積和演算の時間に比べ十分に小さくなるように設計されている。MV積は、入力データがMM積とは異なり、小さな一次元ベクトルである。そのため、入力ベクトルと重み行列との積和演算に要する時間よりも、頻繁に発生する重み行列に対するメモリアクセスに要する時間が長くなる。
 上述した非特許文献1及び非特許文献2は、RNN専用の回路の提案であり、広く用いられているDNN向けデバイスに適用することはできない。また、これらの文献に記載された回路はRNN層専用の回路であるため、FC層や畳み込み層については追加の回路変更なしに実行できない。また、非特許文献3及び非特許文献4では、汎用のGPUやCPUにおいてRNN層の演算の高速化が報告されている。しかし、これらの研究は、消費電力が大きく、大きなメモリを持つサーバ向けの高速化手法(デバイス上でのタイリング等)である。このため、そのような高速化手法を、基本的な畳み込み層やFC層のみを実行するための命令しか受け付けず、メモリの制御など細かい命令を扱うことが難しいASICデバイスに適用することは難しい。
 このような背景に鑑み、MV積を有する層を含むニューラルネットワークを高速に処理するための技術は依然として求められている。そこで、本明細書に開示される実施形態が達成しようとする目的の1つは、MV積を有する層を含むニューラルネットワークを高速に処理することが可能な新規な技術を提供することである。
 本開示の第1の態様にかかるデータ変換装置は、
 ニューラルネットワークの構造を表すデータである構造データを取得する構造データ取得手段と、
 前記構造データから、行列ベクトル積についてのノードを複数抽出するノード抽出手段と、
 抽出した複数のノードを畳み込み層のノードに変換する変換手段と、
 変換が行われた前記構造データを出力する構造データ出力手段と
 を有する。
 本開示の第2の態様にかかるデータ変換方法では、
 ニューラルネットワークの構造を表すデータである構造データを取得し、
 前記構造データから、行列ベクトル積についてのノードを複数抽出し、
 抽出した複数のノードを畳み込み層のノードに変換し、
 変換が行われた前記構造データを出力する。
 本開示の第3の態様にかかるプログラムは、
 ニューラルネットワークの構造を表すデータである構造データを取得する構造データ取得ステップと、
 前記構造データから、行列ベクトル積についてのノードを複数抽出するノード抽出ステップと、
 抽出した複数のノードを畳み込み層のノードに変換する変換ステップと、
 変換が行われた前記構造データを出力する構造データ出力ステップと
 をコンピュータに実行させる。
 本開示によれば、MV積を有する層を含むニューラルネットワークを高速に処理することが可能な新規な技術を提供できる。
畳み込み層の計算方法について説明する模式図である。 FC層の計算方法について説明する模式図である。 実施の形態1にかかるデータ変換装置の構成の一例を示すブロック図である。 二つのFC層を含んで構成されるニューラルネットワークの構造データの例を示す表である。 図4で示される構造データで表されるノードの接続関係を示す模式図である。 二つのRNN層(LSTM層)を含んで構成されるニューラルネットワークの構造データの例を示す表である。 図6で示される構造データで表されるノードの接続関係を示す模式図である。 図6に示した構造データで表されるニューラルネットワークに対して分解処理を行った後のニューラルネットワークの構造を表す構造データの例を示す表である。 図8で示される構造データで表されるノードの接続関係を示す模式図である。 二つのFC層からなるセットが抽出されるニューラルネットワークに対してMV積変換部が生成した構造データの例を示す表である。 図10で示される構造データで表されるノードの接続関係を示す模式図である。 二つのLSTM層からなるセットが抽出されるニューラルネットワークに対してMV積変換部が生成した構造データの例を示す表である。 図12で示される構造データで表されるノードの接続関係を示す模式図である。 実施の形態1にかかるデータ変換装置の動作例を示すフローチャートである。 実施の形態1にかかるデータ変換装置のハードウェア構成の一例を示すブロック図である。 FC層の第1のセットと第1のセットと直列に接続しているFC層の第2のセットとを含んで構成されるニューラルネットワークの構造の例を示す模式図である。 図16に示す構造についての変換後の構造の例を示す模式図である。 実施の形態2にかかるデータ変換装置の構成の一例を示すブロック図である。
 実施の形態の説明に先だって、実施の形態の説明の理解を助けるための説明を行う。
 CNNには、主に、畳み込み層、全結合層(FC層)が含まれる。また、RNNには、主に、RNN層、FC層が含まれる。まず、図1を用いて、畳み込み層の計算方法について説明する。
 図1は、畳み込み層の計算方法について説明する模式図である。ここでは、説明の簡略化のため、バッチサイズが1であり、入力データの高さと出力データの高さが同じ大きさHかつそれらの幅が同じ大きさWの場合について説明する。ここで、Mを入力データのチャネル数、Nを出力データのチャネル数、kをカーネルサイズ、bをバイアス値とする。図1の上図に示すように畳み込み層の計算では、N個の重みフィルタと入力データとの畳み込みが計算され、その結果にバイアス値が加算され、さらに非線形活性化関数factが適用される。
 一方で、三次元の入力データと三次元の重みで畳み込みを実行することは複雑である。そのため一般的には、入力データおよび重みを二次元行列に変換し、二次元行列同士の行列行列積(MM積)を計算することで畳み込みが実現される。図1の下図に示すように、畳み込み層は二次元の入力行列Dと二次元の重み行列FとのMM積とバイアス値の加算と、非線形活性化関数factの計算で表現できる。入力行列Dは、入力データの一部分((チャネル数, 縦, 横) = (M,k,k))だけ切り出して一次元に並べたベクトル
Figure JPOXMLDOC01-appb-I000001
を用いてD[i][j]=di,jで表される。同様に、重み行列Fは、重みフィルタを一次元に並べたベクトル
Figure JPOXMLDOC01-appb-I000002
を用いてF[i][j]=fi,jと表され、出力行列Rはベクトル
Figure JPOXMLDOC01-appb-I000003
を用いてR[i][j]=ri,jと表される。畳み込み層は、前述の入力行列D、重み行列F、バイアス値
Figure JPOXMLDOC01-appb-I000004
、非線形活性化関数factを用いて、以下の式(1)のように定義できる。なお、factは一般的にReLU(Rectified Linear Unit)関数などが用いられる。
<式(1)>
Figure JPOXMLDOC01-appb-I000005
 次に、図2を用いてFC層について説明する。図2は、FC層の計算方法について説明する模式図である。図2の上図に示すようにFC層の計算では、二次元の重みと一次元の入力ベクトルdの畳み込みが計算され、その結果にバイアスが加算され、さらに非線形活性化関数factが適用される。FC層での畳み込みは、行列ベクトル積(MV積)と等価である。FC層は入力ベクトルdと重み行列F、バイアス値b、非線形活性化関数factを用いて、以下の式(2)で表される(図2の下図参照)。ただし、d[i]は入力ベクトルのi番目の要素di、r[i]は出力ベクトルのi番目の要素riとする。
<式(2)>
Figure JPOXMLDOC01-appb-I000006
で表される。
 次に、RNN層の一種であるLSTM層(Long short-term memory)について説明する。LSTM層は、以下の式(3)~式(5)で表される。
<式(3)>
Figure JPOXMLDOC01-appb-I000007
<式(4)>
Figure JPOXMLDOC01-appb-I000008
<式(5)>
Figure JPOXMLDOC01-appb-I000009
 ただし、Pは入力ベクトルxの要素数、Qは出力ベクトルhの要素数、bはバイアス値である。LSTM層では、入力重みFiと時間tにおける入力ベクトルxtとのMV積とリカレント重みGiと時間t-1の出力ベクトルht-1とのMV積とバイアスbiの和gi,tをi = 0,...,3について計算する。さらに、g0,t~g3,tに対して要素演算を行い出力ベクトルhtが計算される。なお、要素演算とは、テンソルの要素ごとに独立して行う演算であり、MV積及びMM積以外の演算をいう。LSTM層の場合、シグモイド関数σ、双曲線正接関数tanh、要素ごとの積、および要素ごとの和が要素演算に該当する。また、内部状態ct、出力ベクトルhtの初期値はj = 0,...,Q-1についてc0[j] = 0, h0[j] = 0である。
 ここで、入力重みF0,...,F3及びリカレント重みG0,...,G3を連結した4Q行P+Q列の行列Fcatとxtとht-1を連結した要素数P+Qのベクトルx'tとバイアス値b0~b3を連結したベクトルb'を用いて、式(3)のLSTM層の計算は、以下の式(7)のように表すことができる。なお、Fcat、x't、b'は以下の式(6)のように表される。
<式(6)>
Figure JPOXMLDOC01-appb-I000010

Figure JPOXMLDOC01-appb-I000011
Figure JPOXMLDOC01-appb-I000012
<式(7)>
Figure JPOXMLDOC01-appb-I000013
 さらに、式(4)及び式(5)は、以下の式(8)のように表される。
<式(8)>
Figure JPOXMLDOC01-appb-I000014
 ただし要素演算few1, few2は、以下の式(9)のように定義される。
<式(9)>
Figure JPOXMLDOC01-appb-I000015
 要素演算few1, few2の実行時間はMV積と比較して短く、RNNの実行時間の多くはMV積が占める。そのため、RNNをリアルタイムに処理するためには、MV積の高速化手法が求められている。なお、本明細書ではRNN層の計算の例としてLSTM層の計算を説明するが、GRU(Gated Recurrent Unit)層などその他の種類のRNN層について発明の適用対象外ということではない。その他のRNN層も同様にMV積と要素演算を用いて表すことができ、本発明の適用対象である。
 以下、実施の形態について説明する。実施の形態では、MV積を有する層を含むニューラルネットワークの構造データを、MM積の計算が適用できるよう変換する。これにより、CPU, GPU, ASICなどのデバイスにおいて、このニューラルネットワークを高速に処理することを可能にする。
<実施の形態1>
 図3は、実施の形態1にかかるデータ変換装置100の構成の一例を示すブロック図である。図3に示すように、データ変換装置100は、ノード抽出部101とノード分解部102とMV積変換部103を有する。データ変換装置100は、入力された構造データ91に対して、MV積の計算をMM積の計算により実現するための変換処理を行って、変換後の構造データ92を出力する。
 ここで、構造データとは、ニューラルネットワークの構造を表すデータであり、具体的には、ニューラルネットワークのノード間の接続関係及び各ノードの処理内容を定義するデータである。図4は、二つのFC層を含んで構成されるニューラルネットワークの構造データの例を示す。図5は、図4で示される構造データで表されるノードの接続関係を示す模式図である。また、図6は、二つのRNN層(LSTM層)を含んで構成されるニューラルネットワークの構造データの例を示す。図7は、図6で示される構造データで表されるノードの接続関係を示す模式図である。図7のLSTM層のノードの三つの入力(入力0,入力1,入力2)は順に、入力ベクトルxt、出力ベクトルht-1、一つ前の時間の内部状態ct-1を示し、二つの出力(出力0,出力1)は順に出力ベクトルht、内部状態ctを示している。
 ニューラルネットワークの構造データは、具体的には、図4及び図6に示すように、複数のノードを含む表で表現され、各ノードについて次のような情報を有する。すなわち、構造データは、ノードの識別子であるノード番号、演算子名、入力ノード番号、演算等のために参照される付加的な情報である属性情報を含む。なお、以下の説明では、ノード番号がi(ここで、iはノード番号を示すインデックス番号である)のノードをノードiと表記することがある。例えば、ノード番号が10のノードをノード10と表記する。
 演算子名は、ノードにおいて実行する演算を特定するための情報であり、当該ノードで用いられる演算の種類を示している。ニューラルネットワークを処理する任意のデバイスが構造データに基づいて実際に処理を実行する前には、構造データにおける演算子名が読み出され、読み出された演算子名が、この演算子名に対応する機械語に変換される。データ変換装置100による構造データの変換は、抽象度の高いニューラルネットワーク構造の変形であり、演算子自体の実装の変更を行わない。そのため、データ変換装置100による変換結果はCPU、GPU、ASICなどの機械語が全く異なるいずれのデバイスであっても適用することが可能である。
 入力ノード番号は、入力側の接続関係を示す。具体的には、入力ノード番号は、ノードに対する入力のそれぞれについて、いずれのノードのいずれの出力であるかを示す情報である。例えば、構造データに示される入力ノード番号が「x1:y1, x2:y2」である場合、入力の0番目がノード番号x1のノードのy1番目の出力と接続されており、入力の1番目がノード番号x2のノードのy2番目の出力と接続されていることを示す。
 属性情報は、パラメータ、入力の形状、及び、出力の形状を含む。属性情報のパラメータは、重みやバイアス値、カーネルサイズ(畳み込み層の演算が行われる場合)など、演算時に必要なパラメータを示している。すなわち、属性情報のパラメータは、演算のためのパラメータである。具体的には、例えば、図4及び図6の重みID、バイアス値IDは、重みパラメータFやFcat、バイアスパラメータbやb'の格納されているファイルまたはメモリのポインタアドレスであり、実際にデバイスでLSTM層またはFC層が計算されるときに参照される。また、図4のパラメータf_actは活性化関数の種類を表している。
 入力の形状は、ノードに入力されるデータの形状を示し、出力の形状は、ノードから出力されるデータの形状を示す。ここで、入力又は出力されるデータの形状とは、テンソルとしてのデータの形状である。属性情報における入力の形状は、ノードへの入力のそれぞれについてのデータの形状を示す情報であり、属性情報における出力の形状は、ノードからの出力のそれぞれについてのデータの形状を示す情報である。例えば、構造データに示される入力(出力)の形状が「x’:y’」である場合、ノードのx’番目の入力(出力)のデータの形状がy’であることを示す。ここで、本稿における形状の表記について説明する。本稿では、「(x’)」は、要素数がx’であるベクトルを表し、「(y’,x’)」は、y’行x’列の二次元行列を表し、「(z’,y’,x’)」は、チャネル数z’、高さy’、幅x’のテンソルを表す。例えば、図4に示される入力の形状「0:(512)」は、0番目の入力が、要素数512の一次元のベクトルであることを表している。
 ノード抽出部101は、行列ベクトル積についてのノードであって、所定の条件を満たす複数のノードを、入力された構造データ91から抽出する。具体的には、ノード抽出部101は、次の3つの条件を全て満たす2以上のRNN層(もしくはFC層)からなるセットを一組抽出する。すなわち、ノード抽出部101は、以下の条件1から条件3を満たす複数のRNN層からなるセットを抽出する。または、ノード抽出部101は、以下の条件1から条件3を満たす複数のFC層からなるセットを抽出する。
 条件1:それぞれのRNN層(またはFC層)において、相互に対応する入力ベクトルの要素数が同じであり、かつ、相互に対応する出力ベクトルの要素数も同じである。ここで、相互に対応する入力ベクトル(出力ベクトル)とは、第1のRNN層(FC層)におけるi番目の入力ベクトル(出力ベクトル)と第2のRNN層(FC層)におけるi番目の入力ベクトル(出力ベクトル)をいう。なお、RNN層(FC層)への入力が行列などのように多次元のデータである場合には、条件1は、各次元の要素数が同じであることを要求する。
 条件2:それぞれのRNN層(またはFC層)で使用する重みやバイアス値が同じである。
 条件3:それぞれのRNN層(またはFC層)において入出力に依存関係が無い。
 図4に示す例では、相互に対応する入出力の要素数が同じであり(すなわち、条件1を満たし)、かつ、同じ重み(ID:1)及び同じバイアス(ID:2)を使用している(すなわち、条件2を満たす)2つのFC層(ノード10、11)が抽出される。同様に、図6に示す例では、相互に対応する入出力の要素数が同じ(すなわち、条件1を満たし)、かつ、同じ重み(ID:1)及び同じバイアス(ID:2)を使用している(すなわち、条件2を満たす)2つのLSTM層(ノード10、11)が抽出される。ただし、図4に示す例及び図6に示す例において、ノード10及びノード11は、上述した条件3を満たすものとする。
 条件3は、抽出されるノードの出力が、抽出される他のノードの入力に直接的又は間接的に接続していないことを要求する条件である。ノード抽出部101は、条件1及び条件2を満たすノードのそれぞれについて、子のノードの探索を再帰的に繰り返し、条件1及び条件2を満たす他のノードの入力に接続していないことを確認する。例えば、ノード抽出部101は、ノード10の子ノード、孫ノードなどを順番に探索していき、ノード10の出力がノード11の入力に接続していないことを確認する。同様に、ノード抽出部101は、ノード11の子ノード、孫ノードなどを順番に探索していき、ノード11の出力がノード10の入力に接続していないことを確認する。ノード抽出部101は、条件1及び条件2を満たすノードについて、条件1及び条件2を満たす他のノードの入力に接続していないことを確認すると、このノードが条件3を満たすと判定する。
 条件1及び条件2を満たすFC層は、以下の式(10)を満たす。すなわち、ノード抽出部101は、式(10)を満たすL個(Lは2以上の整数であり、図4に示した例ではL=2である)のFC層のノードを抽出する。
<式(10)>
Figure JPOXMLDOC01-appb-I000016
 ここで、dlおよびrlはインデックスl(lはアルファベットのエルを表している)で特定されるノードの入力ベクトルdおよび出力ベクトルrである。式(10)において、入力ベクトルdlの要素数は抽出されたノード(図4に示した例では、l=0,1)の全てで同じMであり、出力ベクトルrlの要素数は全てのノードで同じNである。このことは、条件1が満たされていることに対応している。また、式(10)において、抽出されたノードで使用される重み行列F、バイアス値bは、lに関わらず同じである。このことは、条件2が満たされていることに対応している。
 条件1及び条件2を満たすRNN層(LSTM層)は、以下の式(11)~式(15)を満たす。すなわち、ノード抽出部101は、これらの式を満たすL個(図6に示した例ではL=2である)のRNN層のノードを抽出する。
<式(11)>
Figure JPOXMLDOC01-appb-I000017
<式(12)>
Figure JPOXMLDOC01-appb-I000018
<式(13)>
Figure JPOXMLDOC01-appb-I000019
<式(14)>
Figure JPOXMLDOC01-appb-I000020
<式(15)>
Figure JPOXMLDOC01-appb-I000021
 ここで、xl,t, hl,t, cl,tはインデックスlで特定されるノードの入力ベクトルxt、出力ベクトルht、内部状態ctを示す。また、x'l,t, ml,t, gi,l,tは計算過程の一時的な計算結果を保存するベクトルであり、x'l,tは入力ベクトルと出力ベクトルを連結したベクトル、ml,tは積和演算とバイアス加算の計算結果、g0,l,t~g3,l,tはml,tを要素数Qごとに分割したベクトルを示す。これらの式において、ノードの入力ベクトルxl,tの要素数は抽出されたノード(図6に示した例では、l=0,1)の全てで同じPである。また、ノードの入力ベクトルhl,t-1の要素数は抽出されたノードの全て同じQである。また、ノードの入力ベクトルcl,tの要素数は抽出されたノードの全てでQである。さらに、ノードの出力ベクトルhl,tの要素数は全てのノードで同じQである。これらのことは、条件1が満たされていることに対応している。また、抽出されたノードで使用される重み行列Fcat、バイアス値b'は、lに関わらず同じである。このことは、条件2が満たされていることに対応している。
 ノード分解部102は、ノード抽出部101によってRNN層のノードが抽出された場合、抽出されたRNN層のノードを、行列ベクトル積のノードである第1種のノードと、行列ベクトル積以外のノードである第2種のノードとに分解する。すなわち、ノード分解部102は、ノード抽出部101が抽出したL個のノードがRNN層のノードの場合に、以下で説明するRNN層のノード分解処理を実行する。したがって、ノード抽出部101が全結合層(FC層)のノードを抽出する場合には、データ変換装置100においてノード分解部102は省略されてもよい。
 ノード分解部102は、ノード分解処理として、上述した条件1から条件3を満たす複数のRNN層のノードのそれぞれを、MV積のノード(第1種のノード)とその他の計算ノード(第2種のノード)に分解する処理を行う。ノード分解処理後のノード数や演算子名はRNN層の種類によって異なる。LSTM層の場合、ノード抽出部101によって抽出された各ノードは、式(12)に示すMV積のノードと、式(11)および式(13)~式(15)に示すその他の演算(要素演算)のノードに分解される。ここで、式(12)で示される演算は、factとして恒等関数を用いた場合のFC層の演算と同じである。したがって、ノード分解部102は、ノード抽出部101によって抽出されたノードを、要素演算を行うノードと、非線形活性化関数として恒等関数を用いる全結合層のノードとに分解する、と説明することもできる。
 ノード分解部102は、入力された構造データ91から、分解処理後のニューラルネットワークの構造を表す構造データを生成する。図8は、図6に示した構造データで表されるニューラルネットワークに対して分解処理を行った後のニューラルネットワークの構造を表す構造データの例を示す。また、図9は、図8で示される構造データで表されるノードの接続関係を示す模式図である。なお、分解によって置き換えられた新たなノードの番号はその他のノードの番号と重複しないように選択される。
 図8及び図9におけるノード10-1及びノード11-1で行われる連結処理は、上述した式(11)に対応している。また、ノード10-2及びノード11-2で行われるFC層の処理は、上述した式(12)、すなわちMV積とバイアス加算に対応している。また、ノード10-3及びノード11-3で行われる分割処理は、上述した式(13)に対応している。さらに、ノード10-4及びノード11-4で行われる要素演算処理は上述した式(14)に対応し、ノード10-5及びノード11-5で行われる要素演算処理は上述した式(15)に対応する。したがって、この場合、ノード分解部102は、RNN層のノードを、次のような第1種のノードと第2種のノードに分解するといえる。すなわち、この場合、第1種のノードは、非線形活性化関数として恒等関数を用いるFC層(全結合層)のノード10-2、11-2である。また、第2種のノードは、FC層のノードの前段のノードであってデータを連結する連結ノード10-1、11-1と、FC層のノードの後段のノードであってデータを分割する分割ノード10-3、11-3と、分割ノードの後段のノードであって所定の演算を行う要素演算ノード10-4、11-4、10-5、11-5である。
 ここで、変換後のノードについて具体的に説明する。なお、図6及び図7に示したLSTM層のノード10の変換後のノードについて説明し、同様な説明が可能なLSTM層のノード11の変換後のノードについては、適宜、説明を省略する。ノード10-1は、LSTM層のノード10に対する入力の一部(具体的には、xt、ht-1の2つの入力)が入力されるノードであり、入力されたベクトルを連結する連結処理を行う。図8の連結処理のパラメータに記載されているdim: 0は、このパラメータを有するノードが行う処理が0番目の次元に対する連結処理であることを表しており、このノードに対する二つの入力ベクトルが
Figure JPOXMLDOC01-appb-I000022
の場合に出力ベクトル
Figure JPOXMLDOC01-appb-I000023
はy' = (u' v') = (u'0,...,u'q-1,v'0,...,v's-1)となる。ただし、q,sはそれぞれu', v'の要素数であり、ノード10-1およびノード11-1ではq = s = 512である。1次元以上の場合の連結処理、例えばn'次元の入力データ
Figure JPOXMLDOC01-appb-I000024
に対するdim: p'の連結処理は、p'番目の次元の要素を連結させる処理である。この連結処理が行われた場合の出力データは
Figure JPOXMLDOC01-appb-I000025
となる。ただし、qjはU'のj番目の次元の要素数、sjはV'のj番目の次元の要素数であり、U'とV'の要素数はp'番目の次元を除き等しくなければならない(qj = sj, j = 0,...,p'-1,p'+1,...,n'-1)。なお、図8に示されるノード10-1についての構造データから、ノード10-1について次のことが定義される。ノード10-1の入力は、ノード1の0番目の出力とノード2の0番目の出力と接続している。そして、ノード10-1は、0番目の次元に対する連結処理を行うことにより、「0:(512), 1:(512)」で表される入力データから、「0:(1024)」で表される出力データを生成する。
 ノード10-2は、連結処理を行うノード10-1の出力が入力されるノードであり、非線形活性化関数として恒等関数を用いるFC層の処理を、入力されたベクトルに対して行う。式(12)は活性化関数factの無いFC層として表されるため、図8のFC層(ノード10-2, 11-2)はパラメータが”f_act: なし”となっている。なお、図8に示されるノード10-2についての構造データから、ノード10-2について次のことが定義される。ノード10-2の入力は、ノード10-1の0番目の出力と接続している。そして、ノード10-2は、重みID:1で指定される重みと、バイアスID:2で指定されるバイアスと、恒等関数である活性化関数とを用いて、FC層の処理を行う。これにより、ノード10-2は、「0:(1024)」で表される入力データから、「0:(2048)」で表される出力データを生成する。
 ノード10-3は、FC層の処理を行うノード10-2の出力が入力されるノードであり、ノード10-2の出力に対して分割処理を行う。図8の分割処理のパラメータに記載されているdim: 0は、このパラメータを有するノードが行う処理が0番目の次元に対する分割処理であることを表している。分割処理は連結処理とは逆の処理を行うものであり、dim: p'の分割処理は、p'番目の次元の要素を分割させる処理である。なお、図8に示されるノード10-3についての構造データから、ノード10-3について次のことが定義される。ノード10-3の入力は、ノード10-2の0番目の出力と接続している。そして、ノード10-3は、0番目の次元に対する分割処理を行うことにより、「0:(2048)」で表される入力データから、「0:(512), 1:(512) , 2:(512) , 3:(512)」で表される出力データを生成する。
 ノード10-4は、分割処理を行うノード10-3の出力の一部と、LSTM層のノード10に対する入力の一部(具体的には、ct-1)とが入力されるノードであり、要素演算few1を行う。また、ノード10-5は、要素演算few1を行うノード10-4の出力と、分割処理を行うノード10-3の出力の一部とが入力されるノードであり、要素演算few2を行う。なお、図8に示されるノード10-4についての構造データから、ノード10-4について次のことが定義される。ノード10-4の入力は、ノード10-3の0番目の出力、ノード10-3の1番目の出力、ノード10-3の2番目の出力、及びノード3の0番目の出力と接続している。そして、ノード10-4は、要素演算few1を行うことにより、「0:(512), 1:(512) , 2:(512) , 3:(512)」で表される入力データから、「0:(512)」で表される出力データを生成する。また、図8に示されるノード10-5についての構造データから、ノード10-5について次のことが定義される。ノード10-5の入力は、ノード10-4の0番目の出力及びノード10-3の3番目の出力と接続している。そして、ノード10-5は、要素演算few2を行うことにより、「0:(512), 1:(512)」で表される入力データから、「0:(512)」で表される出力データを生成する。なお、要素演算few1, few2のような複数の処理をまとめた演算子が使用できない場合には、より細かいシグモイド関数や要素ごとの積などの演算子へ更に分解が行われてもよい。
 MV積変換部103は、抽出した複数のノードを畳み込み層のノードに変換する。ただし、MV積変換部103は、抽出した複数のノードに対してノード分解部102による分解処理が行われた場合には、分解処理が行われたノードを畳み込み層のノードに変換する。より詳細には、MV積変換部103は、条件1~3を満たすL個のFC層のノードを単一のMM積(畳み込み層)のノードへ置き換える。また、MV積変換部103は、条件1~3を満たすL個のRNN層(LSTM層)のノードについて分解処理を行って得られたMV積とバイアス加算のノードを単一のMM積(畳み込み層)のノードへ置き換える。
 ノード抽出部101によってL個のFC層のノードが抽出された場合、MV積変換部103は、具体的には、式(10)で示されるL個のFC層のノードを以下の式(16)で表現できる、カーネルサイズk=1の単一の畳み込み層のノードに置き換える。すなわち、MV積変換部103は、MV積のノード群をMM積のノードに置き換える。
<式(16)>
Figure JPOXMLDOC01-appb-I000026
 なお、行列
Figure JPOXMLDOC01-appb-I000027
はベクトルdlを縦に並べた
Figure JPOXMLDOC01-appb-I000028
で定義できる。
また、出力ベクトルrl
Figure JPOXMLDOC01-appb-I000029
を満たす。
 また、MV積変換部103は、変換された畳み込み層のノードの前段及び後段に、データ形式を調整する調整ノードを挿入する。図10は、二つのFC層からなるセットが抽出されるニューラルネットワークに対してMV積変換部103が生成した構造データの例を示す。図11は、図10で示される構造データで表されるノードの接続関係を示す模式図である。
 MV積変換部103は、図4及び図5に示されるFC層のノード10及び11を、単一の畳み込み層のノード10-3に変換する。ノード10-3は、後述する形状変形処理を行うノード10-2の出力が入力されるノードであり、畳み込み層の処理を、入力されたデータに対して行う。なお、図10に示されるノード10-3についての構造データから、ノード10-3について次のことが定義される。ノード10-3の入力は、ノード10-2の0番目の出力と接続している。そして、ノード10-3は、重みID:1で指定される重みと、バイアスID:2で指定されるバイアスと、ReLu関数とを用いて、カーネルサイズが1である畳み込み層の処理を行う。これにより、ノード10-3は、「0:(512,1,2)」で表される入力データから、「0:(512,1,2)」で表される出力データを生成する。
 また、MV積変換部103は、畳み込み層のノード10-3の前段及び後段に調整ノードを挿入する。これら調整ノードによって、入力データについて、畳み込み層のノード10-3が入力に対して要求するデータ形式に合うようにデータ形式が調整され、出力データについて、ノード抽出部101が抽出したノードの出力のデータ形式に合うようにデータ形式が調整される。具体的には、図10及び図11に示されるように、MV積変換部103は、畳み込み層のノード10-3の前段に、結合処理を行うノード10-1及び形状変形処理を行うノード10-2を挿入する。そして、MV積変換部103は、畳み込み層のノード10-3の後段に、形状変形処理を行うノード10-4及び分割処理を行うノード10-5を挿入する。
 結合処理を行うノード10-1は、FC層のノード10への入力及びノード11への入力が入力されるノードであり、入力されたベクトルを結合する。この結合処理は、具体的には、上述したdlを結合し
Figure JPOXMLDOC01-appb-I000030
を出力する処理である。図10に示すdim: 1の結合処理(ノード10-1の処理)は、1番目の次元に新たな次元を追加した後に、同じパラメータdim: 1の連結処理を行うことを意味する。すなわち、パラメータdim: 1で指定される結合処理は、形状(512)の二つのベクトルのそれぞれに対して、1番目の次元を新たに挿入し、形状(512, 1)の二つの行列を生成し、形状(512, 1)の二つの行列に対してdim: 1の連結処理を行い、形状(512, 2)の1つの行列を出力する。なお、図10に示されるノード10-1についての構造データから、ノード10-1について次のことが定義される。ノード10-1の入力は、ノード1の0番目の出力とノード2の0番目の出力と接続している。そして、ノード10-1は、パラメータdim: 1で特定される結合処理を行うことにより、「0:(512), 1:(512)」で表される入力データから、「0:(512, 2)」で表される出力データを生成する。
 形状変形処理を行うノード10-2は、結合処理を行うノード10-1の出力が入力されるノードであり、入力されたデータを、畳み込み層の入力に合うように三次元入力データへ変形する形状変形処理を行う。形状変形処理では、入力データをパラメータshapeで指定された形状に変形する。ノード10-2の形状変形処理は、512行2列の行列をチャネル数512、高さ1、幅2のテンソルに変形する。形状変形処理において、パラメータshapeで指定される形状のデータの要素数は形状変形処理の入力データの要素数と等しくなければならない。ノード10-2の形状変形処理では、パラメータshape: (512, 1, 2)で指定される形状のテンソルの要素数は1024であり、形状(512, 2)の入力データの要素数1024と等しい。なお、図10に示されるノード10-2についての構造データから、ノード10-2について次のことが定義される。ノード10-2の入力は、ノード10-1の0番目の出力と接続している。そして、ノード10-2は、パラメータshape: (512, 1, 2)で指定される形状変形処理を行うことにより、「0:(512, 2)」で表される入力データから、「0:(512, 1, 2)」で表される出力データを生成する。なお、図10の例では、畳み込み層の入力データの形状が(入力チャネル数M,高さH,幅W)=(512, 1, 2)となるように変形しているが、高さ方向に変形、すなわち、(512, 2, 1)と変形してもよいし、L>2の場合には高さと幅の両方向に変形しても良い。
 また、畳み込み層のノード10-3の後に、形状変形処理を行うノード10-4及び分割処理を行うノード10-5が追加される。ノード10-4は、畳み込み層の処理を行うノード10-3の出力が入力されるノードであり、入力されたデータの形状を、所定の形状に変形する。具体的には、ノード10-4は、チャネル数512、高さ1、幅2のテンソルを512行2列の行列へ変形する。なお、図10に示されるノード10-4についての構造データから、ノード10-4について次のことが定義される。ノード10-4の入力は、ノード10-3の0番目の出力と接続している。そして、ノード10-4は、パラメータshape: (512, 2)で指定される形状変形処理を行うことにより、「0:(512, 1, 2)」で表される入力データから、「0:(512, 2)」で表される出力データを生成する。
 ノード10-5は、形状変形処理を行うノード10-4の出力が入力されるノードであり、ノード10-4の出力に対して分割処理を行う。この分割処理は、具体的には、上述した
Figure JPOXMLDOC01-appb-I000031
を分割しrlを出力する処理である。なお、図10に示されるノード10-5についての構造データから、ノード10-5について次のことが定義される。ノード10-5の入力は、ノード10-4の0番目の出力と接続している。そして、ノード10-5は、1番目の次元に対する分割処理を行うことにより、「(512, 2)」で表される入力データから、「0:(512), 1:(512)」で表される出力データを生成する。
 このように、MV積変換部103は、形状変型処理(ノード10-4)および分割処理(ノード10-5)を挿入することによって、最後のノードの出力データの形状(図10及び図11のノード10-5の出力データの形状)が入力構造の出力の形状(図4及び図5のノード10, 11の出力データの形状)と同じになるようにする。
 ノード抽出部101によってL個のRNN層のノードが抽出された場合、MV積変換部103は、L個の上述した第1種のノード(MV積のノード)を以下の式(17)で表現できる単一の畳み込み層のノードに置き換える。すなわち、MV積変換部103は、MV積のノード群をMM積のノードに置き換える。
<式(17)>
Figure JPOXMLDOC01-appb-I000032
 FC層の場合と同様、MV積変換部103は、変換された畳み込み層のノードの前段及び後段に、データ形式を調整する調整ノードを挿入する。図12は、二つのLSTM層からなるセットが抽出されるニューラルネットワークに対してMV積変換部103が生成した構造データの例を示す。図13は、図12で示される構造データで表されるノードの接続関係を示す模式図である。なお、MV積変換部103で新たに追加されるノードの番号はその他のノードの番号と重複しないように選択される。
 MV積変換部103は、図8及び図9に示されるFC層のノード10-2及び11-2を、単一の畳み込み層のノード10'-3に変換する。ノード10'-3は、形状変形処理を行うノード10'-2の出力が入力されるノードであり、畳み込み層の処理を、入力されたデータに対して行う。なお、図12に示されるノード10'-3についての構造データから、ノード10'-3について次のことが定義される。ノード10'-3の入力は、ノード10'-2の0番目の出力と接続している。そして、ノード10'-3は、重みID:1で指定される重みと、バイアスID:2で指定されるバイアスと、恒等関数である活性化関数とを用いて、カーネルサイズが1である畳み込み層の処理を行う。これにより、ノード10'-3は、「0:(1024,1,2)」で表される入力データから、「0:(2048,1,2)」で表される出力データを生成する。
 また、MV積変換部103は、畳み込み層のノード10'-3の前段及び後段に調整ノードを挿入する。具体的には、図12及び図13に示されるように、MV積変換部103は、畳み込み層のノード10'-3の前段に、結合処理を行うノード10'-1及び形状変形処理を行うノード10'-2を挿入する。また、MV積変換部103は、畳み込み層のノード10'-3の後段に、形状変形処理を行うノード10'-9、10'-11及び分割処理を行うノード10'-10、10'-12を挿入する。ノード10'-1は、連結処理を行うノード10-1の出力とノード11-1の出力が入力されるノードであり、入力されたベクトルを結合する。ノード10'-2は、結合処理を行うノード10'-1の出力が入力されるノードであり、入力されたデータを、畳み込み層の入力に合うように三次元入力データへ変形する形状変形処理を行う。ノード10'-9は、要素演算few1を行うノード10'-7の出力が入力されるノードであり、入力されたデータを、所定の形状に変形する。同様に、ノード10'-11は、要素演算few2を行うノード10'-8の出力が入力されるノードであり、入力されたデータを、所定の形状に変形する。また、ノード10'-10は、形状変形処理を行うノード10'-9の出力が入力されるノードであり、ノード10'-9の出力に対して分割処理を行う。同様に、ノード10'-12は、形状変形処理を行うノード10'-11の出力が入力されるノードであり、ノード10'-11の出力に対して分割処理を行う。
 また、MV積変換部103は、要素演算few1を行うノード10'-7の前段にも調整ノードとして、結合処理を行うノード10'-5及び形状変形処理を行うノード10'-6を挿入する。これら調整ノードによって、要素演算few1を行うノード10'-7が入力に対して要求するデータ形式に合うように、データ形式が調整される。ノード10'-5は、LSTM層のノード10(図7参照)に対する入力の一部(具体的には、ct-1)と、LSTM層のノード11(図7参照)に対する入力の一部(具体的には、ct-1)と、が入力されるノードであり、入力されたベクトルを結合する。ノード10'-6は、結合処理を行うノード10'-5の出力が入力されるノードであり、入力されたデータを、要素演算few1を行うノード10'-7の入力に合うように変形する形状変形処理を行う。
 図12に示される調整ノードについての構造データから、これらのノードの具体的な処理は定義される。なお、図12に示す構造データの具体的な意味については、図10を参照した上述の説明に基づいて、同様に理解できるため、説明を省略する。
 RNN層の場合は、MV積だけではなく要素演算についても共通のノードで実行できる。これは、異なるRNN層のノードに由来するデータが結合されていることに起因している。共通のノードによる演算の実行を実現するため、MV積変換部103は、異なるRNN層のノードに由来する複数の分割ノードの処理を一つのノードの処理として表し、異なるRNN層のノードに由来する複数の要素演算ノードの処理を一つのノードの処理として表してもよい。具体的には、MV積変換部103は、異なるRNN層のノードに由来する複数の分割ノード(図9のノード10-3及びノード11-3)の処理を一つのノード(図12及び図13のノード10'-4)の処理として表す。すなわち、MV積変換部103は、異なるRNN層についての分割ノードの処理を共通の処理に置き換える。また、MV積変換部103は、異なるRNN層のノードに由来する複数の要素演算few1を行うノード(図9のノード10-4及びノード11-4)の処理を一つのノード(図12及び図13のノード10'-7)の処理として表す。すなわち、MV積変換部103は、異なるRNN層についての要素演算few1を共通の処理に置き換える。さらに、MV積変換部103は、異なるRNN層のノードに由来する複数の要素演算few2を行うノード(図9のノード10-5及びノード11-5)の処理を一つのノード(図12及び図13のノード10'-8)の処理として表す。すなわち、MV積変換部103は、異なるRNN層についての要素演算few2を共通の処理に置き換える。
 ノード10'-4は、畳み込み層の処理を行うノード10'-3の出力が入力されるノードであり、ノード10'-3の出力に対して分割処理を行う。ノード10'-4は、入力されたデータを、要素演算few1のためのデータと、要素演算few2のためのデータとに分割する。なお、図12に示されるノード10'-4についての構造データから、ノード10'-4について次のことが定義される。ノード10'-4の入力は、ノード10'-3の0番目の出力と接続している。そして、ノード10'-4は、0番目の次元に対する分割処理を行うことにより、「0:(2048, 1, 2)」で表される入力データから、「0:(512, 1, 2), 1:(512, 1, 2) , 2:(512, 1, 2) , 3:(512, 1, 2)」で表される出力データを生成する。
 ノード10'-7は、分割処理を行うノード10'-4の出力の一部と、形状変形処理を行うノード10'-6の出力とが入力されるノードであり、要素演算few1を行う。また、ノード10'-8は、要素演算few1を行うノード10'-7の出力と、分割処理を行うノード10'-4の出力の一部とが入力されるノードであり、要素演算few2を行う。なお、図12に示されるノード10'-7についての構造データから、ノード10'-7について次のことが定義される。ノード10'-7の入力は、ノード10'-4の0番目の出力、ノード10'-4の1番目の出力、ノード10'-4の2番目の出力、及びノード10'-6の0番目の出力と接続している。そして、ノード10'-7は、要素演算few1を行うことにより、「0:(512, 1, 2), 1:(512, 1, 2) , 2:(512, 1, 2) , 3:(512, 1, 2)」で表される入力データから、「0:(512, 1, 2)」で表される出力データを生成する。また、図12に示されるノード10'-8についての構造データから、ノード10'-8について次のことが定義される。ノード10'-8の入力は、ノード10'-7の0番目の出力及びノード10'-4の3番目の出力と接続している。そして、ノード10'-8は、要素演算few2を行うことにより、「0:(512, 1, 2), 1:(512, 1, 2)」で表される入力データから、「0:(512, 1, 2)」で表される出力データを生成する。
 図14は、データ変換装置100の動作例を示すフローチャートである。以下、図14を参照しつつ、上述したデータ変換装置100の構成要素の処理の流れについて説明する。
 まず初めに、ステップS1において、ニューラルネットワーク構造が読み出される。すなわち、変換対象のニューラルネットワークの構造データが取得される。
 次に、ステップS2において、ノード抽出部101が、構造データから、FC層またはRNN層のデータを抽出する。
 次に、ステップS3において、ノード抽出部101は、ステップS2で抽出されたFC層またはRNN層の中から、上述した条件1から条件3を全て満たすFC層のセットまたはRNN層のセットを抽出する。条件1から条件3を全て満たすセットが抽出された場合(ステップS3でYes)、処理はステップS4へ移行し、そのようなセットが抽出されなかった場合(ステップS3でNo)、処理はステップS8へ移行する。
 ステップS4において、ノード分解部102は、ステップS3で抽出されたセットが、RNN層のセットであるか否かを確認する。抽出されたセットがRNN層のセットである場合、処理はステップS5へ移行し、そうではない場合、ステップS5の処理がスキップされ、処理はステップS6へ移行する。
 ステップS5において、ノード分解部102は、RNN層の分解処理を実行する。ステップS5の後、処理はステップS6へ移行する。
 ステップS6において、MV積変換部103は、MV積のノードをMM積のノードへ変換する。
 そして、ステップS7において、MV積変換部103は、調整ノードを構造データに追加する。また、MV積変換部103は、必要により、要素演算のノードを共通化するよう、構造データを修正する。ステップS7の後、処理はステップS8へ移行する。
 ステップS8において、ステップS1で読み出された構造に含まれる全てのFC層またはRNN層について、上述したステップS2からステップS7までの処理が行われたか否かが確認される。全てのFC層またはRNN層について処理が行われた場合、ステップS9の処理が行われ、そうでない場合、残りのFC層またはRNN層について、上述したステップS2からステップS7までの処理が行われる。
 ステップS9において、一部もしくはすべてのMV積がMM積に変換されたニューラルネットワーク構造の出力が行われる。すなわち、データ変換装置100による変換後の構造データが出力される。
 次に、データ変換装置100のハードウェア構成の例について説明する。図15は、データ変換装置100のハードウェア構成の一例を示すブロック図である。図15に示すように、データ変換装置100は、入出力インタフェース151、メモリ152、及びプロセッサ153を含む。
 入出力インタフェース151は、必要に応じて他の装置と通信可能に接続するためのインタフェースである。
 メモリ152は、例えば、揮発性メモリ及び不揮発性メモリの組み合わせによって構成される。メモリ152は、プロセッサ153により実行される、1以上の命令を含むソフトウェア(コンピュータプログラム)、及び各種処理に用いるデータなどを格納するために使用される。
 プロセッサ153は、メモリ152からソフトウェア(コンピュータプログラム)を読み出して実行することで、上述した各構成要素の処理を行う。プロセッサ153は、例えば、マイクロプロセッサ、MPU(Micro Processor Unit)、又はCPU(Central Processing Unit)などであってもよい。プロセッサ153は、複数のプロセッサを含んでもよい。
 このように、データ変換装置100は、コンピュータとしての機能を備えている。
 プログラムは、コンピュータに読み込まれた場合に、実施形態で説明された1又はそれ以上の機能をコンピュータに行わせるための命令群(又はソフトウェアコード)を含む。プログラムは、非一時的なコンピュータ可読媒体又は実体のある記憶媒体に格納されてもよい。限定ではなく例として、コンピュータ可読媒体又は実体のある記憶媒体は、random-access memory(RAM)、read-only memory(ROM)、フラッシュメモリ、solid-state drive(SSD)又はその他のメモリ技術、CD-ROM、digital versatile disc(DVD)、Blu-ray(登録商標)ディスク又はその他の光ディスクストレージ、磁気カセット、磁気テープ、磁気ディスクストレージ又はその他の磁気ストレージデバイスを含む。プログラムは、一時的なコンピュータ可読媒体又は通信媒体上で送信されてもよい。限定ではなく例として、一時的なコンピュータ可読媒体又は通信媒体は、電気的、光学的、音響的、またはその他の形式の伝搬信号を含む。
 本実施の形態によれば、データ変換装置100は、MV積を有する層を含むニューラルネットワークの構造データに対して上述した処理を行うことにより、MV積の計算をMM積の計算により実現することが可能な構造データを出力する。すなわち、データ変換装置100により、複数のRNN層のMV積または複数のFC層のMV積が、ニューラルネットワークを処理する一般的なデバイスに適した演算であるMM積に変換される。このため、データ変換装置100により変換された構造データを用いることで、MV積を有する層を含むニューラルネットワークと等価なニューラルネットワークをデバイスにより高速に処理することを可能にする。特に、データ変換装置100による変換では、層内部のデータフローやメモリアクセスが変更されるのではなく、ニューラルネットワークのモデル構造が変更される。このため、汎用CPU又はGPUだけでなく、ASICデバイスで、高速にニューラルネットワークを処理することが可能である。また、データ変換装置100による変換が行われても、ニューラルネットワークの計算の等価性は維持される。
 以上、実施の形態1について説明したが、上述した実施の形態について種々の変更が行われてもよい。例えば、図16及び図17に示すように、MV積に変換できる層のセットが直列に並んでいる場合、中間の調整ノードを省略することで、この調整ノードの処理に要する実行時間が短縮されてもよい。ここで、図16は、FC層の第1のセット(ノード10、ノード12)と第1のセットと直列に接続しているFC層の第2のセット(ノード11、ノード13)とを含んで構成されるニューラルネットワークの構造の例を示す模式図である。また、図17は、データ変換装置100による変換後のニューラルネットワークの構造の例を示す模式図である。ここで、図17の畳み込み層のノード10-3は、上述した第1のセットについての変換により生成されたノードであり、図17の畳み込み層のノード10-4は、上述した第2のセットについての変換により生成されたノードである。ノード10-3及びノード10-4は、直列に接続されており、両者の中間の調整ノードは、省略されている。そして、ノード10-3及びノード10-4の前段及び後段には、ノード10-3及びノード10-4に対する共通の調整ノードとして、結合処理を行うノード10-1、形状変形処理を行うノード10-2、形状変形処理を行うノード10-6、及び分割処理を行うノード10-7が挿入されている。このように、MV積変換部103は、変換された畳み込み層のノード(図17のノード10-3、ノード10-4)が直列に連続する場合、直列に連続する当該複数の畳み込み層のノードに共通の調整ノードを挿入することで、中間の調整ノードを省略してもよい。
<実施の形態2>
 次に、実施の形態2について説明する。実施の形態2は、実施の形態1の特徴的な要素から構成される実施の形態である。図18は、実施の形態2にかかるデータ変換装置1の構成の一例を示すブロック図である。データ変換装置1は、構造データ取得部2と、ノード抽出部3と、変換部4と、構造データ出力部5とを有する。
 構造データ取得部2は、ニューラルネットワークの構造を表すデータである構造データを取得する。構造データ取得部2は、メモリなどの記憶装置から構造データを読み出すことにより構造データを取得してもよいし、他の装置から構造データを受信することにより構造データを取得してもよい。
 ノード抽出部3は、構造データ取得部2が取得した構造データから、行列ベクトル積についてのノードを複数抽出する。ここで、行列ベクトル積についてのノードとは、行列ベクトル積の計算を含む処理が行われるノードであり、例えば、FC層のノードやRNN層のノードが該当する。特に、ノード抽出部3は、所定の条件を満たすノードを抽出する。より詳細には、所定の条件は、上述した条件1から条件3である。すなわち、ノード抽出部3は、各ノードの入力の要素数と出力の要素数がいずれも同じであり、かつ、各ノードで使用するパラメータ(重みやバイアス値)が同じであり、かつ、各ノード間に依存関係が無いという条件を満たすノードを抽出する。なお、各ノード間に依存関係が無いとは、各ノードの計算結果が他のノードの計算結果に影響を与えないとも言える。
 変換部4は、ノード抽出部3が抽出した複数のノードを畳み込み層のノードに変換する。そして、構造データ出力部5は、変換部4による変換が行われた構造データを出力する。構造データ出力部5は、例えば、メモリなどの記憶装置に構造データを出力してもよいし、他の装置(例えば、変換された構造データを用いてニューラルネットワークの処理を実行するデバイス)に送信してもよい。
 本実施の形態によれば、MV積を有する層を含むニューラルネットワークの構造データを、MM積の計算によりニューラルネットワークを実行することが可能な構造データに変換して出力することができる。このため、MV積を有する層を含むニューラルネットワークを高速に処理することが可能になる。
 以上、実施の形態を参照して本願発明を説明したが、本願発明は上記によって限定されるものではない。本願発明の構成や詳細には、発明のスコープ内で当業者が理解し得る様々な変更をすることができる。
 上記の実施形態の一部又は全部は、以下の付記のようにも記載され得るが、以下には限られない。
(付記1)
 ニューラルネットワークの構造を表すデータである構造データを取得する構造データ取得手段と、
 前記構造データから、行列ベクトル積についてのノードを複数抽出するノード抽出手段と、
 抽出した複数のノードを畳み込み層のノードに変換する変換手段と、
 変換が行われた前記構造データを出力する構造データ出力手段と
 を有する
 データ変換装置。
(付記2)
 前記ノード抽出手段は、各ノードの入力の要素数が同じであり、かつ、各ノードの出力の要素数が同じであり、かつ、各ノードで使用するパラメータが同じであり、かつ、各ノード間に依存関係が無いという条件を満たすノードを抽出する
 付記1に記載のデータ変換装置。
(付記3)
 前記変換手段は、変換された前記畳み込み層のノードの前段及び後段に、データ形式を調整する調整ノードを挿入する
 付記2に記載のデータ変換装置。
(付記4)
 前記変換手段は、変換された前記畳み込み層のノードが直列に連続する場合、直列に連続する当該複数の前記畳み込み層のノードに共通の前記調整ノードを挿入する
 付記3に記載のデータ変換装置。
(付記5)
 前記ノード抽出手段は、行列ベクトル積についてのノードとして、全結合層のノードを抽出する
 付記1乃至4のいずれか一項に記載のデータ変換装置。
(付記6)
 前記ノード抽出手段は、行列ベクトル積についてのノードとして、RNN(Recurrent Neural Network)層のノードを抽出し、
 前記データ変換装置は、抽出されたRNN層のノードを、行列ベクトル積のノードである第1種のノードと、行列ベクトル積以外のノードである第2種のノードとに分解する分解手段をさらに有し、
 前記変換手段は、前記第1種の複数のノードを前記畳み込み層のノードに変換する
 付記1乃至5にいずれか一項に記載のデータ変換装置。
(付記7)
 前記第1種のノードは、非線形活性化関数として恒等関数を用いる全結合層のノードであり、
 前記第2種のノードは、前記全結合層のノードの前段のノードであってデータを連結する連結ノードと、前記全結合層のノードの後段のノードであってデータを分割する分割ノードと、前記分割ノードの後段のノードであって所定の演算を行う要素演算ノードである
 付記6に記載のデータ変換装置。
(付記8)
 前記変換手段は、異なるRNN層のノードに由来する複数の前記分割ノードの処理を一つのノードの処理として表し、異なるRNN層のノードに由来する複数の前記要素演算ノードの処理を一つのノードの処理として表す
 付記7に記載のデータ変換装置。
(付記9)
 ニューラルネットワークの構造を表すデータである構造データを取得し、
 前記構造データから、行列ベクトル積についてのノードを複数抽出し、
 抽出した複数のノードを畳み込み層のノードに変換し、
 変換が行われた前記構造データを出力する
 データ変換方法。
(付記10)
 ニューラルネットワークの構造を表すデータである構造データを取得する構造データ取得ステップと、
 前記構造データから、行列ベクトル積についてのノードを複数抽出するノード抽出ステップと、
 抽出した複数のノードを畳み込み層のノードに変換する変換ステップと、
 変換が行われた前記構造データを出力する構造データ出力ステップと
 をコンピュータに実行させるプログラムが格納された非一時的なコンピュータ可読媒体。
1  データ変換装置
2  構造データ取得部
3  ノード抽出部
4  変換部
5  構造データ出力部
91  構造データ
92  構造データ
100  データ変換装置
101  ノード抽出部
102  ノード分解部
103  MV積変換部
151  入出力インタフェース
152  メモリ
153  プロセッサ

Claims (10)

  1.  ニューラルネットワークの構造を表すデータである構造データを取得する構造データ取得手段と、
     前記構造データから、行列ベクトル積についてのノードを複数抽出するノード抽出手段と、
     抽出した複数のノードを畳み込み層のノードに変換する変換手段と、
     変換が行われた前記構造データを出力する構造データ出力手段と
     を有する
     データ変換装置。
  2.  前記ノード抽出手段は、各ノードの入力の要素数が同じであり、かつ、各ノードの出力の要素数が同じであり、かつ、各ノードで使用するパラメータが同じであり、かつ、各ノード間に依存関係が無い、という条件を満たすノードを抽出する
     請求項1に記載のデータ変換装置。
  3.  前記変換手段は、変換された前記畳み込み層のノードの前段及び後段に、データ形式を調整する調整ノードを挿入する
     請求項2に記載のデータ変換装置。
  4.  前記変換手段は、変換された前記畳み込み層のノードが直列に連続する場合、直列に連続する当該複数の前記畳み込み層のノードに共通の前記調整ノードを挿入する
     請求項3に記載のデータ変換装置。
  5.  前記ノード抽出手段は、行列ベクトル積についてのノードとして、全結合層のノードを抽出する
     請求項1乃至4のいずれか一項に記載のデータ変換装置。
  6.  前記ノード抽出手段は、行列ベクトル積についてのノードとして、RNN(Recurrent Neural Network)層のノードを抽出し、
     前記データ変換装置は、抽出されたRNN層のノードを、行列ベクトル積のノードである第1種のノードと、行列ベクトル積以外のノードである第2種のノードとに分解する分解手段をさらに有し、
     前記変換手段は、前記第1種の複数のノードを前記畳み込み層のノードに変換する
     請求項1乃至5にいずれか一項に記載のデータ変換装置。
  7.  前記第1種のノードは、非線形活性化関数として恒等関数を用いる全結合層のノードであり、
     前記第2種のノードは、前記全結合層のノードの前段のノードであってデータを連結する連結ノードと、前記全結合層のノードの後段のノードであってデータを分割する分割ノードと、前記分割ノードの後段のノードであって所定の演算を行う要素演算ノードである
     請求項6に記載のデータ変換装置。
  8.  前記変換手段は、異なるRNN層のノードに由来する複数の前記分割ノードの処理を一つのノードの処理として表し、異なるRNN層のノードに由来する複数の前記要素演算ノードの処理を一つのノードの処理として表す
     請求項7に記載のデータ変換装置。
  9.  ニューラルネットワークの構造を表すデータである構造データを取得し、
     前記構造データから、行列ベクトル積についてのノードを複数抽出し、
     抽出した複数のノードを畳み込み層のノードに変換し、
     変換が行われた前記構造データを出力する
     データ変換方法。
  10.  ニューラルネットワークの構造を表すデータである構造データを取得する構造データ取得ステップと、
     前記構造データから、行列ベクトル積についてのノードを複数抽出するノード抽出ステップと、
     抽出した複数のノードを畳み込み層のノードに変換する変換ステップと、
     変換が行われた前記構造データを出力する構造データ出力ステップと
     をコンピュータに実行させるプログラムが格納された非一時的なコンピュータ可読媒体。
PCT/JP2021/035710 2021-09-28 2021-09-28 データ変換装置、データ変換方法、及びプログラムが格納された非一時的なコンピュータ可読媒体 WO2023053222A1 (ja)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP2023550805A JPWO2023053222A5 (ja) 2021-09-28 データ変換装置、データ変換方法、及びプログラム
PCT/JP2021/035710 WO2023053222A1 (ja) 2021-09-28 2021-09-28 データ変換装置、データ変換方法、及びプログラムが格納された非一時的なコンピュータ可読媒体

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2021/035710 WO2023053222A1 (ja) 2021-09-28 2021-09-28 データ変換装置、データ変換方法、及びプログラムが格納された非一時的なコンピュータ可読媒体

Publications (1)

Publication Number Publication Date
WO2023053222A1 true WO2023053222A1 (ja) 2023-04-06

Family

ID=85781484

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2021/035710 WO2023053222A1 (ja) 2021-09-28 2021-09-28 データ変換装置、データ変換方法、及びプログラムが格納された非一時的なコンピュータ可読媒体

Country Status (1)

Country Link
WO (1) WO2023053222A1 (ja)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106650922A (zh) * 2016-09-29 2017-05-10 清华大学 硬件神经网络转换方法、计算装置、编译方法和神经网络软硬件协作系统
JP2017107568A (ja) * 2015-12-11 2017-06-15 バイドゥ・ユーエスエイ・リミテッド・ライアビリティ・カンパニーBaidu USA LLC マルチコア最適化リカレントニューラルネットワーク用のシステムおよび方法

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2017107568A (ja) * 2015-12-11 2017-06-15 バイドゥ・ユーエスエイ・リミテッド・ライアビリティ・カンパニーBaidu USA LLC マルチコア最適化リカレントニューラルネットワーク用のシステムおよび方法
CN106650922A (zh) * 2016-09-29 2017-05-10 清华大学 硬件神经网络转换方法、计算装置、编译方法和神经网络软硬件协作系统

Also Published As

Publication number Publication date
JPWO2023053222A1 (ja) 2023-04-06

Similar Documents

Publication Publication Date Title
Wang et al. Factorized convolutional neural networks
Li et al. Towards compact cnns via collaborative compression
Han et al. Ghostnet: More features from cheap operations
CN107944556B (zh) 基于块项张量分解的深度神经网络压缩方法
Howard et al. Mobilenets: Efficient convolutional neural networks for mobile vision applications
Chen et al. An enhanced hybrid MobileNet
Ma et al. Facial expression recognition using constructive feedforward neural networks
Wang et al. Design of efficient convolutional layers using single intra-channel convolution, topological subdivisioning and spatial" bottleneck" structure
Yang et al. Legonet: Efficient convolutional neural networks with lego filters
CN112101190A (zh) 一种遥感图像分类方法、存储介质及计算设备
CN114651260A (zh) 具有动态权重选择的相位选择性卷积
CN116416561A (zh) 一种视频图像处理方法和装置
WO2021042857A1 (zh) 图像分割模型的处理方法和处理装置
KR20230050340A (ko) 테이블 형식의 컨볼루션 및 가속
CN104850533A (zh) 一种带约束的非负矩阵分解方法及求解方法
CN111242286A (zh) 一种数据格式变换方法、装置及计算机可读存储介质
CN111882028B (zh) 用于卷积神经网络的卷积运算装置
JPWO2019187696A1 (ja) ベクトル化装置、言語処理方法及びプログラム
WO2023053222A1 (ja) データ変換装置、データ変換方法、及びプログラムが格納された非一時的なコンピュータ可読媒体
WO2023071658A1 (zh) Ai模型的处理方法、运算方法及装置
CN111368941A (zh) 一种图像处理方法、装置以及计算机存储介质
CN111860824A (zh) 一种数据处理方法及相关产品
WO2023122896A1 (zh) 一种数据处理方法和装置
WO2021179117A1 (zh) 神经网络通道数搜索方法和装置
Chung et al. Filter pruning by image channel reduction in pre-trained convolutional neural networks

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21959270

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 2023550805

Country of ref document: JP

NENP Non-entry into the national phase

Ref country code: DE