Distributed Tensor Network Contraction Scheme Based on Dynamic Sorting and Partitioning

By optimizing the contraction process of tensor networks through sub-network distribution and resource estimation, the method addresses inefficiencies in tensor network computations, enhancing their applicability in fields like machine learning and quantum computing.

CN115066589BActive Publication Date: 2025-07-15深圳季轴量子有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202080091727.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2020-01-06
Filing Date
2020-12-31
Publication Date
2025-07-15
Estimated Expiration
2040-12-31

AI Technical Summary

Technical Problem

Tensor networks have low computing efficiency and require a large amount of computing resources and time. The fixed-sequence shrinkage method in the existing design is not optimized enough, resulting in unnecessary increase in resource consumption.

Method used

By determining the shrinking order of the tensor network, multiple subnets are generated and assigned to multiple computing nodes for parallel shrinking, the scaling process is optimized by using tree decomposition and virtual tensors to connect open edges.

Benefits of technology

It significantly reduces the time and resource consumption of tensor network computing, improves computing efficiency, and can improve 100 times of computing performance, especially in distributed cluster environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115066589B_ABST
    Figure CN115066589B_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure provide a method for contracting a tensor network. The method may include: receiving, by a system, a tensor network including a plurality of tensors and a plurality of edges among the plurality of tensors, wherein each edge is associated with a plurality of index elements; determining a contraction order of the tensor network; determining, based on the tensor network, one or more edges among the plurality of edges for generating a plurality of sub-networks; and allocating the plurality of sub-networks to a plurality of computing nodes of the system for the plurality of computing nodes to contract the plurality of sub-networks based on the contraction order.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] Cross - reference to related applications

[0002] This disclosure claims the benefit of priority and priority rights of U.S. Provisional Patent Application No. 62 / 957,442, filed on January 6, 2020. The entire content of this provisional application is incorporated herein by reference. Background of the Invention

[0003] A tensor is a mathematical concept that can encapsulate and generalize the idea of multilinear mappings. A tensor network can be a collection of a large number of tensors connected by contractions. Tensor networks have a wide range of applications in modern science and engineering, including machine learning, many - body theory, gradient calculation, quantum computing, etc. As the applications of tensor networks continue to expand, the efficiency of computing with tensor networks has become a bottleneck for many applications. The efficiency problem of tensor networks is further exacerbated by the complex nature of tensor networks, which typically requires a large amount of computing power and time to execute. To continue to expand the use of tensor networks, there is an urgent need to reduce the time and computing resources required for tensor network calculations. Summary of the Invention

[0004] Embodiments of this disclosure provide a method for contracting a tensor network. The method may include: receiving, by a system, a tensor network including a plurality of tensors and a plurality of edges between the plurality of tensors, wherein each edge is associated with a plurality of index elements; determining a contraction order of the tensor network; determining, based on the tensor network, one or more edges among the plurality of edges for generating a plurality of sub - networks; and allocating the plurality of sub - networks to a plurality of computing nodes of the system for the plurality of computing nodes to contract the plurality of sub - networks based on the contraction order.

[0005] Embodiments of this disclosure also provide a non - transitory computer - readable medium storing a set of instructions executable by at least one processor of a system to cause the system to contract a tensor network, including: receiving a tensor network including a plurality of tensors and a plurality of edges between the plurality of tensors, wherein each edge is associated with a plurality of index elements; determining a contraction order of the tensor network; determining, based on the tensor network, one or more edges among the plurality of edges for generating a plurality of sub - networks; and allocating the plurality of sub - networks to a plurality of computing nodes of the system for the plurality of computing nodes to contract the plurality of sub - networks based on the contraction order.

[0006] Embodiments of the present disclosure also provide a system, including: a plurality of computing nodes; one or more memories storing a set of instructions; and one or more processors configured to execute the set of instructions to cause the system to perform: receiving a tensor network including a plurality of tensors and a plurality of edges between the plurality of tensors, wherein each edge is associated with a plurality of index elements; determining a contraction order of the tensor network; determining, based on the tensor network, one or more edges among the plurality of edges for generating a plurality of sub-networks; and allocating the plurality of sub-networks to the plurality of computing nodes of the system for the plurality of computing nodes to contract the plurality of sub-networks based on the contraction order.

[0007] It should be understood that, as required, the foregoing general description and the following detailed description are merely exemplary and explanatory, and are not restrictive of the disclosed embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0008] Embodiments and various aspects of the present disclosure are shown in the following detailed description and the drawings. The various features shown in the drawings are not drawn to scale.

[0009] Figure 1 A schematic diagram showing an example tensor according to some embodiments of the present disclosure;

[0010] Figure 2 A schematic diagram showing an example tensor contraction according to some embodiments of the present disclosure;

[0011] Figure 3 A schematic diagram showing an exemplary cloud service system according to some embodiments of the present disclosure;

[0012] Figure 4 A flowchart showing an exemplary method for performing tensor network contraction according to some embodiments of the present disclosure;

[0013] Figure 5 A schematic diagram showing an exemplary tensor network according to some embodiments of the present disclosure;

