Computing devices and related products

By scaling and restoring the input tensor in the computing device, the performance degradation problem caused by the input tensor range of the nonlinear operator in the deep neural network is solved, the performance of the activation operator is improved, and the number of activation tables is reduced.

CN113537476BActive Publication Date: 2024-09-06CAMBRICON TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010301181.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-04-16
Publication Date
2024-09-06
Estimated Expiration
2040-04-16

AI Technical Summary

Technical Problem

In deep neural networks, the value range of input tensor elements of nonlinear operators is not fixed, which results in the need to support a relatively large value range, resulting in an increase in the number of activation tables, reduced computing performance, and excessive storage space usage.

Method used

By scaling the input tensor in the computing device to scale its element size to a suitable range, and searching and restoring it in the activation table, the activation result is finally obtained, avoiding the performance degradation of traversing a large number of activation tables.

Benefits of technology

It effectively improves the performance of activation operators, reduces the number of activation tables, avoids performance degradation caused by traversing a large number of activation tables, and expands the range of legal inputs without significantly increasing storage overhead.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113537476B
    Figure CN113537476B
Patent Text Reader

Abstract

The present disclosure relates to a computing device and related products. The computing device may include a processor, and the processor may include multiple processing units and a storage unit. The multiple processing units are used to execute instruction sequences, and the storage unit is used to store data, and may include a random access memory and a register file. The multiple processing units in the processor may share part of the storage space, such as sharing part of the RAM storage space and the register file, and may also have their own storage space at the same time. The computing device disclosed in the present disclosure can improve the computing performance when performing the operation of the neural network model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to a computing device and related products. Background Art

[0002] In the field of artificial intelligence technology, the neural network algorithm is a very popular machine learning algorithm recently, which has achieved very good results in various fields, such as image recognition, speech recognition, natural language processing, etc. Summary of the invention

[0003] Based on this, it is necessary to provide a computing device and related products to address the above technical issues.

[0004] According to one aspect of the present disclosure, a computing device is provided, the computing device comprising:

[0005] a processing unit, a first storage unit, and a second storage unit;

[0006] The computing device receives external input data and a binary executable file,

[0007] The input data includes an activation table and an input tensor to be processed, and the computing device stores the activation table in a first storage unit and stores the input tensor in a second storage unit;

[0008] When the processing unit runs the binary executable file, it reads the input tensor from the second storage unit, scales the input tensor to obtain a scaled input tensor, searches the activation table in the first storage unit to activate the scaled input tensor to obtain an intermediate activation result, scales and restores the intermediate activation result to obtain an activation result, and outputs the activation result to the second storage unit.

[0009] According to another aspect of the present disclosure, an artificial intelligence chip is provided, wherein the chip includes the computing device as described above.

[0010] According to another aspect of the present disclosure, an electronic device is provided, comprising the artificial intelligence chip as described above.

[0011] According to another aspect of the present disclosure, there is provided a board card, the board card comprising: a storage device, an interface device, a control device and an artificial intelligence chip as described above;

[0012] Wherein, the artificial intelligence chip is connected to the storage device, the control device and the interface device respectively;

[0013] The storage device is used to store data;

[0014] The interface device is used to realize data transmission between the artificial intelligence chip and external equipment;

[0015] The control device is used to monitor the status of the artificial intelligence chip.

[0016] According to the embodiments of the present disclosure, the input tensor of the input activation operator can be scaled, so that the size of the elements in the scaled input tensor is scaled to a suitable range, and after activating the scaled input tensor by looking up the activation table, an intermediate activation result is obtained, and then the intermediate activation result is restored to obtain the final activation result. Through the embodiments of the present disclosure, the input tensor is scaled, and the elements in the input tensor are scaled to a range that can be covered by the existing activation table. There is no need to set a large number of activation tables according to the actual range of the elements in the input tensor, thereby avoiding the reduction of operator performance due to traversing a large number of activation tables and improving the performance of the activation operator.

