Tensor processing method and device, equipment and medium
By constructing a database in the N-dimensional coordinate space, dividing the target subspace using the candidate slicing parameter set and proportional threshold, efficiently determining the tensor slicing parameters, solving the problems of low tensor processing efficiency and waste of resources in the existing technology, realizing the More efficient tensor processing.
Patent Information
- Application Number
- CN202411412545.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-10
- Publication Date
- 2025-01-03
AI Technical Summary
When determining tensor slicing parameters in the prior art, the prediction accuracy is not high, resulting in low tensor processing efficiency, and traditional methods consume a large amount of hardware resources and are costly.
By constructing a database in the N-dimensional coordinate space, the preferred slicing parameter information of the tensor is stored, the target subspace is divided using the set of candidate slicing parameters and proportional thresholds, and the range of the lookup table is narrowed to efficiently determine the tensor slicing parameters.
It improves tensor processing efficiency, reduces hardware resource waste, reduces costs, and achieves more efficient tensor slitting and processing.
Smart Images

Figure CN119248750A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technology, in particular to the field of artificial intelligence and distributed processing technology, and specifically to a tensor processing method, device, electronic device, computer-readable storage medium, and computer program product. Background Art
[0002] Artificial intelligence is a discipline that studies how to use computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.). It includes both hardware-level and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing; artificial intelligence software technologies mainly include computer vision technology, speech recognition technology, natural language processing technology, as well as machine learning / deep learning, big data processing technology, knowledge graph technology, and other major directions.
[0003] With the development of artificial intelligence technology, more and more applications based on artificial intelligence technology have achieved results far exceeding traditional algorithms. Deep learning is a data-intensive and computationally intensive algorithm. The data to be processed is usually in the form of multi-dimensional tensors. In order to improve the efficiency of deep learning-based neural network models in processing complex tasks, the input data tensor can be segmented, and then multiple processing hardware can be used to perform distributed processing on the segmented tensors.
[0004] The methods described in this section are not necessarily methods that have been previously conceived or employed. Unless otherwise indicated, it should not be assumed that any method described in this section is considered to be prior art simply because it is included in this section. Similarly, unless otherwise indicated, the issues mentioned in this section should not be considered to have been recognized in any prior art. Summary of the invention
[0005] The present disclosure provides a tensor processing method, apparatus, electronic device, computer-readable storage medium, and computer program product.
[0006] According to one aspect of the present disclosure, a tensor processing method is provided, comprising: querying a first segmentation parameter from a database based on the size of a first tensor to be processed; determining a plurality of sub-tensors by segmenting the first tensor based on the first segmentation parameter; and processing the plurality of sub-tensors in parallel using a plurality of processing units, wherein the dimension of the first tensor is a positive integer N, and the database is constructed using the following process: determining a plurality of discrete points in an N-dimensional coordinate space, wherein the coordinate values of each of the plurality of discrete points in the N-dimensional coordinate space are positive integers; for each of the plurality of discrete points, determining a set of candidate segmentation parameters corresponding to the discrete point; and dividing the N-dimensional coordinate space into a plurality of target subspaces. , wherein at least one discrete point in each target subspace satisfies the following first condition: there are multiple first discrete points in the target subspace, wherein there is a common segmentation parameter in the candidate segmentation parameter set of each first discrete point in the multiple first discrete points, and wherein the number ratio of the at least one first discrete point in the target subspace is not less than the ratio threshold, and wherein querying the first segmentation parameter from the database based on the size of the first tensor to be processed includes: determining the first target subspace where the target point is located, wherein the coordinate values of the target point in the N dimensions are determined based on the size of the first tensor along the N dimensions; and determining the common segmentation parameter corresponding to the first target subspace as the first segmentation parameter.
[0007] According to another aspect of the present disclosure, a tensor processing device is provided, comprising: a query unit, configured to query a first segmentation parameter from a database based on the size of a first tensor to be processed; a first determination unit, configured to determine a plurality of sub-tensors by segmenting the first tensor based on the first segmentation parameter; and a plurality of processing units, configured to process the plurality of sub-tensors in parallel, wherein the dimension of the first tensor is a positive integer N, and the database is constructed using a database construction device, the database construction device comprising: a second determination unit, configured to determine a plurality of discrete points in an N-dimensional coordinate space, wherein the coordinate values of the N dimensions of each of the plurality of discrete points in the N-dimensional coordinate space are positive integers; a third determination unit, configured to determine, for each of the plurality of discrete points, a candidate segmentation parameter corresponding to the discrete point. parameter set; and a division unit, configured to divide the N-dimensional coordinate space into a plurality of target subspaces, wherein at least one discrete point in each target subspace satisfies the following first condition: there are a plurality of first discrete points in the target subspace, wherein a common segmentation parameter exists in a candidate segmentation parameter set for each of the plurality of first discrete points, and wherein a quantity ratio of the at least one first discrete point in the target subspace is not less than a ratio threshold, and wherein the query unit comprises: a first determination subunit, configured to determine a first target subspace in which a target point is located, wherein the coordinate values of the target point in the N dimensions are determined based on the size of the first tensor along the N dimensions; and a second determination subunit, configured to determine that the common segmentation parameter corresponding to the first target subspace is the first segmentation parameter.
[0008] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the above-mentioned tensor processing method.
[0009] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the tensor processing method described above.
[0010] According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein the computer program can implement the above tensor processing method when executed by a processor.
[0011] According to one or more embodiments of the present disclosure, tensor splitting parameters may be determined more efficiently, thereby improving tensor processing efficiency.
[0012] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.
[0014] Figure 1 A schematic diagram showing an exemplary system in which the various methods described herein may be implemented according to an exemplary embodiment of the present disclosure;
[0015] Figure 2 A flowchart of a tensor processing method according to an exemplary embodiment of the present disclosure is shown;
[0016] Figure 3 A flowchart of a database construction method according to an exemplary embodiment of the present disclosure is shown;
[0017] Figure 4 A flowchart of a process of determining multiple target subspaces according to an exemplary embodiment of the present disclosure is shown;
[0018] Figure 5 A schematic diagram showing a process of determining multiple target subspaces according to an exemplary embodiment of the present disclosure;
[0019] Figure 6 A structural block diagram of a tensor processing device according to an exemplary embodiment of the present disclosure is shown;
[0020] Figure 7 A structural block diagram of a database construction device according to an exemplary embodiment of the present disclosure is shown;
[0021] Figure 8 A structural block diagram of an exemplary electronic device that can be used to implement the embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0022] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0023] In the present disclosure, unless otherwise specified, the use of the terms "first", "second", etc. to describe various elements is not intended to limit the positional relationship, timing relationship, or importance relationship of these elements, and such terms are only used to distinguish one element from another element. In some examples, the first element and the second element may refer to the same instance of the element, and in some cases, based on the description of the context, they may also refer to different instances.
[0024] The terms used in the description of various examples in this disclosure are only for the purpose of describing specific examples and are not intended to be limiting. Unless the context clearly indicates otherwise, if the number of elements is not specifically limited, the element can be one or more. In addition, the term "and / or" used in this disclosure covers any one of the listed items and all possible combinations.
[0025] The embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.
[0026] Figure 1 FIG. 1 is a schematic diagram of an exemplary system 100 in which various methods and apparatuses described herein may be implemented according to an embodiment of the present disclosure. Figure 1 , the system 100 includes one or more client devices 101, 102, 103, 104, 105, and 106, a server 120, and one or more communication networks 110 coupling the one or more client devices to the server 120. The client devices 101, 102, 103, 104, 105, and 106 may be configured to execute one or more applications.
[0027] In an embodiment of the present disclosure, the server 120 may run one or more services or software applications that enable execution of tensor processing methods.
[0028] In some embodiments, server 120 may also provide other services or software applications, which may include non-virtualized environments and virtualized environments. In some embodiments, these services may be provided as web-based services or cloud services, such as provided to users of client devices 101, 102, 103, 104, 105, and / or 106 under a software as a service (SaaS) model.
[0029] exist Figure 1In the configuration shown, the server 120 may include one or more components that implement the functions performed by the server 120. These components may include software components, hardware components, or a combination thereof that can be executed by one or more processors. Users operating client devices 101, 102, 103, 104, 105, and / or 106 may in turn utilize one or more client applications to interact with the server 120 to utilize the services provided by these components. It should be understood that a variety of different system configurations are possible, which may differ from the system 100. Therefore, Figure 1 is one example of a system for implementing the various methods described herein and is not intended to be limiting.
[0030] A user may use client devices 101, 102, 103, 104, 105, and / or 106 to send a tensor to be processed or a tensor processing request. The client device may provide an interface that enables a user of the client device to interact with the client device. The client device may also output information to the user via the interface. Figure 1 Only six client devices are depicted, but one skilled in the art will appreciate that the present disclosure may support any number of client devices.
[0031] Client devices 101, 102, 103, 104, 105 and / or 106 may include various categories of computer devices, such as portable handheld devices, general-purpose computers (such as personal computers and laptop computers), workstation computers, wearable devices, smart screen devices, self-service terminal devices, service robots, game systems, thin clients, various messaging devices, sensors or other sensing devices, etc. These computer devices may run various categories and versions of software applications and operating systems, such as MICROSOFT Windows, APPLE iOS, UNIX-like operating systems, Linux or Linux-like operating systems (such as GOOGLE Chrome OS); or include various mobile operating systems, such as MICROSOFT Windows Mobile OS, iOS, Windows Phone, Android. Portable handheld devices may include cellular phones, smart phones, tablet computers, personal digital assistants (PDAs), etc. Wearable devices may include head-mounted displays (such as smart glasses) and other devices. Game systems may include various handheld game devices, Internet-enabled game devices, etc. The client device is capable of executing a variety of different applications, such as various Internet-related applications, communication applications (eg, email applications), short message service (SMS) applications, and may use various communication protocols.
[0032] The network 110 may be any type of network known to those skilled in the art that may support data communications using any of a variety of available protocols, including but not limited to TCP / IP, SNA, IPX, etc. By way of example only, one or more networks 110 may be a local area network (LAN), an Ethernet-based network, a token ring, a wide area network (WAN), the Internet, a virtual network, a virtual private network (VPN), an intranet, an extranet, a blockchain network, a public switched telephone network (PSTN), an infrared network, a wireless network (e.g., Bluetooth, WIFI), and / or any combination of these and / or other networks.
[0033] Server 120 may include one or more general purpose computers, dedicated server computers (e.g., PC (personal computer) servers, UNIX servers, mid-range servers), blade servers, mainframe computers, server clusters, or any other suitable arrangement and / or combination. Server 120 may include one or more virtual machines running virtual operating systems, or other computing architectures involving virtualization (e.g., one or more flexible pools of logical storage devices that may be virtualized to maintain a server's virtual storage device). In various embodiments, server 120 may run one or more services or software applications that provide the functionality described below.
[0034] The computing units in the server 120 may run one or more operating systems including any of the above operating systems and any commercially available server operating systems. The server 120 may also run any of a variety of additional server applications and / or middle-tier applications, including HTTP servers, FTP servers, CGI servers, JAVA servers, database servers, etc.
[0035] In some implementations, server 120 may include one or more applications to analyze and consolidate data feeds and / or event updates received from users of client devices 101, 102, 103, 104, 105, and 106. Server 120 may also include one or more applications to display data feeds and / or real-time events via one or more display devices of client devices 101, 102, 103, 104, 105, and 106.
[0036] In some embodiments, the server 120 may be a server of a distributed system, or a server combined with a blockchain. The server 120 may also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology. A cloud server is a host product in a cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and virtual private servers (VPS) services.
[0037] The system 100 may also include one or more databases 130. In some embodiments, these databases may be used to store data and other information. For example, one or more of the databases 130 may be used to store information such as audio files and video files. The databases 130 may reside in various locations. For example, the database used by the server 120 may be local to the server 120, or may be remote from the server 120 and may communicate with the server 120 via a network-based or dedicated connection. The databases 130 may be of different categories. In some embodiments, the databases used by the server 120 may be, for example, relational databases. One or more of these databases may store, update, and retrieve data to and from the databases in response to commands.
[0038] In some embodiments, one or more of the databases 130 may also be used by applications to store application data. The databases used by the applications may be different categories of databases, such as a key-value store, an object store, or a conventional store backed by a file system.
[0039] Figure 1 The system 100 may be configured and operated in various ways to enable the application of various methods and apparatuses described in the present disclosure.
[0040] Tensor splitting technology means splitting tensor data, and then scheduling the calculation process of the split tensor to multiple processing units, using multiple processing units to perform parallel calculations, thereby improving the efficiency of tensor processing. In this case, different tensor splitting parameters or tensor splitting strategies will significantly affect the performance of tensor processing. When tensor splitting and processing are implemented using tensor splitting parameters that are suitable for the tensor scale, the hardware utilization and computing efficiency of the processing unit can be significantly improved. When the tensor splitting parameters are not suitable for the tensor scale, it may lead to a waste of hardware resources, thereby affecting the computing performance.
[0041] Understandably, the tensor splitting strategy is closely related to the hardware architecture. For example, splitting a tensor for calculation may involve multiple levels, such as first splitting it to multiple hardware cards, then splitting it to multiple cores on each card, which may involve multiple levels of memory allocation. When the hardware design is more complex, the tensor splitting strategy may involve a large number of mutually coupled variable parameters. In this case, a complex process is required to determine the tensor splitting parameters.
[0042] In the related art, a method for determining tensor splitting parameters is based on the model prediction-pruning method. By modeling the memory access and operation behaviors in the tensor processing process based on the hardware architecture, the simulation model obtained by modeling can be used to predict the impact of various tensor splitting parameters on processing performance, and then the tensor splitting parameters with poor processing performance can be pruned, and the optimal tensor splitting parameters can be determined based on the pruning results. However, since the prediction accuracy of the model has a certain degree of uncontrollability, when the model cannot accurately predict the performance of different parameters, it will directly affect the efficiency of tensor splitting and processing.
[0043] Another method to determine the tensor splitting parameters is to traverse all legal solutions of the tensor splitting parameters, determine the impact of each legal solution on the processing performance through traversal, and determine the optimal tensor splitting parameters based on this. However, this method consumes a lot of hardware resources, is costly and inefficient.
[0044] Based on this, the present disclosure provides a tensor processing method, which builds a database based on an N-dimensional coordinate space to store the preferred segmentation parameter information of the tensor. The coordinate value of each discrete point in the N-dimensional coordinate space can indicate a tensor size, and the candidate segmentation parameter set records the corresponding optimal segmentation parameters of the tensor size. By determining multiple target subspaces in the N-dimensional coordinate space, it is possible to search for a common optimal solution corresponding to a similar tensor scale within a certain spatial range (i.e., a tensor size range with similar values). By looking up a table for multiple target subspaces, the table lookup range can be effectively narrowed, and the tensor segmentation parameters can be determined more efficiently, thereby improving the efficiency of tensor processing.
[0045] Figure 2 FIG. 2 shows a flow chart of a tensor processing method 200 according to an exemplary embodiment of the present disclosure. Figure 2 As shown, the method 200 includes:
[0046] Step S210: querying a first segmentation parameter from a database based on the size of the first tensor to be processed;
[0047] Step S220, determining a plurality of sub-tensors by splitting the first tensor based on the first splitting parameter; and
[0048] Step S230: Process the multiple sub-tensors in parallel using multiple processing units, wherein the dimension of the first tensor is a positive integer N, and the database is constructed using the following database construction method 300. Figure 3 FIG. 3 shows a flow chart of a database construction method 300 according to an exemplary embodiment of the present disclosure. Figure 3 As shown, the method 300 includes:
[0049] Step S301, determining a plurality of discrete points in an N-dimensional coordinate space, wherein the coordinate values of each of the plurality of discrete points in N dimensions in the N-dimensional coordinate space are positive integers;
[0050] Step S302: for each discrete point among the plurality of discrete points, determine a set of candidate segmentation parameters corresponding to the discrete point; and
[0051] Step S303: divide the N-dimensional coordinate space into a plurality of target subspaces, wherein at least one discrete point in each target subspace satisfies the following first condition: there are a plurality of first discrete points in the target subspace, wherein a common segmentation parameter exists in a candidate segmentation parameter set of each first discrete point in the plurality of first discrete points, and wherein a number ratio of the at least one first discrete point in the target subspace is not less than a ratio threshold,
[0052] And wherein step S210 includes:
[0053] Step S211, determining a first target subspace where a target point is located, wherein the coordinate values of the target point in the N dimensions are determined based on the sizes of the first tensor along the N dimensions; and
[0054] Step S212: Determine the common segmentation parameter corresponding to the first target subspace as the first segmentation parameter.
[0055] By applying the above method 300, a database can be constructed based on an N-dimensional coordinate space to store preferred segmentation parameter information of tensors, and the coordinate value of each discrete point in the N-dimensional coordinate space can indicate a tensor scale. For example, when N is 3, the discrete point (3,3,3) refers to the characteristics of a tensor of size 3×3×3. Further, by determining a candidate segmentation parameter set in step S302, the candidate segmentation parameter set can be used to record feasible segmentation parameters corresponding to each tensor size. For example, the candidate segmentation parameter set corresponding to the discrete point (3,3,3) can record segmentation parameters that can be used to segment a 3×3×3 tensor.
[0056] In some examples, the set of candidate segmentation parameters for each discrete point can be pre-screened from multiple sets of initial segmentation parameters. For example, the segmentation parameters can be screened based on the convenience of the tensor segmentation process, or can be screened based on the corresponding processing performance of the tensor segmentation results.
[0057] By dividing the N-dimensional coordinate space into multiple target subspaces in step S303, multiple tensor scales can be divided into multiple intervals (corresponding to multiple target subspaces). According to the first condition above, it can be seen that the discrete points exceeding the ratio threshold in each target subspace can correspond to a common segmentation parameter, that is, have a common feasible solution. It can be understood that the feasible segmentation parameters corresponding to tensors of similar sizes (i.e., discrete points with similar distances in the N-dimensional coordinate space) are also relatively close. In this case, the common segmentation parameters corresponding to each target subspace are the feasible segmentation parameters corresponding to each discrete point (i.e., various tensor scales) included in the target subspace.
[0058] By applying the above method 300, that is, when using a candidate split parameter set to indicate feasible solutions corresponding to various tensor scales, the characteristic that tensors of similar sizes can correspond to similar feasible solutions is utilized, and the common split parameters corresponding to multiple target subspaces are used to indicate feasible split strategy information corresponding to various tensor scales, thereby effectively reducing the data scale for the optimal tensor split parameters, that is, reducing the table lookup range of data query. In the tensor processing process, by applying the above method 200, that is, querying the small-scale database constructed by using method 300, improving query efficiency by reducing the table lookup range, that is, being able to more efficiently determine the optimal tensor split parameters and improve tensor processing efficiency.
[0059] In some examples, the splitting parameters of the tensor may include one or more contents, such as indicating the number of splits of the tensor in N dimensions, the split positions of the tensor in N dimensions, the split symmetry of the tensor in N dimensions, etc. In some examples, the splitting parameters of the tensor may be stored using structured data (e.g., json format data).
[0060] In some examples, the first tensor to be processed is obtained by encoding based on the data to be processed, and the data to be processed may include at least one of the following: voice data, image data, and text data.
[0061] In some examples, the first tensor to be processed may be obtained by encoding natural language text data, and the encoding method may be, for example, one-hot encoding. By performing tensor operations on the encoded tensor of text data, various types of natural language processing tasks may be implemented, for example, natural language text data may be mapped to an embedding space, and a semantic feature tensor may be obtained through an embedding representation operation, and then semantic analysis, entity extraction, and other operations may be performed based on this.
[0062] In some examples, the first tensor to be processed may be obtained by encoding image data, for example, it may be directly encoded based on information such as pixel coordinates, pixel color values, channel values, etc. of the image. By performing tensor operations on the encoded tensor of the image data, various types of image processing tasks may be implemented, for example, image features may be extracted through operations such as image convolution and image inversion, thereby implementing operations such as image classification, object detection, and instance segmentation.
[0063] In some examples, the first tensor to be processed can be obtained by encoding the voice data, for example, it can be directly encoded based on the timing information and spectrum information of the voice data. By performing tensor operations on the encoded tensor of the voice data, various types of voice processing tasks can be achieved, for example, voice features can be extracted through operations such as spectrum changes, thereby achieving operations such as voice recognition and voice conversion.
[0064] According to some embodiments, the distance between any two discrete points in the multiple discrete points in the N-dimensional coordinate space determined in step S301 or the distance between the multiple discrete points and the boundary of the N-dimensional coordinate space is not greater than a distance threshold. By applying the above-mentioned constraint conditions to control the distribution characteristics of the multiple discrete points, the comprehensiveness of the distribution of the multiple discrete points in the N-dimensional coordinate space can be guaranteed, so as to ensure that the target subspace can be accurately divided based on the information of the multiple discrete points, thereby improving the accuracy of tensor segmentation and the efficiency of tensor processing.
[0065] In some examples, the distance threshold can be set in advance according to actual needs. By using the distance threshold to constrain the distance between any two discrete points, it is possible to avoid the existence of an empty range that does not contain any discrete points and exceeds the tolerance limit in the N-dimensional coordinate space. By using the distance threshold to constrain the distance between multiple discrete points and the boundary of the N-dimensional coordinate space, it is possible to avoid the existence of an empty range that does not contain any discrete points and exceeds the tolerance limit near the boundary of the N-dimensional coordinate space, so that the candidate segmentation parameter sets corresponding to the multiple discrete points can fully indicate the characteristics of the entire tensor scale defined by the N-dimensional coordinate space, so as to ensure that the target subspace can be accurately divided based on the information of multiple discrete points, thereby improving the accuracy of the tensor segmentation strategy and improving the efficiency of tensor processing.
[0066] In some examples, the distribution characteristics of multiple discrete points in the N-dimensional coordinate space may also be controlled based on other constraints. For example, the maximum blank subspace that does not contain any discrete points may be determined in the N-dimensional coordinate space, and the volume ratio of the maximum blank subspace to the entire N-dimensional coordinate space may be constrained to avoid the existence of an empty range that does not contain any discrete points and exceeds the tolerance limit in the N-dimensional coordinate space, so as to ensure that the target subspace can be accurately divided based on the information of multiple discrete points.
[0067] According to some embodiments, the multiple discrete points in step S301 are determined in the following manner: the multiple discrete points are determined by sampling in the N-dimensional coordinate space based on a sampling step, wherein the value of the sampling step is a positive integer. By sampling based on the sampling step to determine the multiple discrete points in the N-dimensional coordinate space, the uniformity of the distribution of the discrete points in the space can be ensured, and the distribution of the discrete points is prevented from being too dense, thereby reducing the amount of calculation required for step S302 and step S303, and improving the efficiency of database construction.
[0068] According to some embodiments, the plurality of discrete points are evenly distributed in the N-dimensional coordinate space. When the plurality of discrete points are evenly distributed in the N-dimensional coordinate space, the characteristics of the entire tensor scale defined by the N-dimensional coordinate space can be more fully realized to ensure that the target subspace can be accurately divided based on the information of the plurality of discrete points.
[0069] According to some embodiments, each candidate segmentation parameter in the candidate segmentation parameter set satisfies the following second condition: the processing time of the segmentation result obtained by segmenting the N-dimensional second tensor based on the candidate segmentation parameter is not greater than the time threshold, wherein the size of the second tensor along the N dimensions is the coordinate value of the discrete point in the N-dimensional coordinate space in the N-dimensional coordinate space. By determining the candidate segmentation parameter set corresponding to each discrete point based on the above-mentioned constraints, it can be ensured that the segmentation parameters in the candidate segmentation parameter set correspond to better tensor processing performance, so as to ensure that a better tensor segmentation strategy can be determined based on this, thereby improving tensor processing efficiency.
[0070] In some examples, the candidate splitting parameters may also be determined based on other constraints. For example, the hardware resource occupancy rate (e.g., processor occupancy rate, memory occupancy rate) of the splitting result obtained by splitting the N-dimensional second tensor based on a set of candidate splitting parameters may be determined to screen the candidate splitting parameters to ensure that the splitting parameters in the candidate splitting parameter set correspond to better tensor processing performance, thereby improving tensor processing efficiency.
[0071] According to some embodiments, in step S302, for each of the plurality of discrete points, determining the candidate segmentation parameter set corresponding to the discrete point includes: for each of the plurality of initial segmentation parameters, determining the processing time of the segmentation result obtained by segmenting the second tensor corresponding to the discrete point based on the initial segmentation parameter; determining the time threshold corresponding to the discrete point based on the processing time corresponding to each of the plurality of initial segmentation parameters; and for each of the plurality of initial segmentation parameters, in response to determining that the processing time corresponding to the initial segmentation parameter is not greater than the time threshold corresponding to the discrete point, adding the initial segmentation parameter to the candidate segmentation parameter set corresponding to the discrete point. By determining the time threshold based on the processing time of each of the plurality of initial segmentation parameters corresponding to each discrete point, the time threshold corresponding to each discrete point can be adapted to the characteristics of the discrete point (i.e., the size of the tensor), so as to accurately select a better candidate segmentation parameter for each tensor size and improve the accuracy of the candidate segmentation parameter set.
[0072] According to some embodiments, the determining of the duration threshold corresponding to the discrete point based on the processing durations corresponding to the multiple initial segmentation parameters includes: determining the minimum value of the processing durations corresponding to the multiple initial segmentation parameters; and determining the duration threshold based on the sum of the minimum value and the tolerance difference. The duration threshold is obtained by summing the optimal processing duration (i.e., the minimum value of the processing duration) and the tolerance difference, which can ensure that the processing duration corresponding to the candidate segmentation parameters meets the reasoning performance requirements.
[0073] In some examples, the processing times corresponding to the multiple initial segmentation parameters may be sorted, and the time threshold may be determined based on the order of arrangement. In this case, the capacity of the candidate segmentation parameter set may be preset according to actual needs. For example, when the capacity of the candidate segmentation parameter set is 10, the processing time ranked 10th may be used as the time threshold corresponding to the discrete point to ensure that a preset number of candidate segmentation parameters can be selected based on this.
[0074] In some examples, the tolerance difference may be calculated based on the minimum value and a preset tolerance percentage, or may be a preset constant. As long as the tolerance difference can effectively constrain the processing performance of the candidate segmentation parameters, the disclosure does not limit the specific method for determining the tolerance difference.
[0075] According to some embodiments, the second target subspace in the plurality of target subspaces is determined by: determining a first initial point from the plurality of discrete points; determining a plurality of first extended subspaces by extending in a plurality of extension directions based on the first initial point, wherein the plurality of extension directions include the coordinate axis directions of the N dimensions; in response to determining that there is at least one first candidate subspace satisfying the first condition in the plurality of first extended subspaces, determining the second target subspace based on the first candidate subspace with the highest numerical ratio of the first discrete points in the at least one first candidate subspace; and in response to determining that there is no first extended subspace satisfying the first condition in the plurality of first extended subspaces, determining the space including only the first initial point as the second target subspace. By applying the above method, the optimal extension result can be selected by trying a plurality of extension directions during the database construction process, so that the segmentation result of the target subspace can be optimized, so that the first discrete points satisfying the common optimal solution standard in the target subspace are as many as possible, so that the common segmentation parameters corresponding to each target subspace can more comprehensively indicate the optimal solutions of various tensor sizes within the subspace range.
[0076] According to some embodiments, the determining of the second target subspace based on the first candidate subspace with the highest numerical ratio of the first discrete points in the at least one first candidate subspace includes: determining multiple second extended subspaces by extending the first candidate subspace with the highest numerical ratio of the first discrete points in the multiple extension directions; and in response to determining that there is at least one second candidate subspace that satisfies the first condition in the multiple second extended subspaces, determining the second target subspace based on the second candidate subspace with the highest numerical ratio of the first discrete points in the at least one second candidate subspace. By repeatedly executing the step of "trying to expand", the largest possible target subspace can be obtained through iteration, thereby reducing the number of target subspaces, narrowing the table lookup range, and more efficiently determining the tensor segmentation parameters.
[0077] According to some embodiments, method 300 further includes: in response to determining that the number of discrete points in the first candidate subspace with the highest numerical ratio of the first discrete points is greater than a number threshold, updating the first condition by increasing the ratio threshold, wherein, in response to determining that there is at least one second candidate subspace that satisfies the first condition among the multiple second extended subspaces, determining the second target subspace based on the second candidate subspace with the highest numerical ratio of the first discrete points in the at least one second candidate subspace comprises: in response to determining that there is at least one second candidate subspace that satisfies the updated first condition among the multiple second extended subspaces, determining the second target subspace based on the second candidate subspace with the highest numerical ratio of the first discrete points in the at least one second candidate subspace. Thus, in the process of repeatedly executing the expansion step to increase the target subspace, the numerical ratio can be dynamically increased, that is, more discrete points that do not meet the common optimal solution standard are allowed to appear in the target subspace, that is, it is equivalent to reducing the constraints on the target subspace, thereby improving the success rate of space expansion, further expanding the range of the target subspace finally determined, thereby reducing the number of target subspaces and narrowing the table lookup range.
[0078] According to some embodiments, the determining of multiple first extended subspaces by extending in multiple extension directions based on the first initial point includes: extending in the multiple extension directions based on the first initial point and the extension step length, so that the extension size of the multiple first extended subspaces in each dimension of the N dimensions does not exceed the extension step length. By attempting to expand the target subspace based on the extension step length, the size of the extended subspace can be accurately controlled, which facilitates the detection of whether each extended subspace meets the first condition, reduces the amount of calculation in the attempted expansion step, and improves the efficiency of database construction.
[0079] According to some embodiments, determining the first initial point from the plurality of discrete points includes: determining the discrete point closest to the origin of the N-dimensional coordinate space among the plurality of discrete points as the first initial point. By attempting to expand the target subspace with the origin as the starting point, that is, only attempting to expand the target subspace in the positive direction of the N-dimensional coordinate axis, the calculation amount of the attempted expansion step can be reduced by limiting the possible expansion directions, thereby improving the efficiency of database construction.
[0080] According to some embodiments, the plurality of extension directions are determined in the following manner: determining (2 N -1) kinds of dimension combinations, wherein each dimension combination includes one or more of the N dimensions; and based on the (2 N -1) dimension combinations, determine (2 N-1) expansion directions. By trying to expand in all possible combinations based on N dimensions, expansion can be attempted in all possible expansion directions to improve expansion efficiency.
[0081] In one example, when the N-dimensional coordinate space is a three-dimensional coordinate space including three dimensions of X, Y, and Z, the expansion direction includes the following seven possibilities: expansion along three dimensions of X, Y, and Z, expansion along two dimensions of X and Y, expansion along two dimensions of X and Z, expansion along three dimensions of Y and Z, expansion along the X dimension, expansion along the Y dimension, and expansion along the Z dimension. By trying to expand in all combinations based on the three dimensions, it is possible to try to expand in all possible expansion directions to improve the expansion efficiency.
[0082] Figure 4 FIG. 4 is a flowchart of a process for determining multiple target subspaces according to an exemplary embodiment of the present disclosure. Figure 4 As shown, the process of determining multiple target subspaces includes the following steps:
[0083] Step S1, determining a plurality of discrete points in an N-dimensional coordinate space. In this example, step S1 may be obtained by uniformly sampling in the N-dimensional coordinate space based on a sampling step length.
[0084] Step S2: for each discrete point in the plurality of discrete points, determine a set of candidate segmentation parameters corresponding to the discrete point. In this example, step S2 can be implemented by traversing the processing time of each initial segmentation parameter for the discrete point and determining the candidate segmentation parameters based on the processing time.
[0085] Step S3, determine the spatial range to be processed. In the initial stage of target subspace division, the spatial range to be processed is the entire N-dimensional coordinate space. When there is a determined target subspace, the spatial range to be processed is the remaining space in the N-dimensional coordinate space.
[0086] Step S4, determine the starting point for performing the expansion. In the initial stage of the target subspace division, the starting point is the point closest to the origin in the space range to be processed. When the expansion step has been performed, the starting point is the space range that has been successfully expanded.
[0087] Step S5: Determine whether there is a valid extension direction among the multiple preset extension directions. If the determination result is yes, proceed to step S6; if the determination result is no, proceed to step S9. The multiple preset extension directions can be based on N dimensions (2 N -1) dimensional combinations. It is understandable that when the successfully expanded spatial range has touched the boundary of the currently processed spatial range, there will be an expansion direction that cannot be expanded further. By checking the legitimacy of the expansion direction, the accuracy of the expansion step can be guaranteed.
[0088] Step S6: Attempt to expand in a legal expansion direction based on the starting point. In this example, the target subspace can be attempted to be expanded based on the expansion step length, that is, the size of the attempted expansion space corresponding to each legal expansion direction can be accurately controlled.
[0089] Step S7, determine whether there is a legal expansion direction that satisfies the singular ratio condition. When the judgment result is yes, continue to execute step S8, and when the judgment result is no, turn to execute step S9. In this example, discrete points in the attempted expansion space that do not include common segmentation parameters (i.e., do not meet the common optimal solution condition) can be defined as singular points, and the singular ratio indicates the ratio of the number of singular points in the attempted expansion space corresponding to each legal expansion direction. By checking the singular ratio of the attempted expansion space, it can be ensured that the target subspace obtained by the final expansion satisfies the first condition.
[0090] Step S8, expand based on the legal expansion direction with the lowest singular ratio. After step S8 is executed, jump back to step S4. By expanding based on the legal expansion direction with the lowest singular ratio, the singular points in the target subspace are minimized (that is, the first discrete points that meet the common optimal solution standard are as many as possible), so that the common segmentation parameters corresponding to each target subspace can more comprehensively indicate the optimal solutions of various tensor sizes within the subspace.
[0091] In one example, the N-dimensional target space is a three-dimensional coordinate space of (0,0,0) to (1024,1024,1024) including three dimensions of X, Y, and Z, and the expansion step size can be 16. In this case, seven possible expansion directions can be tried when trying to expand the target subspace based on the origin, namely: (0,0,0) to (16,16,16), (0,0,0) to (0,16,16), (0,0,0) to (16,0,16), (0,0,0) to (16,16,0), (0,0,0) to (0,0,16), (0,0,0) to (16,0,0), (0,0,0) to (0,16,0). In one example, when the number of singular points of the attempted expansion space corresponding to the seven expansion directions is all zero, the successfully expanded space range will be updated to (0,0,0) to (16,16,16). Furthermore, when the singular point appears at (32,32,32), the singular ratios of the seven expansion directions are 0.037, 0.056, 0.056, 0.056, 0.083, 0.083, and 0.083, respectively. When the above singular ratios do not exceed the threshold, (0,0,0)~(16,16,16) can be selected as the expansion direction, and the spatial range of successful expansion is updated to (0,0,0)~(32,32,32). Furthermore, when the singular point appears at (48,32,32), the singular ratios in the seven directions are: 0.031, 0.021, 0.042, 0.042, 0.056, 0.028, 0.028. When the above singular ratios do not exceed the threshold, the direction (0,0,0) to (0,16,16) can be selected as the expansion direction, and the successfully expanded spatial range is updated to (0,0,0) to (32,48,48). On this basis, the above process can be iterated and looped continuously until the successfully expanded spatial range touches the boundary of the coordinate space or the singular ratios corresponding to each attempted expansion direction exceed the preset threshold, and this round of attempted expansion steps can be ended.
[0092] Step S9, determining the target subspace. When the attempt to expand the step cannot be continued to iterate, a target subspace can be determined based on the current expansion result.
[0093] Step S10: Determine whether there is an unprocessed spatial range. If the determination result is yes, then continue to execute step S3; if the determination result is no, then turn to execute step S11.
[0094] Step S11, determining that multiple target subspaces have been divided.
[0095] According to some embodiments, the third target subspace among the multiple target subspaces is determined in the following manner: in response to the second target subspace being determined, the remaining space in the N-dimensional coordinate space except the second target subspace is divided into two remaining subspaces based on a dividing point along a direction perpendicular to a dividing dimension among the N dimensions, wherein the dividing point is the maximum coordinate point of the second target subspace in the dividing dimension; for a first remaining subspace far away from the origin of the N-dimensional coordinate space among the two remaining subspaces, a discrete point in the first remaining subspace that is closest to the origin of the N-dimensional coordinate space is determined as a second initial point; multiple third extended subspaces are determined by expanding in the multiple extension directions based on the second initial point; and in response to determining that there is at least one third candidate subspace that satisfies the first condition among the multiple third extended subspaces, the third target subspace is determined based on the third candidate subspace with the highest numerical ratio of the first discrete points in the at least one third candidate subspace.
[0096] By applying the above method, after the second target subspace with the origin as the starting point is determined, the remaining space is divided, and the step of trying to expand is continued for the first remaining subspace far from the origin to expand to obtain the next third target subspace, that is, the division of the target subspace is completed more efficiently through loop iteration. It can be understood that when a piece of the second target subspace with a regular shape has been eliminated in the N-dimensional coordinate space, the remaining space is divided along the edge of the second target subspace, and the side far from the origin after the division (the first remaining subspace) is the side with a regular shape. For example, when the N-dimensional coordinate space is a three-dimensional coordinate space, dividing the N-dimensional coordinate space into multiple target subspaces is equivalent to dividing the three-dimensional coordinate space into multiple cubic blocks. By continuing to try to expand the target subspace based on the first remaining subspace, it can be ensured that the target subspace has a regular shape, and then it is convenient to use the coordinate values of the vertices of the target subspace to limit the range of the target subspace, so as to facilitate the determination of the target subspace where the target point is located based on the relative size relationship between the coordinate values of the target point to be queried and the coordinate values of the vertices of the target subspace during the table lookup process.
[0097] In some examples, for another division result of the remaining space (i.e., another remaining subspace other than the first remaining subspace), the division can be continued along the edge of the second target subspace, and then an attempt can be made to expand the target subspace based on a spatial range with a regular shape, and the division of multiple target subspaces can be completed by executing iterative steps.
[0098] It can be understood that in this case, the step of attempting to expand the target subspace is performed based on the segmentation result of the remaining space. It can be seen that the selection of the segmentation dimension can affect the division results of multiple target subspaces.
[0099] Based on this, according to some embodiments, the segmentation dimensions in the N dimensions are determined in the following manner: for each dimension in the N dimensions, the remaining space is segmented in a direction perpendicular to the dimension; based on the segmentation results, multiple target subspaces corresponding to the dimension are determined; based on the multiple target subspaces corresponding to the dimension, segmentation evaluation information of the dimension is determined, wherein the segmentation evaluation information at least includes the number of multiple target subspaces corresponding to the dimension; and based on the segmentation evaluation information of the N dimensions, the segmentation dimensions are determined from the N dimensions. Thus, by traversing the segmentation methods based on the N dimensions respectively, the segmentation dimensions that can obtain the optimal target subspace division results are selected.
[0100] In some examples, N dimensions may be pre-determined as priorities of segmentation dimensions to reduce the amount of calculation and improve database construction efficiency.
[0101] According to some embodiments, method 300 further includes: in response to the second target subspace being determined, recording the information of the second target subspace into the first left node located on the left side of the first layer of the binary tree; recording the segmentation coordinate values of the segmentation dimension and the segmentation point in the segmentation dimension into the first right node located on the right side of the first layer of the binary tree; in response to determining that the third target subspace is the same as the first remaining subspace, recording the information of the second target subspace into the child node located on the right side of the first right node in the binary tree; and using the first subtree in the binary tree with the child node located on the left side of the first right node as the root node to record the information of the other remaining subspace in the two remaining subspaces except the first remaining subspace. Thus, the binary tree can be used to record the process of dividing the N-dimensional coordinate space into multiple target subspaces, so as to more easily record the division results of the target subspaces.
[0102] In some examples, boundary information of multiple target subspaces may also be directly recorded, so that the target subspace where the target point is located can be determined based on the coordinates of the target point corresponding to the first tensor to be queried.
[0103] According to some embodiments, determining the first target subspace where the target point is located includes: in response to determining that the target point does not belong to the second target subspace, determining the target coordinate value of the target point on the segmentation dimension recorded by the first right node; in response to determining that the target coordinate value is greater than the segmentation coordinate value recorded by the first right node, determining that the second target subspace is the first target subspace; and in response to determining that the target coordinate value is not greater than the segmentation coordinate value recorded by the first right node, determining the first target subspace by querying the first subtree. In this case, when the target subspace expansion process is performed with the origin as the starting point, the left subtree of each branch node of the binary tree corresponds to the information on the side close to the origin in the coordinate space, and the right subtree corresponds to the information on the side away from the origin, and then the query path of the next layer can be determined by sequentially comparing the relative sizes of the segmentation coordinate values and the target coordinate values, so that the first target subspace to which the target point belongs can be determined more simply and efficiently.
[0104] Figure 5 FIG. 2 is a schematic diagram showing a process of determining multiple target subspaces according to an exemplary embodiment of the present disclosure. Figure 5 As shown, in this example, the N-dimensional target space is a three-dimensional coordinate space of (0,0,0) to (1024,1024,1024) including the three dimensions of X, Y, and Z. The first successfully expanded target subspace A can be, for example, (0,0,0) to (16,16,16). In this case, the target subspace A can be pushed into the left subtree of the binary tree structure, and the leaf nodes of the first layer of the binary tree structure are used to record the information of the target subspace. In this example, the first round of segmentation of the remaining space A may be performed in the X dimension, and the segmentation information may be recorded as "X, 16". The segmentation information may be recorded in the right subtree of the binary tree structure, and then the first remaining subspace A (16, 0, 0) to (1024, 1024, 1024) on the side away from the origin is pushed into the right subtree to execute the step of trying to expand the target subspace, and the second remaining subspace A except the first remaining subspace A is pushed into the left subtree to continue segmentation and execute the step of trying to expand the target subspace based on the segmentation result (not shown in the figure).
[0105] Continue to see Figure 5 , after the target subspace B is successfully obtained based on the expansion of the first remaining subspace A, the leaf nodes of the second layer of the binary tree structure can be used to record the information of the target subspace B. Similarly, the segmentation information for the remaining space B can be recorded in the right subtree of the second layer of the binary tree structure, and then the first remaining subspace B to be processed far away from the origin is pushed into the right subtree to continue the step of trying to expand the target subspace, and the second remaining subspace B except the first remaining subspace B is pushed into the left subtree to continue the segmentation iteration (not shown in the figure).
[0106] According to some embodiments, the value range of each segmentation parameter in the database is not greater than the range threshold. In this case, only parameters with a small value range are recorded in the candidate parameter set. In this case, the candidate parameters of the respective close points in the N-dimensional coordinate space can show better consistency, thereby improving the success rate of the target subspace division, so that the common segmentation parameters corresponding to each target subspace can more comprehensively indicate the better segmentation parameters of various tensor sizes within the subspace range.
[0107] According to some embodiments, in step S220, by splitting the first tensor based on the first splitting parameter, determining multiple sub-tensors includes: in response to determining that the first tensor needs to be split based on the first splitting parameter and the splitting variable, determining multiple candidate values corresponding to the splitting variable; for each candidate value in the multiple candidate values, determining the processing time of the splitting result obtained by splitting the first tensor based on the first splitting parameter and the candidate value; based on the processing time corresponding to each of the multiple candidate values, determining the target value of the splitting variable from the multiple candidate values; and determining the multiple sub-tensors by splitting the first tensor based on the first splitting parameter and the target value. Thus, in the case of obtaining a partial splitting parameter (first splitting parameter) based on a database query, the candidate values of the to-be-determined splitting variable can be traversed, and the target value with the best processing performance can be selected from them to obtain a complete tensor splitting strategy and improve tensor processing efficiency.
[0108] In one example, the candidate values of the splitting variables can be predicted based on the simulation model. In one example, Analytical Modelling can be applied to model the memory access and operation behaviors in the tensor processing process based on the hardware architecture. In one example, each operator executed by the hardware operation unit can be abstracted as a process of multiple loop calls to the inline assembly microkernel in units of behavior, that is, read and write operations are performed in units of data lines. For example, when it is necessary to perform data convolution calculations, abstract modeling can be performed based on the three steps of reading memory, calculating the convolution result corresponding to a data row, and writing memory. The pipeline model is obtained by combining the bandwidth, frequency and other parameters of the hardware processing unit, and then the hardware processing performance (processing time) is predicted. By using the pipeline to arrange the operation, a performance prediction model corresponding to the physical architecture of the computing hardware can be obtained. By applying the above method 200, the first splitting parameter corresponding to the first tensor can be efficiently determined by querying the database, and then the performance prediction model is applied to select the values of other splitting variables to obtain a complete tensor splitting strategy that is compatible with the first tensor, thereby improving the tensor processing efficiency.
[0109] According to one aspect of the present disclosure, a tensor processing device is also provided. Figure 6 A structural block diagram of a tensor processing device 600 according to an exemplary embodiment of the present disclosure is shown. Figure 6 As shown, the device 600 includes:
[0110] A query unit 610 is configured to query a first segmentation parameter from a database based on a size of a first tensor to be processed;
[0111] A first determining unit 620 is configured to determine a plurality of sub-tensors by splitting the first tensor based on the first splitting parameter; and
[0112] The plurality of processing units 630 are configured to process the plurality of sub-tensors in parallel, wherein the dimension of the first tensor is a positive integer N, and the database is constructed using a database construction device.
[0113] Figure 7 FIG. 8 shows a structural block diagram of a database construction device 700 according to an exemplary embodiment of the present disclosure. Figure 7 As shown, the database construction device 700 includes:
[0114] The second determining unit 701 is configured to determine a plurality of discrete points in an N-dimensional coordinate space, wherein the coordinate values of each discrete point in the plurality of discrete points in N dimensions in the N-dimensional coordinate space are positive integers;
[0115] A third determining unit 702 is configured to determine, for each discrete point among the plurality of discrete points, a set of candidate segmentation parameters corresponding to the discrete point; and
[0116] The division unit 703 is configured to divide the N-dimensional coordinate space into multiple target subspaces, wherein at least one discrete point in each target subspace satisfies the following first condition: there are multiple first discrete points in the target subspace, wherein a common segmentation parameter exists in a candidate segmentation parameter set of each first discrete point in the multiple first discrete points, and wherein a proportion of the number of the at least one first discrete point in the target subspace is not less than a proportion threshold.
[0117] Continue to see Figure 6 , the query unit 610 includes:
[0118] A first determining subunit 611 is configured to determine a first target subspace where a target point is located, wherein the coordinate values of the target point in the N dimensions are determined based on the sizes of the first tensor along the N dimensions; and
[0119] The second determining subunit 612 is configured to determine the common segmentation parameter corresponding to the first target subspace as the first segmentation parameter.
[0120] According to some embodiments, each candidate segmentation parameter in the candidate segmentation parameter set satisfies the following second condition: the processing time of the segmentation result obtained by segmenting the N-dimensional second tensor based on the candidate segmentation parameter is not greater than the time threshold, wherein the size of the second tensor along the N dimensions is the coordinate value of the discrete point in the N-dimensional coordinate space.
[0121] According to some embodiments, the third determination unit 702 includes: a third determination subunit, configured to determine, for each initial segmentation parameter among a plurality of initial segmentation parameters, a processing time of a segmentation result obtained by segmenting the second tensor corresponding to the discrete point based on the initial segmentation parameter; a fourth determination subunit, configured to determine a time threshold corresponding to the discrete point based on the processing times corresponding to each of the plurality of initial segmentation parameters; and a fifth determination subunit, configured to, for each initial segmentation parameter among a plurality of initial segmentation parameters, in response to determining that the processing time corresponding to the initial segmentation parameter is not greater than the time threshold corresponding to the discrete point, add the initial segmentation parameter to the set of candidate segmentation parameters corresponding to the discrete point.
[0122] According to some embodiments, the fourth determining subunit is configured to: determine a minimum value among the processing durations corresponding to each of the multiple initial segmentation parameters; and determine the duration threshold based on the sum of the minimum value and the tolerance difference.
[0123] According to some embodiments, the division unit 703 includes: a fifth determination subunit, configured to determine a first initial point from the multiple discrete points; an expansion subunit, configured to determine multiple first extended subspaces by expanding in multiple expansion directions based on the first initial point, wherein the multiple expansion directions include the coordinate axis directions of the N dimensions; a sixth determination subunit, configured to determine the second target subspace based on the first candidate subspace with the highest numerical ratio of the first discrete points in the at least one first candidate subspace in response to determining that there is at least one first candidate subspace satisfying the first condition in the multiple first extended subspaces; and a seventh determination subunit, configured to determine the space including only the first initial point as the second target subspace in response to determining that there is no first extended subspace satisfying the first condition in the multiple first extended subspaces.
[0124] According to some embodiments, the sixth determination subunit is configured to: determine a plurality of second extended subspaces by utilizing the expansion subunit to expand toward the plurality of expansion directions based on the first candidate subspace having the highest numerical ratio of the first discrete points; and determine the second target subspace based on the second candidate subspace having the highest numerical ratio of the first discrete points in the at least one second candidate subspace in response to determining that there is at least one second candidate subspace satisfying the first condition among the plurality of second extended subspaces.
[0125] According to some embodiments, the division unit 703 also includes: an updating subunit, configured to update the first condition by increasing the ratio threshold in response to determining that the number of discrete points in the first candidate subspace with the highest numerical ratio of the first discrete points is greater than a quantity threshold, wherein the sixth determination subunit is configured to: in response to determining that there is at least one second candidate subspace in the multiple second extended subspaces that satisfies the updated first condition, determine the second target subspace based on the second candidate subspace with the highest numerical ratio of the first discrete points in the at least one second candidate subspace.
[0126] According to some embodiments, the expansion subunit is configured to: expand in the multiple expansion directions based on the first initial point and the expansion step so that the expansion size of the multiple first expanded subspaces in each dimension of the N dimensions does not exceed the expansion step.
[0127] According to some embodiments, the fifth determining subunit is configured to: determine a discrete point among the plurality of discrete points that is closest to the origin of the N-dimensional coordinate space as the first initial point.
[0128] According to some embodiments, the plurality of extension directions are determined in the following manner: determining (2 N -1) kinds of dimension combinations, wherein each dimension combination includes one or more of the N dimensions; and based on the (2 N -1) dimension combinations, determine (2 N -1) expansion direction.
[0129] According to some embodiments, the division unit 703 also includes: a division subunit, configured to, in response to the second target subspace being determined, divide the remaining space in the N-dimensional coordinate space except the second target subspace into two remaining subspaces based on a division point along a direction perpendicular to a division dimension in the N dimensions, wherein the division point is the maximum coordinate point of the second target subspace in the division dimension; the fifth determination subunit is also configured to, for a first remaining subspace far from the origin of the N-dimensional coordinate space in the two remaining subspaces, determine a discrete point in the first remaining subspace that is closest to the origin of the N-dimensional coordinate space as a second initial point; the expansion subunit is also configured to determine a plurality of third extended subspaces by expanding in the plurality of expansion directions based on the second initial point; the sixth determination subunit is also configured to, in response to determining that there is at least one third candidate subspace that satisfies the first condition in the plurality of third extended subspaces, determine a third target subspace based on a third candidate subspace having the highest numerical ratio of the first discrete points in the at least one third candidate subspace.
[0130] According to some embodiments, the segmentation dimensions among the N dimensions are determined in the following manner: for each dimension among the N dimensions, the remaining space is segmented along a direction perpendicular to the dimension; based on the segmentation results, a plurality of target subspaces corresponding to the dimension are determined; based on the plurality of target subspaces corresponding to the dimension, segmentation evaluation information of the dimension is determined, wherein the segmentation evaluation information includes at least the number of the plurality of target subspaces corresponding to the dimension; and based on the segmentation evaluation information of the N dimensions, the segmentation dimension is determined from the N dimensions.
[0131] According to some embodiments, the division unit 703 also includes: a recording subunit, which is configured to record the information of the second target subspace into the first left node located on the left side of the first layer of the binary tree in response to the second target subspace being determined; the recording subunit is also configured to record the segmentation dimension and the segmentation coordinate values of the segmentation point in the segmentation dimension into the first right node located on the right side of the first layer of the binary tree; the recording subunit is also configured to record the information of the second target subspace into the child node located on the right side of the first right node in the binary tree in response to determining that the third target subspace is the same as the first remaining subspace; the recording subunit is also configured to use the first subtree in the binary tree with the child node located on the left side of the first right node as the root node to record the information of the other remaining subspace of the two remaining subspaces except the first remaining subspace.
[0132] According to some embodiments, the first determination subunit 602 includes: a first determination module, configured to determine the target coordinate value of the target point on the segmentation dimension recorded in the first right node in response to determining that the target point does not belong to the second target subspace; and a second determination module, configured to determine that the second target subspace is the first target subspace in response to determining that the target coordinate value is greater than the segmentation coordinate value recorded in the first right node; the second determination module is also configured to determine the first target subspace by querying the first subtree in response to determining that the target coordinate value is not greater than the segmentation coordinate value recorded in the first right node.
[0133] According to some embodiments, a distance between any two discrete points among the plurality of discrete points or a distance between the plurality of discrete points and a boundary of the N-dimensional coordinate space is not greater than a distance threshold.
[0134] According to some embodiments, the plurality of discrete points are determined in the following manner: the plurality of discrete points are determined by sampling in the N-dimensional coordinate space based on a sampling step, wherein a value of the sampling step is a positive integer.
[0135] According to some embodiments, the plurality of discrete points are uniformly distributed in the N-dimensional coordinate space.
[0136] According to some embodiments, the value range of each segmentation parameter in the database is not greater than a range threshold.
[0137] According to some embodiments, the first determination unit 611 includes: an eighth determination sub-unit, configured to determine a plurality of candidate values corresponding to the segmentation variable in response to determining that the first tensor needs to be segmented based on the first segmentation parameter and the segmentation variable; a ninth determination sub-unit, configured to determine, for each of the plurality of candidate values, a processing time for a segmentation result obtained by segmenting the first tensor based on the first segmentation parameter and the candidate value; a tenth determination sub-unit, configured to determine a target value of the segmentation variable from the plurality of candidate values based on the processing time corresponding to each of the plurality of candidate values; and a segmentation sub-unit, configured to determine the plurality of sub-tensors by segmenting the first tensor based on the first segmentation parameter and the target value.
[0138] It should be understood that Figure 6 The tensor processing device 600 and Figure 7 The operations of the various units of the database construction device 700 shown in FIG. 7 can be similar to those of FIG. Figure 2 The tensor processing method 200 described and Figure 3The steps in the described database construction method 300 correspond to each other. Therefore, the operations, features and advantages described above for the methods 200 and 300 are also applicable to the apparatus 600 and the apparatus 700 and the units included therein. For the sake of brevity, some operations, features and advantages are not described in detail here.
[0139] According to another aspect of the present disclosure, an electronic device is also provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned tensor processing method.
[0140] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is also provided, wherein the computer instructions are used to enable the computer to execute the tensor processing method described above.
[0141] According to another aspect of the present disclosure, a computer program product is also provided, including a computer program, wherein the computer program implements the above-mentioned tensor processing method when executed by a processor.
[0142] refer to Figure 8 , a block diagram of an electronic device 800 that can be used as a server or client of the present disclosure will now be described, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0143] like Figure 8 As shown, the device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0144] Multiple components in the device 800 are connected to the I / O interface 805, including: an input unit 806, an output unit 807, a storage unit 808, and a communication unit 809. The input unit 806 can be any type of device that can input information to the device 800. The input unit 806 can receive input digital or character information and generate key signal input related to user settings and / or function control of the electronic device, and can include but is not limited to a mouse, a keyboard, a touch screen, a track pad, a track ball, a joystick, a microphone, and / or a remote controller. The output unit 807 can be any type of device that can present information, and can include but is not limited to a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 808 can include but is not limited to a disk, an optical disk. The communication unit 809 allows the device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and can include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth™ device, an 802.11 device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.
[0145] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods and processes described above, such as tensor processing methods. For example, in some embodiments, the tensor processing method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the tensor processing method described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform the tensor processing method in any other appropriate manner (e.g., by means of firmware).
[0146] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0147] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0148] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0149] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0150] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), the Internet, and a blockchain network.
[0151] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0152] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0153] Although the embodiments or examples of the present disclosure have been described with reference to the accompanying drawings, it should be understood that the above-mentioned methods, systems and devices are merely exemplary embodiments or examples, and the scope of the present invention is not limited by these embodiments or examples. Various elements in the embodiments or examples may be omitted or may be replaced by their equivalent elements. In addition, each step may be performed in an order different from that described in the present disclosure. Further, the various elements in the embodiments or examples may be combined in various ways. It is important that with the evolution of technology, many elements described herein may be replaced by equivalent elements that appear after the present disclosure.
Claims
1. A tensor processing method, comprising: Based on the size of the first tensor to be processed, query a first segmentation parameter from a database; Determining a plurality of sub-tensors by splitting the first tensor based on the first splitting parameter; and Processing the plurality of sub-tensors in parallel using a plurality of processing units, The dimension of the first tensor is a positive integer N, and the database is constructed using the following process: Determine a plurality of discrete points in an N-dimensional coordinate space, wherein the coordinate values of each discrete point in N dimensions of the N-dimensional coordinate space are positive integers; For each discrete point among the plurality of discrete points, determining a set of candidate segmentation parameters corresponding to the discrete point; and The N-dimensional coordinate space is divided into a plurality of target subspaces, wherein at least one discrete point in each target subspace satisfies the following first condition: there are a plurality of first discrete points in the target subspace, wherein a common segmentation parameter exists in a candidate segmentation parameter set of each first discrete point in the plurality of first discrete points, and wherein a number ratio of the at least one first discrete point in the target subspace is not less than a ratio threshold, And wherein, based on the size of the first tensor to be processed, querying the first segmentation parameter from the database includes: Determine a first target subspace where a target point is located, wherein coordinate values of the target point in the N dimensions are determined based on sizes of the first tensor along the N dimensions; and A common segmentation parameter corresponding to the first target subspace is determined as the first segmentation parameter.
2. The method of claim 1, wherein: Each candidate segmentation parameter in the candidate segmentation parameter set satisfies the following second condition: the processing time of the segmentation result obtained by segmenting the N-dimensional second tensor based on the candidate segmentation parameter is not greater than the time threshold, wherein the size of the second tensor along the N dimensions is the coordinate value of the discrete point in the N-dimensional coordinate space.
3. The method of claim 2, wherein: The step of determining, for each discrete point among the plurality of discrete points, a set of candidate segmentation parameters corresponding to the discrete point comprises: For each of the multiple initial segmentation parameters, determining a processing time of a segmentation result obtained by segmenting the second tensor corresponding to the discrete point based on the initial segmentation parameter; Determining a duration threshold corresponding to the discrete point based on the processing durations corresponding to the multiple initial segmentation parameters; and For each of the multiple initial segmentation parameters, in response to determining that the processing duration corresponding to the initial segmentation parameter is not greater than the duration threshold corresponding to the discrete point, the initial segmentation parameter is added to the candidate segmentation parameter set corresponding to the discrete point.
4. The method of claim 3, wherein: The determining of the duration threshold corresponding to the discrete point based on the processing durations corresponding to the multiple initial segmentation parameters includes: Determine a minimum value among the processing durations corresponding to the multiple initial segmentation parameters; and The duration threshold is determined based on the sum of the minimum value and the tolerance difference.
5. The method according to any one of claims 1 to 4, wherein: The second target subspace among the multiple target subspaces is determined in the following manner: Determining a first initial point from the plurality of discrete points; Determine a plurality of first extended subspaces by extending in a plurality of extension directions based on the first initial point, wherein the plurality of extension directions include the coordinate axis directions of the N dimensions; In response to determining that there is at least one first candidate subspace satisfying the first condition in the plurality of first extended subspaces, determining the second target subspace based on a first candidate subspace having a highest numerical ratio of first discrete points in the at least one first candidate subspace; and In response to determining that there is no first extended subspace satisfying the first condition among the plurality of first extended subspaces, a space including only the first initial point is determined to be the second target subspace.
6. The method of claim 5, wherein: The determining the second target subspace based on the first candidate subspace with the highest numerical ratio of the first discrete points in the at least one first candidate subspace comprises: Determine a plurality of second extended subspaces by extending the first candidate subspace with the highest numerical ratio of the first discrete points toward the plurality of extension directions; and In response to determining that there is at least one second candidate subspace satisfying the first condition in the plurality of second extended subspaces, the second target subspace is determined based on a second candidate subspace having a highest numerical ratio of first discrete points in the at least one second candidate subspace.
7. The method of claim 6, further comprising: In response to determining that the number of discrete points in the first candidate subspace having the highest numerical ratio of the first discrete points is greater than a number threshold, updating the first condition by increasing the ratio threshold, In response to determining that there is at least one second candidate subspace satisfying the first condition in the plurality of second extended subspaces, determining the second target subspace based on a second candidate subspace having a highest numerical ratio of the first discrete points in the at least one second candidate subspace includes: In response to determining that there is at least one second candidate subspace satisfying the updated first condition in the multiple second extended subspaces, the second target subspace is determined based on a second candidate subspace having a highest numerical ratio of first discrete points in the at least one second candidate subspace.
8. The method according to any one of claims 5 to 7, wherein: The step of determining a plurality of first extended subspaces by extending in a plurality of extension directions based on the first initial point comprises: The expansion is performed in the multiple expansion directions based on the first initial point and the expansion step length, so that the expansion size of the multiple first expanded subspaces in each dimension of the N dimensions does not exceed the expansion step length.
9. The method according to any one of claims 5 to 8, wherein: Determining a first initial point from the plurality of discrete points comprises: A discrete point among the plurality of discrete points that is closest to the origin of the N-dimensional coordinate space is determined as the first initial point.
10. The method of claim 9, wherein: The multiple extension directions are determined in the following manner: Based on the N dimensions, (2 N -1) dimensional combinations, wherein each dimensional combination includes one or more of the N dimensions; and Based on the above (2 N -1) dimension combinations, determine (2 N -1) expansion direction.
11. The method according to claim 9 or 10, wherein: The third target subspace among the multiple target subspaces is determined in the following manner: In response to the second target subspace being determined, the remaining space in the N-dimensional coordinate space except the second target subspace is divided into two remaining subspaces based on a split point along a direction perpendicular to a split dimension in the N dimensions, wherein the split point is a maximum coordinate point of the second target subspace in the split dimension; For a first residual subspace far away from the origin of the N-dimensional coordinate space among the two residual subspaces, determining a discrete point in the first residual subspace that is closest to the origin of the N-dimensional coordinate space as a second initial point; Determine a plurality of third extended subspaces by extending in the plurality of extension directions based on the second initial point; and In response to determining that there is at least one third candidate subspace satisfying the first condition in the multiple third extended subspaces, the third target subspace is determined based on a third candidate subspace having a highest numerical ratio of first discrete points in the at least one third candidate subspace.
12. The method of claim 11, wherein: The splitting dimensions in the N dimensions are determined in the following manner: For each of the N dimensions, Splitting the remaining space along a direction perpendicular to the dimension; Determine multiple target subspaces corresponding to the dimension based on the segmentation results; Determine segmentation evaluation information of the dimension based on the multiple target subspaces corresponding to the dimension, wherein the segmentation evaluation information at least includes the number of the multiple target subspaces corresponding to the dimension; as well as Based on the segmentation evaluation information of the N dimensions, the segmentation dimension is determined from the N dimensions.
13. The method according to claim 11 or 12, further comprising: In response to the second target subspace being determined, recording information of the second target subspace into a first left node located on the left side of the first layer of the binary tree; Recording the segmentation dimension and the segmentation coordinate value of the segmentation point in the segmentation dimension into the first right node located on the right side of the first layer of the binary tree; In response to determining that the third target subspace is the same as the first remaining subspace, recording information of the second target subspace into a child node located to the right of the first right node in the binary tree; as well as The information of another remaining subspace of the two remaining subspaces except the first remaining subspace is recorded by using a first subtree in the binary tree with the child node located on the left side of the first right node as a root node.
14. The method of claim 13, wherein: Determining the first target subspace where the target point is located includes: In response to determining that the target point does not belong to the second target subspace, determining a target coordinate value of the target point on the segmentation dimension recorded in the first right node; In response to determining that the target coordinate value is greater than the segmentation coordinate value of the first right node record, determining the second target subspace to be the first target subspace; and In response to determining that the target coordinate value is not greater than the segmentation coordinate value of the first right node record, the first target subspace is determined by querying the first subtree.
15. The method according to any one of claims 1 to 14, wherein: A distance between any two of the plurality of discrete points or a distance between the plurality of discrete points and a boundary of the N-dimensional coordinate space is not greater than a distance threshold.
16. The method of claim 15, wherein: The plurality of discrete points are determined in the following manner: The plurality of discrete points are determined by sampling in the N-dimensional coordinate space based on a sampling step, wherein a value of the sampling step is a positive integer.
17. The method of claim 16, wherein: The multiple discrete points are evenly distributed in the N-dimensional coordinate space.
18. The method according to any one of claims 1 to 17, wherein: The value range of each segmentation parameter in the database is not greater than a range threshold.
19. The method of claim 18, wherein: The determining of a plurality of sub-tensors by splitting the first tensor based on the first splitting parameter comprises: In response to determining that the first tensor needs to be segmented based on the first segmentation parameter and the segmentation variable, determining a plurality of candidate values corresponding to the segmentation variable; For each candidate value among the multiple candidate values, determine a processing time of a segmentation result obtained by segmenting the first tensor based on the first segmentation parameter and the candidate value; Determining a target value of the segmentation variable from the plurality of candidate values based on the processing durations corresponding to the plurality of candidate values; and The plurality of sub-tensors are determined by splitting the first tensor based on the first splitting parameter and the target value.
20. A tensor processing device, comprising: A query unit configured to query a first segmentation parameter from a database based on a size of a first tensor to be processed; A first determining unit is configured to determine a plurality of sub-tensors by splitting the first tensor based on the first splitting parameter; as well as a plurality of processing units configured to process the plurality of sub-tensors in parallel, The dimension of the first tensor is a positive integer N, and the database is constructed by using a database construction device, and the database construction device includes: A second determining unit is configured to determine a plurality of discrete points in an N-dimensional coordinate space, wherein the coordinate values of each discrete point in the plurality of discrete points in N dimensions in the N-dimensional coordinate space are positive integers; A third determining unit is configured to determine, for each discrete point among the plurality of discrete points, a set of candidate segmentation parameters corresponding to the discrete point; and A partitioning unit is configured to partition the N-dimensional coordinate space into a plurality of target subspaces, wherein at least one discrete point in each target subspace satisfies the following first condition: there are a plurality of first discrete points in the target subspace, wherein a common partitioning parameter exists in a candidate partitioning parameter set of each first discrete point in the plurality of first discrete points, and wherein a number ratio of the at least one first discrete point in the target subspace is not less than a ratio threshold, And wherein, the query unit comprises: a first determining subunit configured to determine a first target subspace where a target point is located, wherein coordinate values of the target point in the N dimensions are determined based on sizes of the first tensor along the N dimensions; and The second determining subunit is configured to determine a common segmentation parameter corresponding to the first target subspace as the first segmentation parameter.
21. An electronic device, comprising: at least one processor; as well as a memory communicatively coupled to the at least one processor; in The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 19.
22. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to make a computer execute the method according to any one of claims 1-19.
23. A computer program product comprising a computer program, wherein: The computer program implements the method according to any one of claims 1-19 when executed by a processor.
Citation Information
Cited By
Tensor processing method and apparatus, device, and medium
WO2026077151A1