[0014] Figure 6 A schematic diagram showing an exemplary intermediate tensor network according to some embodiments of the present disclosure;

[0015] Figure 7 A schematic diagram showing an exemplary tree diagram according to some embodiments of the present disclosure;

[0016] Figure 8 A schematic diagram showing an exemplary generation of sub-networks according to some embodiments of the present disclosure;

[0017] Figure 9 A schematic diagram showing an exemplary contraction of a tensor network according to some embodiments of the present disclosure;

[0018] Figure 10 A schematic diagram showing an exemplary representation of a quantum circuit using a tensor network according to some embodiments of the present disclosure. Detailed implementation

[0019] Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. The following description refers to the drawings, in which like numerals in different drawings represent the same or similar elements, unless otherwise indicated. The implementations set forth in the following description of the exemplary embodiments do not represent all implementations consistent with the present invention. Instead, they are merely examples of apparatus and methods consistent with aspects of the present invention described in the appended claims. Specific aspects of the present disclosure are described in more detail below. If there is a conflict with the terms and / or definitions incorporated by reference, the terms and definitions provided herein shall prevail.

[0020] A tensor network may include a plurality of tensors. A tensor may represent a multi-dimensional array containing complex numbers. A tensor network may also include a plurality of indices associated with the tensors. Each tensor may include some or all of the plurality of indices. A tensor network can be a very useful tool because it provides a visual language, along with a set of mathematical tools, that simplifies extremely difficult calculations.

[0021] Figure 1 A schematic diagram showing an example tensor according to some embodiments of the present disclosure. As Figure 1 shown, a tensor is represented by a solid shape, and tensor indices are represented by one or more lines originating from the tensor. Tensor indices associated with a tensor may be represented as subscripts or superscripts on the tensor. For example, Figure 1 includes three different tensors, a vector tensor V j , a matrix tensor M i,j and a 3-index tensor T i,j,k . The vector tensor V j may be a one-dimensional array of scalar values. The matrix tensor M i,j may be a two-dimensional array of scalar values. The 3-index tensor T i,j,k may be a three-dimensional array of scalar values. It should be understood that a tensor may have more than three indices.

[0022] In a tensor network, tensors may be connected by tensor indices. The contraction of a tensor network may include combining like indices in different tensors and summing over indices that do not appear in the final result. Figure 2 A schematic diagram showing an example tensor contraction according to some embodiments of the present disclosure. As Figure 2 shown, the tensor network contraction of tensors V j and M i,j may be represented as Σ i Vj M i,j After contraction, tensor V j and M i,j can be combined on the indices. It should be understood that tensor indices can be connected to more than two tensors. These indices that can be connected to more than two tensors can be called hyperedges. For the present disclosure, we may refer to edges and hyperedges interchangeably. For example, an edge can also be connected to more than two tensors.

[0023] Tensor indices can be open indices or closed indices. An open index is an index with an open end. For example, as Figure 2 shown, index j is an open index because it has an open end. A closed index is an index without an open end. For example, as Figure 2 shown, index i is a closed index because it has no open end.

[0024] Generally speaking, contracting a tensor network may involve the contraction of open edges and closed edges. The contraction of open edges and closed edges can be intertwined. For example, contracting a tensor network may involve successively combining and summing closed edges and combining open edges.

[0025] In some cases, contracting a tensor network can include two stages. In the first stage, closed indices can be combined and summed one by one. In the second stage, open indices are combined one by one. In many cases, compared with the second stage, the first stage consumes most of the computing resources and time. In addition, although the order of combining and summing closed indices one by one does not change the final result, it significantly affects the time and resource consumption of the contraction process. Therefore, the contraction order should be wisely selected to avoid unnecessary resource consumption.

[0026] The traditional design of tensor networks has defects. For example, some tensor networks are based on matrix multiplication, which burdens the communication cost and storage space. Some tensor networks are designed based on the contraction of tensor networks in a fixed order. However, the fixed order may not be optimal.

[0027] To solve the above problems, embodiments of the present disclosure provide methods and systems for performing the contraction of tensor networks. For example, one way to contract a tensor network is to defer the summation on some closed indices until the end of the calculation. At the end of the calculation, each term in the final summation corresponds to a simpler sub-tensor network than the original tensor network. In the case of using a distributed cluster, the contraction of the tensor network can be performed by distributing multiple sub-tensor networks to the cluster nodes and summing the contraction results sent back from the cluster nodes.

[0028] Figure 3FIG. 0 shows a schematic diagram of an exemplary cloud service system 100 according to some embodiments of the present disclosure. The cloud service system 100 may include a plurality of computing devices to provide cloud services to users. As Figure 3 shown, the cloud service system 100 may include computing devices 100a, 100b, 100c, …, 100n. Each computing device (e.g., computing device 100a) may include at least one processor 102 (e.g., processors 102a, 102b, and 102c), a memory 104 communicatively coupled to the at least one processor 102 via a bus 106, and an interface 108 communicatively coupled to the bus 106.