[0017] Further features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the disclosure and, together with the description, serve to explain the principles of the disclosure.

[0019] Figure 1 A schematic diagram showing a processor according to an embodiment of the present disclosure.

[0020] Figure 2 A block diagram of a computing device according to an embodiment of the present disclosure is shown.

[0021] Figure 3 A flowchart of an activation process according to an embodiment of the present disclosure is shown.

[0022] Figure 4 A structural block diagram of a board according to an embodiment of the present disclosure is shown.

[0023] Figure 5 A block diagram of an electronic device 800 according to an embodiment of the present disclosure is shown.

[0024] Figure 6 A block diagram of an electronic device 1900 according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0025] The following will be combined with the drawings in the embodiments of the present disclosure to clearly and completely describe the technical solutions in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.

[0026] It should be understood that the terms "first", "second", "third", "fourth", etc. in the claims, specifications and drawings of the present disclosure are used to distinguish different objects rather than to describe a specific order. The terms "include" and "comprise" used in the specifications and claims of the present disclosure indicate the presence of the described features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or their collections.

[0027] It should also be understood that the terms used in this disclosure are only for the purpose of describing specific embodiments and are not intended to limit the present disclosure. As used in this disclosure and claims, the singular forms of "a", "an", and "the" are intended to include the plural forms unless the context clearly indicates otherwise. It should also be further understood that the term "and / or" used in this disclosure and claims refers to any combination of one or more of the associated listed items and all possible combinations, including these combinations.

[0028] As used in this specification and claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.

[0029] Nonlinear operators are used in deep neural networks, such as ReLU (Rectified linear unit), Sigmoid, TanH (hyperbolic tangent function), etc. used as activation functions, Sqrt, Rsqrt, etc. used for normalization operators, Log, etc. used for loss function operators, and sin / cos, etc. used for position encoding. At present, the interpolation table method is used in related technologies to implement these nonlinear operators, that is, a number axis area is divided into several segments, and each segment uses a straight line to fit the curve of the nonlinear function corresponding to this segment. This straight line is represented by parameters (k, b), and parameters k and b are the slope and intercept of the straight line of this segment, respectively. The parameters (k, b) corresponding to each segment are integrated into a table as an activation table for query during calculation. In order to cover a larger number axis area, multiple activation tables can be used to fit nonlinear operators. In this way, all activation tables need to be traversed during calculation to obtain the final result.

[0030] The value range of the elements in the input tensor of the nonlinear operator is not fixed, so it is usually necessary to support a relatively large value range to meet the needs of deep neural networks. However, the larger the supported value range, the more activation tables are required. Since the calculation of the final result requires traversing all activation tables, the more activation tables are used, the more the operator performance will be significantly reduced, and a large number of activation tables require more storage space, which also affects the computing performance.

[0031] In order to solve the above technical problems, the present disclosure provides a computing device. The computing device may include a processor, and the processor may include a processing unit. The processor may be a general-purpose processor, such as a CPU (Central Processing Unit), or an artificial intelligence processor (IPU) for performing artificial intelligence operations. Artificial intelligence operations may include machine learning operations, brain-like operations, etc. Among them, machine learning operations include neural network operations, k-means operations, support vector machine operations, etc. The artificial intelligence processor may, for example, include one or a combination of GPU (Graphics Processing Unit), NPU (Neural-Network Processing Unit), DSP (Digital Signal Process), and Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA) chips. The present disclosure does not limit the specific type of processor.

[0032] In a possible implementation, the processor mentioned in the present disclosure may include multiple processing units, each of which may independently run various assigned tasks, such as convolution operation tasks, pooling tasks, or fully connected tasks, etc. The present disclosure does not limit the processing units and the tasks run by the processing units.

[0033] Figure 1 FIG. 1 is a schematic diagram showing a processor according to an embodiment of the present disclosure. Figure 1 As shown, the processor 100 may include multiple processing units 101 and a storage unit 102. The multiple processing units 101 are used to execute instruction sequences, and the storage unit 102 is used to store data, and may include a random access memory (RAM) and a register file. The multiple processing units 101 in the processor 100 may share part of the storage space, such as sharing part of the RAM storage space and the register file, or may have their own storage space at the same time.

