Tensor-Based Quantum Machine Learning

Overview
https://codecov.io/gh/tensorly/quantum/branch/main/graph/badge.svg?token=5P8GZ8YLO7

TensorLy_Quantum

TensorLy-Quantum is a Python library for Tensor-Based Quantum Machine Learning that builds on top of TensorLy and PyTorch.

With TensorLy-Quantum, you can easily:

  • Create large quantum circuit: Tensor network formalism requires up to exponentially less memory for quantum simulation than traditional vector and matrix approaches.
  • Leverage tensor methods: the state vectors are efficiently represented in factorized form as Tensor-Rings (MPS) and the operators as TT-Matrices (MPO)
  • Efficient simulation: tensorly-quantum leverages the factorized structure to efficiently perform quantum simulation without ever forming the full, dense operators and state-vectors
  • Multi-Basis Encoding: we provide multi-basis encoding out-of-the-box for scalable experimentation
  • Solve hard problems: we provide all the tools to solve the MaxCut problem for an unprecendented number of qubits / vertices

Installing TensorLy-Quantum

Through pip

pip install tensorly-quantum

From source

git clone https://github.com/tensorly/quantum
cd quantum
pip install -e .
Comments
  • Rz has no gradient issue resolved

    Rz has no gradient issue resolved

    Hey there, The way RotZ was implemented it didn't have any gradient. I fixed the issue by using the same template as for the RotY and RotX. I think the tl.tensor() in the original version somehow blocked the backprop. The way it is written now the gradient is correct.

    opened by PatrickHuembeli 3
  • calculate_cut in the VQE example?

    calculate_cut in the VQE example?

    Hello! I have been trying to use your code to compute the MaxCut in the VQE jupyter notebook provided in the example sections. I tried to apply the calculate_cut function on the state as tlq.calculate_cut(state, qubits1, qubits2, weights) but I am having the following error TypeError: only integer tensors of a single element can be converted to an index.

    I see that the cut is calculated differently in the MBE example, but I would like to know if there is an analogue way of doing it with the VQE. Or should I just adapt my Hamiltonian to maximize the cut? Any help is appreciated, Thanks!

    opened by marionsilv 2
  • How to use cuQuantum as a backend

    How to use cuQuantum as a backend

    Hi,

    Thank you for your great work! May I know how to use cuQuantum as a backend as mentioned in your paper? Could you please provide a code example? How does the cuQuantum backend support autograd? Thank you very much!

    opened by nadbp 1
  • CNOT gate issue

    CNOT gate issue

    Hello,

    I have been trying to build a circuit with a CNOT gate acting on non-contiguous qubits (e.g., qubit 1 and 4), but I am finding strange results.

    For example, if I choose an initial state [1,0,0,0]

    and apply the unitary uni = tlq.Unitary([tlq.CNOTL(device=device, dtype=dtype), tlq.CNOTR(device=device, dtype=dtype), tlq.IDENTITY(dtype=dtype, device=device), tlq.IDENTITY(dtype=dtype, device=device)], nqubits, ncontraq, device=device, dtype=dtype)

    I get (for the expected value of Sz): tensor([-1., -1., 1., 1.])

    However, if I apply the CNOT cores to non-adjacent qubits in the same initial state, with uni = tlq.Unitary([tlq.CNOTL(device=device, dtype=dtype), tlq.IDENTITY(dtype=dtype, device=device), tlq.IDENTITY(dtype=dtype, device=device), tlq.CNOTR(device=device, dtype=dtype)], nqubits, ncontraq, device=device, dtype=dtype)

    I find, again for the expected value of Sz: tensor([-2., 2., 2., 0.])

    Is there any limitation regarding the CNOT cores that make it only valid for adjacent qubits, or am I doing something wrong? I am attaching a file with the full code for running: code.txt

    Thanks for the help, Marion Silvestrini.

    opened by marionsilv 2
  • Hamiltonian unitary

    Hamiltonian unitary

    Hello all,

    I was wondering if there is a way in TensorLy Quantum to build a parametrised unitary based on a binary Hamiltonian, such as the Ising model given in the examples, for use in the circuits.

    I mean to use it in an application like a QAOA, for instance. Is there a way to adapt from the binary_hamiltonian function, or something like that?

    Thanks!

    opened by rafaeleb 10
Releases(0.1.0)
Owner
TensorLy
Tensor Learning in Python.
TensorLy
Learn about quantum computing and algorithm on quantum computing

quantum_computing this repo contains everything i learn about quantum computing and algorithm on quantum computing what is aquantum computing quantum

arfy slowy 8 Dec 25, 2022
QHack—the quantum machine learning hackathon