[0029] The at least one processor 102 may be any suitable processor capable of executing instructions. For example, processor 102a may be an X86 processor or an ARM processor. In some embodiments, the at least one processor 102 may further include an accelerator (e.g., a neural processing unit) for providing computing capabilities related to neural networks, such as neural network training and inference.

[0030] The memory 104 may be configured to store instructions and data accessible by the at least one processor 102. For example, the instructions may be executed by the at least one processor 102 to cause the computing device 100a to perform various functions. In some embodiments, the memory 104 may be implemented by any suitable technology, such as static random access memory (“SRAM”), synchronous dynamic RAM (“SDRAM”), non-volatile memory, etc.

[0031] The bus 106 may be configured to provide connections between components of the computing device 100a. For example, the at least one processor 102, the memory 104, and the network interface 106 may be interconnected via the bus 106.

[0032] The interface 108 may include a network interface providing a wired or wireless network connection and an input / output (“I / O”) interface communicatively coupled to peripheral devices (e.g., a cursor control device, a keyboard, a display, etc.). The network interface may be configured to provide communication between the system 100 and the client terminal 120 via a network 110. The network 110 may be the Internet, a private network, etc. In some embodiments, the client terminal 120 may be a personal computer, a server, a smart phone, a tablet computer, or any computing device. The I / O interface may include at least one of a universal serial bus (USB) port, a Peripheral Component Interconnect Express (PCI-E) port, etc. for connecting to peripheral devices.

[0033] Figure 4FIG. 200 is a flowchart of an exemplary method for performing tensor network contraction according to some embodiments of the present disclosure. The method 200 may be implemented by a computing device (e.g., the cloud service system 100 or Figure 3 the computing device 100a). The method 200 may include the following steps.

[0034] In step 202, a tensor network is received. The tensor network may include multiple tensors. The tensor network may also include edges between the multiple tensors. The edges may also be referred to as indices and are associated with the dimensions of the tensors. The dimensions of the tensors may also be referred to as ranks. For example, a tensor network T i,j including tensors A j,k,l B i,l and C i,j,k is a rank-3 tensor network with edges i, j, k, and l. Tensor B j,k,l is a rank-3 tensor because it is associated with three edges. Since A i,j and B j,k,l both have edge j, edge j connects A i,j and B j,k,l . It can be seen that edge l merges in the tensor network T i,j,k , and thus can be referred to as a closed edge. It should be understood that the edges of the tensor network may include zero or more closed edges and zero or more open edges.

[0035] Figure 5 FIG. 300 shows an exemplary tensor network according to some embodiments of the present disclosure. As Figure 5 shown, the tensor network 300 may include tensors A, B, C, D, F, G, and H. Each tensor may include zero or more closed edges and zero or more open edges. For example, the edge 302 connecting tensors A and B is a closed edge. Edge i that is connected to tensor D at one end and remains open at the other end is an open edge. Similarly, edges j, k, l, and m are also open edges. Thus, the tensor network 300 may also be described as a tensor network T(i, j, k, l, m), where edges i, j, k, l, and m are open edges in the tensor network.

[0036] Returning to Figure 4 , in step 204, a contraction order of the tensor network is determined. For example, the contraction order may be determined according to tree decomposition. As described above, the tensor network is associated with multiple edges of tensors, and each tensor may be associated with some or all of the multiple edges. The contraction of the tensor network includes the process of merging the same type of edges in different tensors. The contraction order is the order of merging the edges.

[0037] To determine the contraction order, a virtual tensor can be created to connect one or more open edges. A virtual tensor is created to connect some or all of the open edges in a tensor network. The virtual tensor may not include data. The rank of the virtual tensor can be associated with the number of open edges. For example, as Figure 5 shown, the tensor network 300 includes five open edges (i, j, k, l, m), so the virtual tensor V of the tensor network 300 can have a rank of 5. In other words, the virtual tensor V has five edges corresponding to the open edges (i, j, k, l, m) and can be represented as, for example, V(i, j, k, l, m).

[0038] In some embodiments, tree decomposition can be used to determine the contraction order of a tensor network. Tree decomposition is mapping a graph to a tree, which can be used to accelerate solving computational tasks on the graph. According to tree decomposition, a tensor network can be mapped to a tree. For example, each node in the tree can include one or more indices from the tensor network. In addition, the tree nodes including a specific index can form a subtree. In some embodiments, each tensor in the tensor network can correspond to one or more nodes in the tree such that the nodes include all the indices adjacent to the tensor.

[0039] In some embodiments, to perform tree decomposition, a tree node can be selected as the root node. The contraction order can be generated from the root tree during an iterative process, starting from an empty contraction order. During the iterative process, when there is a leaf node of the tree, the leaf node can be removed from the tree. For the closed indices that are present in the leaf node but no longer present in the new tree, the closed indices can be appended to the end of the contraction order. The iterative process can be repeated until the tree is empty.

[0040] In the presence of a virtual tensor, if a tree node includes all the indices adjacent to the virtual tensor, then the tree node can be selected as the root node.