[0034] Figure 2 A block diagram of a computing device according to an embodiment of the present disclosure is shown as follows: Figure 2 As shown, the computing device includes a processing unit, a first storage unit and a second storage unit, wherein: Figure 1 The storage unit 102 in the example may be an example of a first storage unit. Figure 2 The processing unit and the first storage unit may be components of a processor, and the processor may include multiple processing units.

[0035] In a possible implementation, the first storage unit may be an on-chip static random access memory SRAM, and the second storage unit may be an off-chip double data rate DDR memory.

[0036] The computing device may receive input data and instructions from an external input, wherein the input data may include an activation table and an input tensor to be processed, and the computing device stores the activation table in a first storage unit and stores the input tensor in a second storage unit.

[0037] When the processing unit runs the instruction, it reads the input tensor from the second storage unit, scales the input tensor to obtain a scaled input tensor, searches the activation table in the first storage unit to activate the scaled input tensor to obtain an intermediate activation result, scales and restores the intermediate activation result to obtain an activation result, and outputs the activation result to the second storage unit.

[0038] Before the operation, the computing device can load the packaged input data and instructions and store them in the corresponding locations, for example, the activation table and instructions are stored in SRAM, and the input tensor is stored in DDR.

[0039] In a possible implementation, the input tensor may be tensor data extracted from an image, audio or video. Specifically, an initial input tensor may be extracted based on the image, audio or video data, and the above-mentioned input tensor may be obtained by operating the initial input tensor using a neural network. The specific operation process may include convolution, full connection, etc., that is, the input tensor input to the activation operator may be the result of the operation of each layer before the activation layer of the neural network. The processing unit may execute instructions to implement the processing of the input data. The processing may include scaling processing, activation, and scaling recovery processing as described above, wherein the scaling processing may refer to reducing the data in the input tensor to within the range that the activation table can cover, for example, dividing the data in the input tensor by the scaling multiple, or multiplying by the scaling factor and the like. The activation process is the same as the method of traversing the activation table in the related art mentioned above. Scaling recovery processing may refer to processing the activated data again according to the scaling multiple to obtain equivalent data when not scaled, for example, it may be multiplied by the scaling multiple, and so on.

[0040] According to the embodiments of the present disclosure, the input tensor of the input activation operator can be scaled, so that the size of the elements in the scaled input tensor is scaled to an appropriate range, and after activating the scaled input tensor by looking up the activation table, an intermediate activation result is obtained, and then the intermediate activation result is restored to obtain the final activation result. Through the data activation method of the above embodiment, the input tensor is scaled, and the elements in the input tensor are scaled to the range that can be covered by the existing activation table. There is no need to set a large number of activation tables according to the actual range of the elements in the input tensor, thereby avoiding the reduction of operator performance due to traversing a large number of activation tables and improving the performance of the activation operator.

[0041] In a possible implementation, the scaling process includes:

[0042] The processing unit calculates a first scaling tensor according to the input tensor, the activation interval, and the scaling coefficient, and performs a bitwise multiplication of the first scaling tensor and the input tensor to obtain a scaled input tensor;

[0043] The scaling recovery process includes: the processing unit performs recovery processing on the intermediate activation result using the first recovery tensor according to the input tensor, the activation interval and the recovery coefficient first recovery tensor to obtain the activation result of the input tensor;

[0044] Among them, the activation interval is used to indicate the range of values ​​that the activation table can cover, the scaling factor is used to indicate the multiple by which the data in the input tensor is scaled, and the recovery factor is used to indicate the multiple by which the intermediate activation result is scaled and restored.

[0045] In a possible implementation, elements that fall within the numerical range covered by the activation table can be activated by searching the activation table, and elements that do not fall within this numerical range cannot be activated by searching the activation table and need to be scaled.