Official repo for QHack—the quantum machine learning hackathon

Xanadu 72 Dec 21, 2022
Official repo for QHack—the quantum machine learning hackathon

Note: This repository has been frozen while we consider the submissions for the QHack Open Hackathon. We hope you enjoyed the event! Welcome to QHack,

Xanadu 118 Jan 5, 2023
Gradient-free global optimization algorithm for multidimensional functions based on the low rank tensor train format

ttopt Description Gradient-free global optimization algorithm for multidimensional functions based on the low rank tensor train (TT) format and maximu

null 5 May 23, 2022
(Py)TOD: Tensor-based Outlier Detection, A General GPU-Accelerated Framework

(Py)TOD: Tensor-based Outlier Detection, A General GPU-Accelerated Framework Background: Outlier detection (OD) is a key data mining task for identify

Yue Zhao 127 Jan 5, 2023
Spectral Tensor Train Parameterization of Deep Learning Layers

Spectral Tensor Train Parameterization of Deep Learning Layers This repository is the official implementation of our AISTATS 2021 paper titled "Spectr

Anton Obukhov 12 Oct 23, 2022
Effect of Different Encodings and Distance Functions on Quantum Instance-based Classifiers

Effect of Different Encodings and Distance Functions on Quantum Instance-based Classifiers The repository contains the code to reproduce the experimen

Alessandro Berti 4 Aug 24, 2022
TuckER: Tensor Factorization for Knowledge Graph Completion

TuckER: Tensor Factorization for Knowledge Graph Completion This codebase contains PyTorch implementation of the paper: TuckER: Tensor Factorization f

Ivana Balazevic 296 Dec 6, 2022
FluidNet re-written with ATen tensor lib

fluidnet_cxx: Accelerating Fluid Simulation with Convolutional Neural Networks. A PyTorch/ATen Implementation. This repository is based on the paper,

JoliBrain 50 Jun 7, 2022
Pretty Tensor - Fluent Neural Networks in TensorFlow

Pretty Tensor provides a high level builder API for TensorFlow. It provides thin wrappers on Tensors so that you can easily build multi-layer neural networks.

Google 1.2k Dec 29, 2022
A torch.Tensor-like DataFrame library supporting multiple execution runtimes and Arrow as a common memory format

TorchArrow (Warning: Unstable Prototype) This is a prototype library currently under heavy development. It does not currently have stable releases, an

Facebook Research 536 Jan 6, 2023
Code to reproduce the results in the paper "Tensor Component Analysis for Interpreting the Latent Space of GANs".

Tensor Component Analysis for Interpreting the Latent Space of GANs [ paper | project page ] Code to reproduce the results in the paper "Tensor Compon

James Oldfield 4 Jun 17, 2022
PyTorch framework, for reproducing experiments from the paper Implicit Regularization in Hierarchical Tensor Factorization and Deep Convolutional Neural Networks

Implicit Regularization in Hierarchical Tensor Factorization and Deep Convolutional Neural Networks. Code, based on the PyTorch framework, for reprodu

Asaf 3 Dec 27, 2022
This is a Machine Learning Based Hand Detector Project, It Uses Machine Learning Models and Modules Like Mediapipe, Developed By Google!

Machine Learning Hand Detector This is a Machine Learning Based Hand Detector Project, It Uses Machine Learning Models and Modules Like Mediapipe, Dev

Popstar Idhant 3 Feb 25, 2022
Machine Learning From Scratch. Bare bones NumPy implementations of machine learning models and algorithms with a focus on accessibility. Aims to cover everything from linear regression to deep learning.

Machine Learning From Scratch About Python implementations of some of the fundamental Machine Learning models and algorithms from scratch. The purpose

Erik Linder-Norén 21.8k Jan 9, 2023
Vowpal Wabbit is a machine learning system which pushes the frontier of machine learning with techniques such as online, hashing, allreduce, reductions, learning2search, active, and interactive learning.

This is the Vowpal Wabbit fast online learning code. Why Vowpal Wabbit? Vowpal Wabbit is a machine learning system which pushes the frontier of machin

Vowpal Wabbit 8.1k Jan 6, 2023
The challenge for Quantum Coalition Hackathon 2021

Qchack 2021 Google Challenge This is a challenge for the brave 2021 qchack.io participants. Instructions Hello, intrepid qchacker, welcome to the <G|o

quantumlib 18 May 4, 2022
'Solving the sampling problem of the Sycamore quantum supremacy circuits

solve_sycamore This repo contains data, contraction code, and contraction order for the paper ''Solving the sampling problem of the Sycamore quantum s

Feng Pan 29 Nov 28, 2022