[0041] The contraction order can be generated from the root tree during an iterative process. The iterative process can start from an empty contraction order. When there is a leaf node of the tree, the leaf node can be removed from the tree. For all the closed indices that appear in the leaf node but no longer appear in the new tree, the closed indices can be appended to the end of the contraction order. The iterative process can be repeated until the tree is empty.

[0042] Then, a computing device (e.g., the cloud service system 100 or Figure 3 the computing device 100a) can generate an intermediate tensor network. Figure 6 An exemplary intermediate tensor network according to some embodiments of the present disclosure is shown. It should be understood that Figure 6 the intermediate tensor network 310 shown can be Figure 5 the intermediate tensor network of the tensor network 300 shown. As Figure 6 shown, the tensor network (e.g.,Figure 5 The open edges of the tensor network 300) can be closed by a virtual tensor V(i, j, k, l, m) that includes all the open edges. After adding the virtual tensor (e.g., V(i, j, k, l, m)), the open edges in the tensor network (e.g., Figure 5 the tensor network 300) can become closed tensors.

[0043] In some embodiments, the computing device can perform a tree decomposition on an intermediate tensor network. Intuitively, a tree decomposition is a way of drawing a graph that looks like a tree. To this end, the vertex set or bag can be regarded as a single vertex. The more the graph does not look like a tree, the larger the bag becomes. In some embodiments, a tree decomposition algorithm or computing program (e.g., subroutine) can be used to perform the tree decomposition. The contraction order of the tensor network can also be determined based on the tree. Figure 7 FIG. shows a schematic diagram of an exemplary tree graph according to some embodiments of the present disclosure. As Figure 7 shown, by performing a tree decomposition on the Figure 6 intermediate tensor network 310 shown, a tree graph 320 is generated. The tensors in the intermediate tree 320 can be grouped into one or more tree nodes or bags. For example, as Figure 7 shown, tensors A, B, and C can be grouped into a tree node. After the tree decomposition, the intermediate tensor network 310 can have a tree-like structure.

[0044] Returning to reference Figure 4 , in step 206, the computing device can determine one or more edges among multiple edges for generating multiple sub-networks based on the tensor network. In some embodiments, each edge can include one or more elements. As an example, Figure 5 the edge i in T(i, j, k, l, m) shown can include elements i[0], i[1], i[2], …, i[7], and can be selected for generating multiple sub-networks. Thus, a first sub-network corresponding to i[0], a second sub-network corresponding to i[1], a third sub-network corresponding to i[2], …, an eighth sub-network corresponding to i[7] can be generated.