[0046] In a possible implementation, the activation interval can be expressed as (l, h), where l is the lower boundary and h is the upper boundary, and l and h can be data with the same value but opposite signs, for example, l is -1 and h is 1. It should be noted that the above expression of the activation interval is only an example of the present disclosure and does not limit the present disclosure in any way. It can be understood by those skilled in the art that l and h are not limited to the above examples.

[0047] The above-mentioned scaling factor may refer to a parameter for scaling elements in the input tensor that do not fall within the activation interval, and as described above, may be used to represent the multiple by which the data in the input tensor is scaled. The scaling factor of the disclosed embodiment may be pre-set, for example, the scaling factor may be a parameter represented in the form of an immediate number of a scaling instruction. The recovery factor may be determined based on the scaling factor, and of course, may be pre-set, and the recovery factor may be used to obtain a first recovery tensor, and the final activation result may be obtained by processing the intermediate activation result through the first recovery tensor.

[0048] Figure 3 FIG. 1 is a flow chart showing an activation process according to an embodiment of the present disclosure. In a possible implementation, as shown in FIG. Figure 3 As shown, the process from scaling processing to recovery processing may include:

[0049] In step S11: a first scaling tensor and a first recovery tensor are calculated according to the input tensor, the activation interval, the scaling coefficient and the recovery coefficient;

[0050] In step S12: performing bitwise multiplication of the first scaled tensor and the input tensor to obtain a scaled input tensor;

[0051] In step S13: the activation table is searched to activate the scaled input tensor to obtain an intermediate activation result;

[0052] In step S14: the first recovery tensor is used to recover the intermediate activation result to obtain the activation result of the input tensor.

[0053] That is to say, the processing unit can calculate the first scaling tensor and the first recovery tensor together, and the specific process of calculating the first scaling tensor and the first recovery tensor may include: determining the first index tensor and the second index tensor according to the input tensor and the activation interval; calculating the second scaling tensor according to the second index tensor and the scaling coefficient, and calculating the second recovery tensor according to the second index tensor and the recovery coefficient; calculating the first scaling tensor according to the first index tensor and the second scaling tensor, and calculating the first recovery tensor according to the first index tensor and the second recovery tensor.

[0054] The shapes of the first index tensor and the second index tensor are the same as the shape of the input tensor. The same shape may mean that the dimensions of the tensors are the same and the number of elements in each dimension is the same.

[0055] In one possible implementation, the numerical values ​​of the elements in the first index tensor and the second index tensor may be determined as follows: if any element in the input tensor is within the activation interval, the element at the position corresponding to the element in the first index tensor is 1, and the element at the position corresponding to the element in the second index tensor is 0; if any element in the input tensor is not within the activation interval, the element at the position corresponding to the element in the first index tensor is 0, and the element at the position corresponding to the element in the second index tensor is 1.

[0056] The above determination method is only an example of the present disclosure, and the present disclosure is not limited thereto. For example, the first index tensor or the second index tensor can also be determined first, and then the elements in the determined index tensor can be flipped to obtain another index tensor. That is to say, if any element in the input tensor is within the activation interval, the element at the position corresponding to the element in the first index tensor is 1. If any element in the input tensor is not within the activation interval, the element at the position corresponding to the element in the first index tensor is 0. The first index tensor is flipped to obtain the second index tensor. Flipping means setting the elements that were originally 0 to 1 and the elements that were originally 1 to 0.

[0057] For example, assuming that the activation interval is [-10, 10], assuming that the input tensor is I, and the input tensor is tensor data extracted according to the image data, the input tensor I can be represented by NHWC (batch, height, width, channels). For image data, channels can include three channels RGB (Red, Green, Blue). A channel in a picture is used as an example to illustrate the data activation method disclosed in the present invention. For example, taking the R channel as an example, the input tensor IR is Then we can determine that the first index tensor M corresponding to the input tensor can be The second index tensor N can be

