Skip to content

PanchoK50/tensor-network-compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CompTN

Instalation:

  • First install and build llvm including MLIR
  • Clone this repository and change these lines in the CMakeLists.txt file at the very top:
    #leave it like that if the llvm-project is in the same directory as this project
    set(MLIR_DIR "../llvm-project/build/lib/cmake/mlir")
    set(LLVM_DIR "../llvm-project/build/lib/cmake/llvm")
  • Create a build directory and make the project:
    mkdir build \
    cd build \
    make

System Overview:

overview (1)

Passes:

  • Rank Simplification
  • Slicing
  • Greedy path-search with:
    • Gray-Kourtis heuristic
    • FLOP heuristic
  • Lowering passes

Example:

import tensor_network_ext as tn

mm = tn.ModuleManager()

index1 = mm.Index(2)
index2 = mm.Index(3)
index3 = mm.Index(4)

array1 = np.array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]])
array2 = np.array([[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0]])
array3 = np.array([[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0], [9.0, 10.0, 11.0, 12.0]])

tensor1 = mm.Tensor(array1, index1, index2)
tensor2 = mm.Tensor(array2, index1, index3)
tensor3 = mm.Tensor(array3, index2, index3)

mm.contract_multiple(tensor1, tensor2, tensor3)

print("Module:")
mm.dump()

print("Result:")
run_result = mm.run()
print(run_result)

Helpful resources:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published