[0045] In some embodiments, to determine one or more edges for generating multiple sub-networks, the computing device can generate multiple evaluation sub-networks for each of the multiple edges. Figure 8 FIG. shows an exemplary schematic diagram of generating sub-networks according to some embodiments of the present disclosure. As Figure 8 shown, the tensor network 402 can include tensors (A, B, C, D, and E) and edges (A, B, C, D, E, and F). By splitting an edge (e.g., edge d), sub-networks 404 and 406 can be generated. In some embodiments, edge d can be in the range of {0, 1}. It should be understood that Figure 8The generation of the sub-network shown can be performed by a computing device (e.g., the cloud service system 100 or Figure 3 the computing device 100a of

[0046] As Figure 8 shown, by splitting the edge d, the tensor network 402 can be replaced by the sum of two sub-networks 404 and 406. In some embodiments, the sub-networks 404 and 406 have the same shape, but different tensors may be associated with the corresponding nodes of the sub-networks. More specifically, the sub-network 404 can be generated based on the edge d being "0", and the sub-network 406 can be generated based on the edge d being "1".

[0047] Thus, the tensors and of the sub-network 404, as well as the tensors and of the sub-network 406 can be represented as follows.

[0048]

[0049] In some embodiments, for the purpose of resource estimation, only the shape of the sub-network is required. The shape of the sub-network is the same as the shape of the original tensor network (e.g., the tensor network 402), except that the edge (e.g., the edge d) is removed from the graph. For example, as Figure 8 shown, the shape of the sub-network 404 is the same as the shape of the tensor network 402, except that the edge d is removed from the graph.

[0050] In some embodiments, it can be understood that multiple evaluation sub-networks do not have to be real sub-networks. Instead, multiple evaluation sub-networks can be virtual sub-networks for evaluation. As described above, multiple evaluation sub-networks can be generated by traversing multiple index elements of each edge and generating multiple evaluation sub-networks corresponding to the multiple index elements. The computing device can then estimate the resource consumption required for contracting the tensor network based on the multiple evaluation sub-networks respectively. For example, in Figure 5 the T(i, j, k, l, m) shown, the resource consumption based on the edges i, j, k, l, and m can be estimated. Among the estimated resource consumption, the computing device can determine one or more edges that require lower resource consumption based on this estimate. For example, the computing device can determine one or more edges that require the minimum resource consumption based on this estimate.

[0051] Figure 9 shows a schematic diagram of an exemplary contraction of a tensor network according to some embodiments of the present disclosure. It should be understood that Figure 9 the contraction of the tensor network 500 shown can be performed by a computing device (e.g., the cloud service system 100 or Figure 3 the computing device 100a of

[0052] As shown Figure 9 in FIG. 1, the tensor network 500 includes tensors (A, B, C, D, and E) and edges (a, b, c, d, e, and f). As an example, edge b can be merged and summed. As a result, a tensor network 502 is generated, where the new tensor F replaces the tensors (e.g., tensors A, B, and D) connected by edge b. In some embodiments, tensor F can be represented by the following equation.

[0053]

[0054] To perform the contraction, the value of tensor F can be calculated by the above formula. When generating tensor F, additional space of dimension (a) × dimension (c) × dimension (d) is required. Accordingly, calculating tensor F can take a time amount of dimension (a) × dimension (c) × dimension (d). After calculating tensor F, tensors A, B, and D can be merged and removed from the tensor network 500 to generate the tensor network 502.

[0055] In some embodiments, merging tensors can involve matrix multiplication. In resource estimation, the cost of matrix multiplication can be estimated first instead of immediately performing the actual matrix multiplication. The cost estimation of matrix multiplication can depend on the shape of the intermediate tensor rather than the actual value. Therefore, to estimate the resource consumption, the actual matrix calculation can be omitted. In some embodiments, the resource consumption can include time consumption and space consumption. In some embodiments, the total time consumption is the sum of the time consumptions of each step. The space consumption can be the maximum value of the sum of the tensor sizes in the tensor network.

[0056] Returning to reference Figure 4 , in step 208, multiple sub-networks can be contracted based on the contraction order. In some embodiments, a computing device can contract multiple sub-networks based on the contraction order. In some embodiments, the multiple sub-networks can be distributed to multiple computing nodes (e.g., Figure 1 multiple cloud service devices 100) of a cloud system for contracting each of the multiple sub-networks. As a result, some or all of the contractions of the multiple sub-networks can be performed in parallel.

[0057] In some embodiments, the contraction of the tensor network can be performed in an iterative manner. In some embodiments, in each iteration step of the iterative manner, an edge in front of the contraction order can be selected and removed from the contraction order. All tensors adjacent to the selected edge can be merged into a new intermediate tensor. The new intermediate tensor can include all edges adjacent to one or more tensors adjacent to the selected edge. The selected edge and its neighbors in the tensor network can be replaced by the new intermediate tensor. In some embodiments, the above iterative steps can be repeated until the contraction order is empty.

[0058] In some embodiments, more than one tensor may be left in the tensor network. In this case, more than one tensor may be merged to form a final tensor. In some embodiments, the final tensor is adjacent to all open edges.

[0059] As described above, resource consumption estimation may be performed by separately estimating the time and space consumption of the contraction process. At each step, intermediate tensors may be generated, and one or more tensors may be removed from the tensor network. The time consumption of the contraction may be estimated by the sum of the sizes of all intermediate tensors. The space consumption may be estimated as the maximum of the sum of the tensor sizes in the tensor network. Depending on different scenarios, the time and space consumption may be combined into one quantity as the resource estimation quantity for the contraction. For the same amount of computing resource consumption, using sub-networks can increase the computing time of contracting the tensor network by more than 100 times.

[0060] In some embodiments, multiple sub-networks may be separately distributed to multiple computing nodes of a cloud system (e.g., Figure 1 multiple cloud service devices 100) for contracting each of the multiple sub-networks. In some embodiments, during the contraction of each sub-network among the multiple sub-networks, the computing node may further determine the final contraction order of each of the multiple sub-networks, and then contract each of the multiple sub-networks based on the final contraction order.

[0061] In some embodiments, the contraction process shown above (e.g., Figure 4 method 200) may be used for quantum circuits or analog quantum circuits. A quantum circuit is a computational program in which the computation is a series of quantum gates. A quantum circuit may be an ordered sequence of quantum gates, measurements, and resets. A quantum gate may perform an operation to change the state of a qubit. A qubit is a basic variable in quantum computing or a variant of a bit.

[0062] To simulate a quantum circuit, the quantum circuit C may naturally be regarded as a tensor network. The tensor network of the quantum circuit C may be denoted as N(C). In some embodiments, each gate in the quantum circuit C may be regarded as a tensor in the tensor network N(C). A qubit line may be a wire or a closed edge connecting tensors, or an open edge corresponding to an input and output qubit. When contracting the tensor network N(C), each edge may be contracted one by one, and the corresponding tensors may be convolved until only one vertex remains. The degree of this vertex is 0 and it may be labeled with a single number, which may provide the final measurement probability of the sought-after tensor network N(C). For a tensor network containing open edges, the final measurement after contraction may be a vector. One advantage of using tensor contraction to simulate a quantum circuit is that the individual quantum gates in the circuit do not have to be simulated in their original order. In fact, a given gate may be partially simulated at several stages of the simulation.

[0063] Figure 10 FIG. shows a schematic diagram of an exemplary representation of a quantum circuit using a tensor network according to some embodiments of the present disclosure. As Figure 10 shown, a quantum circuit C is given, having four input qubits (e.g., 4 qubit lines above the quantum circuit C) and four output qubits (e.g., 4 qubit lines below the quantum circuit C). The quantum circuit C may include one or more quantum gates.

[0064] As Figure 10 shown, the quantum circuit C can be represented as a tensor network N(C). In some embodiments, as Figure 10 shown, the tensor network N(C) includes 8 open edges. Four open edges (e.g., the four edges above the tensor) can correspond to the inputs of the quantum circuit C, while the other four open edges (e.g., the four edges below the tensor) can correspond to the outputs of the quantum circuit C. In some embodiments, the tensors shown in the tensor network N(C) can correspond to the gates in the quantum circuit C. In some embodiments, contracting the tensor network N(C) provides tensors for the operators implemented by the quantum circuit C.

[0065] Embodiments of the present disclosure provide methods and systems for estimating the computational cost of contract orders using subnetworks. The methods and systems can be used for tensor networks with open edges, and the tensor networks discussed above can be used to simulate quantum circuits.

[0066] The flowcharts and diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatuses, methods, and computer program products according to various embodiments of the present specification. In this regard, a block in a flowchart or diagram can represent a software program, a code segment, or a portion thereof that includes one or more executable instructions for implementing a particular function. It should also be noted that in some alternative implementations, the functions labeled in the blocks may not occur in the order labeled in the figures. For example, two consecutive blocks shown may actually be executed substantially simultaneously, or these blocks may sometimes be executed in the reverse order, depending on the functions involved. It will also be noted that each block of the figures or flowcharts, and combinations of blocks in the figures and flowcharts, can be implemented by a system based on dedicated hardware that performs the specified functions or actions, or by a combination of dedicated hardware and computer instructions.

[0067] As used herein, the terms "comprising," "including," or any other variant thereof are intended to cover non-exclusive inclusion, such that a process, method, composition, article, or apparatus that includes a series of elements includes not only those elements but also other elements that are not expressly listed or are inherent to such process, method, composition, article, or apparatus. The term "exemplary" is used in the sense of "example," rather than "ideal."

[0068] As used herein, unless otherwise expressly stated, the term "or" includes all possible combinations, unless infeasible. For example, if it is stipulated that a database may include A or B, then unless specifically stated or infeasible, the database may include A, B, or A and B. As a second example, if it is stipulated that a database may include A, B, or C, then unless specifically stated or infeasible, the database may include A or B or C, or A and B, or A and C, or B and C, or A and B and C.

[0069] It should be understood that the above embodiments can be implemented by hardware, software (program code), or a combination of hardware and software. If implemented by software, it can be stored in the above computer-readable medium. When executed by a processor, the software can execute the disclosed method. The data storage systems, auxiliary storage units, and other functional units described in the present disclosure can be implemented by hardware, software, or a combination of hardware and software. Those of ordinary skill in the art will also understand that multiple of the above functional units can be combined into one functional unit, and each of the above functional units can be further divided into multiple functional subunits.

[0070] In the foregoing specification, embodiments have been described with reference to numerous specific details, which may vary with the implementation. Certain adjustments and modifications can be made to the described embodiments. Considering the specification and practice of the present invention disclosed herein, other embodiments will be apparent to those skilled in the art. The specification and examples are only considered to be exemplary, and the true scope and spirit of the present invention are indicated by the appended claims. The order of steps shown in the figures is also intended for illustrative purposes only and is not intended to be limited to any specific order of steps. Thus, those skilled in the art can understand that these steps can be executed in a different order when implementing the same method.

[0071] The embodiments can be further described using the following terms:

[0072] 1. A method for contracting a tensor network, comprising:

[0073] receiving, by a system, a tensor network including a plurality of tensors and a plurality of edges between the plurality of tensors, wherein each edge is associated with a plurality of index elements;

[0074] determining a contraction order of the tensor network;

[0075] determining, based on the tensor network, one or more edges among the plurality of edges for generating a plurality of sub-networks; and

[0076] assigning the plurality of sub-networks to a plurality of computing nodes of the system for the plurality of computing nodes to contract the plurality of sub-networks based on the contraction order.

[0077] 2. The method according to clause 1, wherein:

[0078] the plurality of edges includes one or more open edges and one or more closed edges, and

[0079] determining the contraction order of the tensor network further includes:

[0080] creating virtual tensors for connecting the one or more open edges;

[0081] generating an intermediate tensor network having one or more open edges closed by the virtual tensors;

[0082] performing a tree decomposition on the intermediate tensor network to construct a tree; and

[0083] determining the contraction order of the tensor network based on the tree.

[0084] 3. The method according to clause 1 or 2, wherein determining one or more edges for generating a plurality of sub-networks among the plurality of edges based on the tensor network further includes:

[0085] generating a plurality of evaluation sub-networks for each of the plurality of edges;

[0086] estimating the resource consumption required for contracting the tensor network respectively based on the plurality of evaluation sub-networks; and

[0087] determining one or more edges with lower consumption based on the estimated resource consumption.

[0088] 4. The method according to clause 3, wherein generating a plurality of evaluation sub-networks for each of the plurality of edges further includes:

[0089] traversing a plurality of metric elements of each edge; and

[0090] generating a plurality of evaluation sub-networks corresponding to the plurality of metric elements respectively.

[0091] 5. The method according to any one of clauses 1 - 4, further including:

[0092] contracting the plurality of sub-networks in parallel by the plurality of computing nodes.

[0093] 6. The method according to any one of clauses 1 - 5, further including:

[0094] determining a final contraction order for each of the plurality of sub-networks; and

[0095] contracting each of the plurality of sub-networks based on the final contraction order.

[0096] 7. The method according to any one of clauses 1-6, wherein:

[0097] the tensor network is used to simulate a quantum circuit including one or more quantum gates and one or more qubit lines,

[0098] the multiple tensors correspond to the one or more quantum gates, and

[0099] the multiple edges correspond to the one or more qubit lines.

[0100] 8. The method according to any one of clauses 1-7, wherein the system is a cloud system.

[0101] 9. A non-transitory computer-readable medium storing a set of instructions that can be executed by at least one processor of a system to cause the system to contract a tensor network, the method including:

[0102] receiving a tensor network including multiple tensors and multiple edges between the multiple tensors, wherein each edge is associated with multiple index elements;

[0103] determining a contraction order of the tensor network;

[0104] determining, based on the tensor network, one or more edges among the multiple edges for generating multiple sub-networks; and

[0105] allocating the multiple sub-networks to multiple computing nodes of the system to cause the multiple computing nodes to contract the multiple sub-networks based on the contraction order.

[0106] 10. The non-transitory computer-readable medium according to clause 9, wherein:

[0107] the multiple edges include one or more open edges and one or more closed edges, and

[0108] the set of instructions can be executed by at least one processor of the system to cause the system to further execute:

[0109] creating a virtual tensor for connecting the one or more open edges;

[0110] generating an intermediate tensor network having one or more open edges closed by the virtual tensor;

[0111] performing tree decomposition on the intermediate tensor network to construct a tree; and

[0112] determining the contraction order of the tensor network based on the tree.

[0113] 11. The non-transitory computer-readable medium according to clause 9 or 10, wherein the set of instructions is executable by at least one processor of the system to cause the system to further perform:

[0114] Generate a plurality of evaluation sub-networks for each of the plurality of edges;

[0115] Based on the plurality of evaluation sub-networks, respectively estimate the resource consumption required for contracting the tensor network; and

[0116] Based on the estimated resource consumption, determine one or more edges that require lower consumption.

[0117] 12. The non-transitory computer-readable medium according to clause 11, wherein the set of instructions is executable by at least one processor of the system to cause the system to further perform:

[0118] Traverse the multiple metric elements of each edge; and

[0119] Generate a plurality of evaluation sub-networks respectively corresponding to the multiple metric elements.

[0120] 13. The non-transitory computer-readable medium according to clause 11, wherein the set of instructions is executable by at least one processor of the system to cause the system to further perform:

[0121] Traverse the multiple metric elements of each edge; and

[0122] Generate a plurality of evaluation sub-networks respectively corresponding to the multiple metric elements.

[0123] 14. The non-transitory computer-readable medium according to any one of clauses 10 - 13, wherein the set of instructions is executable by at least one processor of the system to cause the system to further perform:

[0124] Contract the plurality of sub-networks in parallel by the plurality of computing nodes.

[0125] 15. The non-transitory computer-readable medium according to any one of clauses 10 - 14, wherein the set of instructions is executable by at least one processor of the system to cause the system to further perform:

[0126] Determine a final contraction order for each of the plurality of sub-networks; and

[0127] Based on the final contraction order, contract each of the plurality of sub-networks.

[0128] 16. The non - transitory computer - readable medium according to any one of clauses 10 - 15, wherein the set of instructions is executable by at least one processor of the system to cause the system to further perform:

[0129] The tensor network is used to simulate a quantum circuit including one or more quantum gates and one or more qubit lines,

[0130] The plurality of tensors correspond to the one or more quantum gates, and

[0131] The plurality of edges correspond to the one or more qubit lines.

[0132] 17. The non - transitory computer - readable medium according to any one of clauses 10 - 16, wherein the system is a cloud system.

[0133] 18. A system, comprising:

[0134] A plurality of computing nodes;

[0135] One or more memories that store a set of instructions; and

[0136] One or more processors configured to execute the set of instructions to cause the system to perform:

[0137] Receive a tensor network including a plurality of tensors and a plurality of edges between the plurality of tensors, wherein each edge is associated with a plurality of index elements;

[0138] Determine a contraction order of the tensor network;

[0139] Based on the tensor network, determine one or more edges among the plurality of edges for generating a plurality of sub - networks; and

[0140] Assign the plurality of sub - networks to the plurality of computing nodes of the system to contract the plurality of sub - networks by the plurality of computing nodes based on the contraction order.

[0141] 19. The system according to clause 18, wherein:

[0142] The plurality of edges include one or more open edges and one or more closed edges, and

[0143] The one or more processors are further configured to execute the set of instructions to cause the system to perform:

[0144] Create a virtual tensor for connecting the one or more open edges;

[0145] Generate an intermediate tensor network having one or more open edges closed by the virtual tensor;

[0146] Perform a tree decomposition on the intermediate tensor network to construct a tree; and

[0147] Based on the tree, determine the contraction order of the tensor network.

[0148] 20. The system according to clause 18 or 19, wherein the one or more processors are further configured to execute the set of instructions to cause the system to perform:

[0149] Generate a plurality of evaluation sub-networks for each of the plurality of edges;

[0150] Based on the plurality of evaluation sub-networks, respectively estimate the resource consumption required for contracting the tensor network; and

[0151] Based on the estimation, determine one or more edges that require lower consumption.

[0152] 21. The system according to clause 20, wherein the one or more processors are further configured to execute the set of instructions to cause the system to perform:

[0153] Traverse the plurality of metric elements of each edge; and

[0154] Generate a plurality of evaluation sub-networks respectively corresponding to the plurality of metric elements.

[0155] 22. The system according to any one of clauses 18-21, wherein the one or more processors are further configured to execute the set of instructions to cause the system to perform:

[0156] Contract the plurality of sub-networks in parallel by the plurality of computing nodes.

[0157] 23. The system according to any one of clauses 18-22, wherein the one or more processors are further configured to execute the set of instructions to cause the system to perform:

[0158] Determine a final contraction order for each of the plurality of sub-networks; and

[0159] Based on the final contraction order, contract each of the plurality of sub-networks.

[0160] 24. The system according to any one of clauses 18-23, wherein the one or more processors are further configured to execute the set of instructions to cause the system to perform:

[0161] The tensor network is used to simulate a quantum circuit including one or more quantum gates and one or more qubit lines,

[0162] The plurality of tensors correspond to the one or more quantum gates, and

[0163] the plurality of edges correspond to the one or more qubit lines.

[0164] 25. The system according to any one of clauses 18 - 24, wherein the system is a cloud system.

[0165] It should be understood that, for clarity, certain features of the specification described in the context of separate embodiments may also be provided in combination in a single embodiment. Conversely, for brevity, the various features of this specification described in the context of a single embodiment may also be provided separately, or in any suitable sub - combination, or appropriately provided in any other described embodiment of this specification. Certain features described in the context of various embodiments should not be considered essential features of those embodiments unless the embodiment does not function without those elements.

Claims

1. A method for contracting a tensor network, characterized in that including: receiving, by a system, a tensor network including a plurality of tensors and a plurality of edges between the plurality of tensors, wherein each edge is associated with a plurality of index elements; determining a contraction order of the tensor network; determining, based on the tensor network, one or more edges among the plurality of edges for generating a plurality of sub-networks; and allocating the plurality of sub-networks to a plurality of computing nodes of the system for the plurality of computing nodes to contract the plurality of sub-networks based on the contraction order.

2. The method according to claim 1, wherein the edges include one or more open edges and one or more closed edges, and determining the contraction order of the tensor network includes: creating a virtual tensor for connecting the one or more open edges; generating an intermediate tensor network having the one or more open edges closed by the virtual tensor; performing a tree decomposition on the intermediate tensor network to construct a tree; and determining the contraction order of the tensor network based on the tree.

3. The method according to claim 1, wherein Determining, based on the tensor network, one or more edges among the plurality of edges for generating the plurality of sub-networks includes: generating a plurality of evaluation sub-networks for each edge among the plurality of edges; estimating, based on the plurality of evaluation sub-networks, resource consumption required for contracting the tensor network respectively; and determining one or more edges with lower consumption based on the estimated resource consumption.

4. The method according to claim 3, characterized in that, Generating the plurality of evaluation sub-networks for each edge among the plurality of edges includes: traversing the plurality of index elements of each edge; and generating the plurality of evaluation sub-networks corresponding to the plurality of index elements respectively.

5. The method according to claim 1, wherein further including: contracting the plurality of sub-networks in parallel by the plurality of computing nodes.

6. The method according to claim 1, wherein further including: determining a final contraction order for each sub-network among the plurality of sub-networks; and contracting each sub-network among the plurality of sub-networks based on the final contraction order.

7. The method according to claim 1, wherein the tensor network is used to simulate a quantum circuit including one or more quantum gates and one or more qubit lines, the plurality of tensors correspond to the one or more quantum gates, and the plurality of edges correspond to the one or more qubit lines.

8. The method according to any one of claims 1 to 7, characterized in that, The system is a cloud system.

9. A non-transitory computer-readable medium storing a set of instructions, characterized in that, The set of instructions is executed by at least one processor of the system to cause the system to execute the method for contracting a tensor network according to any one of claims 1 to 8.

10. A system for contracting a tensor network, characterized in that, including: a plurality of computing nodes; one or more memories storing a set of instructions; and one or more processors configured to execute the set of instructions to cause the system to execute the method for contracting a tensor network according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Skeletal muscle mechanical behavior multiscale modeling method

    CN106202739A

  • Example segmenting method and device

    CN106651877A