[0058] The elements in the second index tensor can be multiplied by the scaling factor to obtain a second scaling tensor P, and the elements in the second index tensor can be multiplied by the restoration factor to obtain a second restoration tensor Q.

[0059] For example, assuming that the scaling factor is α and the restoration factor is β, then the second scaling tensor P is The second recovered tensor Q is Among them, as mentioned above, the size of the scaling factor can be a pre-set fixed value, such as 1 / 100, 1 / 50, etc., or it can be adjusted according to the input tensor and the activation interval. For example, in the above example of the present disclosure, the range of the value representing a pixel is 0 to 255, the activation interval is [-10, 10], and the scaling factor α can be set to 10 / 255. The recovery coefficient can be set to 1 / α, or it can be set to other values ​​according to the actual activation function, which is not limited by the present disclosure.

[0060] The first scaling tensor is the sum of a first index tensor and a second scaling tensor, and the first recovery tensor is the sum of a first index tensor and a second recovery tensor.

[0061] Assume that the first scaled tensor is A and the first restored tensor is B. Then, taking the above example as an example, the first scaled tensor is First restore the tensor

[0062] Positional multiplication can refer to multiplying elements at the same position. Taking the above example, the first scaled tensor A is positionally multiplied with the input tensor IR to obtain the scaled input tensor:

[0063]

[0064] Since the input tensor has been scaled, all elements in the input tensor can fall into the activation interval. By looking up the activation table, the scaled input tensor can be activated to obtain the activation tensor Y as the intermediate activation result.

[0065] Since the input tensor is scaled before activation, it can be restored after activation to obtain the final activation result, completing the entire activation process.

[0066] The specific recovery processing method may vary according to different activation operators. For example, for some activation operators, the activation result of the input tensor can be obtained by performing a positional multiplication of Y and the first recovery tensor B, such as Sigmoid, TanH (hyperbolic tangent function), etc. Or, for some activation operators, the activation result of the input tensor can be obtained by performing a positional addition of Y and the first recovery tensor B, such as Log for the loss function operator.

[0067] According to the computing device disclosed in the present invention, by scaling the input tensor, a larger input range can be covered with fewer activation tables, thereby maximizing the range of legal inputs without significantly reducing operator storage overhead and computing overhead.

[0068] It should be noted that, for the aforementioned process embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present disclosure is not limited by the described order of actions, because according to the present disclosure, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present disclosure.

[0069] It should be further noted that, although the various steps in the flowchart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowchart may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.

[0070] In a possible implementation, an artificial intelligence chip is also disclosed, which includes the above-mentioned computing device.

[0071] In a possible implementation, a board is also disclosed, which includes a storage device, an interface device, a control device and the above-mentioned artificial intelligence chip; wherein the artificial intelligence chip is connected to the storage device, the control device and the interface device respectively; the storage device is used to store data; the interface device is used to realize data transmission between the artificial intelligence chip and an external device; the control device is used to monitor the status of the artificial intelligence chip.

[0072] Figure 4 A structural block diagram of a board according to an embodiment of the present disclosure is shown. Figure 4 In addition to the chip 389, the board may also include other supporting components, including but not limited to: a storage device 390, an interface device 391 and a control device 392;

[0073] The storage device 390 is connected to the artificial intelligence chip via a bus for storing data. The storage device may include multiple groups of storage units 393. Each group of storage units is connected to the artificial intelligence chip via a bus. It is understood that each group of storage units may be DDR SDRAM (English: Double Data Rate SDRAM, double rate synchronous dynamic random access memory).

[0074] DDR can double the speed of SDRAM without increasing the clock frequency. DDR allows data to be read out on the rising and falling edges of the clock pulse. The speed of DDR is twice that of standard SDRAM. In one embodiment, the storage device may include 4 groups of storage units. Each group of storage units may include multiple DDR4 particles (chips). In one embodiment, the artificial intelligence chip may include 4 72-bit DDR4 controllers, 64 bits of the above 72-bit DDR4 controllers are used to transmit data, and 8 bits are used for ECC verification. It can be understood that when DDR4-3200 particles are used in each group of storage units, the theoretical bandwidth of data transmission can reach 25600MB / s.

[0075] In one embodiment, each group of the storage units includes a plurality of double rate synchronous dynamic random access memories arranged in parallel. DDR can transmit data twice in one clock cycle. A controller for controlling DDR is arranged in the chip to control the data transmission and data storage of each of the storage units.

[0076] The interface device is electrically connected to the artificial intelligence chip. The interface device is used to realize data transmission between the artificial intelligence chip and an external device (such as a server or a computer). For example, in one embodiment, the interface device may be a standard PCIE interface. For example, the data to be processed is transmitted to the chip by the server through a standard PCIE interface to realize data transfer. Preferably, when the PCIE 3.0X 16 interface is used for transmission, the theoretical bandwidth can reach 16000MB / s. In another embodiment, the interface device may also be other interfaces. The present disclosure does not limit the specific forms of expression of the above-mentioned other interfaces, and the interface unit can realize the switching function. In addition, the calculation results of the artificial intelligence chip are still transmitted back to the external device (such as a server) by the interface device.

[0077] The control device is electrically connected to the artificial intelligence chip. The control device is used to monitor the state of the artificial intelligence chip. Specifically, the artificial intelligence chip and the control device can be electrically connected through an SPI interface. The control device may include a single-chip microcomputer (Micro Controller Unit, MCU). For example, the artificial intelligence chip may include multiple processing chips, multiple processing cores or multiple processing circuits, which can drive multiple loads. Therefore, the artificial intelligence chip can be in different working states such as multi-load and light load. The control device can realize the regulation of the working states of multiple processing chips, multiple processing and / or multiple processing circuits in the artificial intelligence chip.

[0078] In a possible implementation, an electronic device is disclosed, which includes the above-mentioned artificial intelligence chip. The electronic device includes a data processing device, a robot, a computer, a printer, a scanner, a tablet computer, a smart terminal, a mobile phone, a driving recorder, a navigator, a sensor, a camera, a server, a cloud server, a camera, a video camera, a projector, a watch, a headset, a mobile storage, a wearable device, a means of transportation, a household appliance, and / or a medical device. The means of transportation include an airplane, a ship and / or a vehicle; the household appliance includes a television, an air conditioner, a microwave oven, a refrigerator, an electric rice cooker, a humidifier, a washing machine, an electric lamp, a gas stove, and a range hood; the medical device includes an MRI, an ultrasound machine and / or an electrocardiograph.

[0079] Figure 5 A block diagram of an electronic device 800 according to an embodiment of the present disclosure is shown. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, or the like.

[0080] Reference Figure 5 , the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .

[0081] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

[0082] The memory 804 is configured to store various types of data to support operations on the electronic device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0083] The power supply component 806 provides power to the various components of the electronic device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 800.

[0084] The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the electronic device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0085] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.

[0086] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.

[0087] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open / closed state of the electronic device 800, the relative positioning of the components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also detect the position change of the electronic device 800 or a component of the electronic device 800, the presence or absence of contact between the user and the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and the temperature change of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0088] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0089] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0090] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 804 including computer program instructions, which can be executed by a processor 820 of an electronic device 800 to perform the above method.

[0091] Figure 6 1 is a block diagram of an electronic device 1900 according to an embodiment of the present disclosure. For example, the electronic device 1900 may be provided as a server. Figure 6, the electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932 for storing instructions executable by the processing component 1922, such as an application. The application stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute instructions to perform the above method.

[0092] The electronic device 1900 may also include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output (I / O) interface 1958. The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™ or the like.

[0093] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions, which can be executed by the processing component 1922 of the electronic device 1900 to perform the above method.

[0094] In the above embodiments, the description of each embodiment has its own emphasis. For the part not described in detail in a certain embodiment, please refer to the relevant description of other embodiments. The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0095] The foregoing content can be better understood in accordance with the following terms:

[0096] Clause A1. A computing device, the computing device comprising:

[0097] a processing unit, a first storage unit, and a second storage unit;

[0098] The computing device receives external input data and a binary executable file,

[0099] The input data includes an activation table and an input tensor to be processed, and the computing device stores the activation table in a first storage unit and stores the input tensor in a second storage unit;

[0100] When the processing unit runs the binary executable file, it reads the input tensor from the second storage unit, scales the input tensor to obtain a scaled input tensor, searches the activation table in the first storage unit to activate the scaled input tensor to obtain an intermediate activation result, scales and restores the intermediate activation result to obtain an activation result, and outputs the activation result to the second storage unit.

[0101] Clause A2. The computing device of clause A1, wherein the scaling process comprises:

[0102] The processing unit calculates a first scaling tensor according to the input tensor, the activation interval, and the scaling coefficient, and performs a bitwise multiplication of the first scaling tensor and the input tensor to obtain a scaled input tensor;

[0103] The scaling recovery process includes: the processing unit performs recovery processing on the intermediate activation result using the first recovery tensor according to the input tensor, the activation interval and the recovery coefficient first recovery tensor to obtain the activation result of the input tensor;

[0104] Among them, the activation interval is used to indicate the range of values ​​that the activation table can cover, the scaling factor is used to indicate the multiple by which the data in the input tensor is scaled, and the recovery factor is used to indicate the multiple by which the intermediate activation result is scaled and restored.

[0105] Clause A3. The computing device according to clause A2, wherein the processing unit is configured to:

[0106] Determine a first index tensor and a second index tensor according to the input tensor and the activation interval;

[0107] Calculate a second scaling tensor according to the second index tensor and the scaling factor, and calculate a second restoration tensor according to the second index tensor and the restoration factor;

[0108] A first scaled tensor is calculated according to the first index tensor and the second scaled tensor, and a first restored tensor is calculated according to the first index tensor and the second restored tensor.

[0109] Clause A4. A computing device according to clause A2 or A3, wherein the shapes of the first index tensor and the second index tensor are the same as the shape of the input tensor,

[0110] If any element in the input tensor is within the activation interval, the element at the position corresponding to the element in the first index tensor is 1, and the element at the position corresponding to the element in the second index tensor is 0;

[0111] If any element in the input tensor is not in the activation interval, the element at the position corresponding to the element in the first index tensor is 0, and the element at the position corresponding to the element in the second index tensor is 1.

[0112] Clause A5. According to the computing device described in Clause A3, the processing unit is used to multiply the elements in the second index tensor by the scaling factor to obtain the second scaling tensor, and multiply the elements in the second index tensor by the restoration factor to obtain the second restoration tensor.

[0113] Clause A6. In the computing device according to any one of clauses A3 to A5, the first scaling tensor is the sum of a first index tensor and a second scaling tensor, and the first recovery tensor is the sum of a first index tensor and a second recovery tensor.

[0114] Clause A7. In the computing device according to any one of clauses A1 to A6, the input tensor is tensor data extracted from an image, audio or video.

[0115] Clause A8. A computing device according to any one of clauses A1 to A6,

[0116] The first storage unit is an on-chip static random access memory SRAM, and the second storage unit is an off-chip double data rate DDR memory.

[0117] Item A9. An artificial intelligence chip, comprising a computing device as described in any one of Items A1-A8.

[0118] Item A10. An electronic device comprising an artificial intelligence chip as described in Item A9.

[0119] Clause A11. A board comprising: a storage device, an interface device, a control device, and an artificial intelligence chip as described in Clause A9;

[0120] Wherein, the artificial intelligence chip is connected to the storage device, the control device and the interface device respectively;

[0121] The storage device is used to store data;

[0122] The interface device is used to realize data transmission between the artificial intelligence chip and external equipment;

[0123] The control device is used to monitor the status of the artificial intelligence chip.

[0124] The embodiments of the present disclosure are described in detail above. Specific examples are used herein to illustrate the principles and implementation methods of the present disclosure. The description of the above embodiments is only used to help understand the method and its core idea of ​​the present disclosure. At the same time, changes or deformations made by those skilled in the art based on the ideas of the present disclosure, the specific implementation methods and the scope of application of the present disclosure, all belong to the scope of protection of the present disclosure. In summary, the content of this specification should not be understood as a limitation on the present disclosure.

Claims

1. A computing device, characterized in that: The computing device comprises: a processing unit, a first storage unit, and a second storage unit; The computing device receives external input data and a binary executable file, The input data includes an activation table and an input tensor to be processed, and the computing device stores the activation table in a first storage unit and stores the input tensor in a second storage unit; When the processing unit runs the binary executable file, the processing unit reads an input tensor from the second storage unit, performs scaling processing on the input tensor to obtain a scaled input tensor, searches the activation table in the first storage unit to activate the scaled input tensor to obtain an intermediate activation result, performs scaling recovery processing on the intermediate activation result to obtain an activation result, and outputs the activation result to the second storage unit; The processing unit is used for: Determine a first index tensor and a second index tensor according to the input tensor and the activation interval; Calculate a second scaling tensor according to the second index tensor and the scaling factor, and calculate a second restoration tensor according to the second index tensor and the restoration factor; Calculate a first scaled tensor according to the first index tensor and the second scaled tensor, and calculate a first restored tensor according to the first index tensor and the second restored tensor; The shapes of the first index tensor and the second index tensor are the same as the input tensor. If any element in the input tensor is within the activation interval, the element at the position corresponding to the element in the first index tensor is 1, and the element at the position corresponding to the element in the second index tensor is 0; If any element in the input tensor is not in the activation interval, the element at the position corresponding to the element in the first index tensor is 0, and the element at the position corresponding to the element in the second index tensor is 1.

2. The computing device according to claim 1, wherein: The scaling process includes: The processing unit calculates a first scaling tensor according to the input tensor, the activation interval, and the scaling coefficient, and performs a bitwise multiplication of the first scaling tensor and the input tensor to obtain a scaled input tensor; The scaling recovery process includes: the processing unit performs recovery processing on the intermediate activation result using the first recovery tensor according to the input tensor, the activation interval and the recovery coefficient first recovery tensor to obtain the activation result of the input tensor; Among them, the activation interval is used to indicate the range of values ​​that the activation table can cover, the scaling factor is used to indicate the multiple by which the data in the input tensor is scaled, and the recovery factor is used to indicate the multiple by which the intermediate activation result is scaled and restored.

3. The computing device according to claim 1, wherein: The processing unit is used to multiply the elements in the second index tensor by the scaling factor to obtain a second scaling tensor, and multiply the elements in the second index tensor by the restoration factor to obtain a second restoration tensor.

4. The computing device according to claim 1, wherein: The first scaling tensor is the sum of a first index tensor and a second scaling tensor, and the first recovery tensor is the sum of a first index tensor and a second recovery tensor.

5. The computing device according to any one of claims 1 to 4, characterized in that: The input tensor is tensor data extracted from an image, audio, or video.

6. The computing device according to any one of claims 1 to 4, characterized in that: The first storage unit is an on-chip static random access memory SRAM, and the second storage unit is an off-chip double data rate DDR memory.

7. An artificial intelligence chip, characterized in that: The chip comprises a computing device as described in any one of claims 1-6.

8. An electronic device, characterized in that: The electronic device comprises the artificial intelligence chip as claimed in claim 7.

9. A board, characterized in that: The board includes: a storage device, an interface device and a control device and the artificial intelligence chip as claimed in claim 7; Wherein, the artificial intelligence chip is connected to the storage device, the control device and the interface device respectively; The storage device is used to store data; The interface device is used to realize data transmission between the artificial intelligence chip and external equipment; The control device is used to monitor the status of the artificial intelligence chip.