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
masscan + nmap + Finger

说明 个人根据使用习惯修改masnmap而来的一个小工具。调用masscan做全端口扫描,再调用nmap做服务识别,最后调用Finger做Web指纹识别。工具使用场景适合风险探测排查、众测等。 使用方法 安装依赖 pip3 install -r requirements.txt -i https:/

Ryan 3 Mar 25, 2022
Small-bets - Ergodic Experiment With Python

Ergodic Experiment Based on this video. Run this experiment with this command: p

Michael Brant 3 Jan 11, 2022
The official implementation of paper Siamese Transformer Pyramid Networks for Real-Time UAV Tracking, accepted by WACV22

SiamTPN Introduction This is the official implementation of the SiamTPN (WACV2022). The tracker intergrates pyramid feature network and transformer in

Robotics and Intelligent Systems Control @ NYUAD 28 Nov 25, 2022
Official implementation of the PICASO: Permutation-Invariant Cascaded Attentional Set Operator

PICASO Official PyTorch implemetation for the paper PICASO:Permutation-Invariant Cascaded Attentive Set Operator. Requirements Python 3 torch = 1.0 n

Samira Zare 0 Dec 23, 2021
A Genetic Programming platform for Python with TensorFlow for wicked-fast CPU and GPU support.

Karoo GP Karoo GP is an evolutionary algorithm, a genetic programming application suite written in Python which supports both symbolic regression and

Kai Staats 149 Jan 09, 2023
the code used for the preprint Embedding-based Instance Segmentation of Microscopy Images.

EmbedSeg Introduction This repository hosts the version of the code used for the preprint Embedding-based Instance Segmentation of Microscopy Images.

JugLab 88 Dec 25, 2022
yufan 81 Dec 08, 2022
Realtime YOLO Monster Detection With Non Maximum Supression

Realtime-YOLO-Monster-Detection-With-Non-Maximum-Supression Table of Contents In

5 Oct 07, 2022
This is a Pytorch implementation of the paper: Self-Supervised Graph Transformer on Large-Scale Molecular Data.

This is a Pytorch implementation of the paper: Self-Supervised Graph Transformer on Large-Scale Molecular Data.

212 Dec 25, 2022
End-to-end image segmentation kit based on PaddlePaddle.

English | 简体中文 PaddleSeg PaddleSeg has released the new version including the following features: Our team won the 6.2k Jan 02, 2023

pq is a jq-like Pickle file viewer

pq PQ is a jq-like viewer/processing tool for pickle files. howto # pq '' file.pkl {'other': 456, 'test': 123} # pq 'table' file.pkl |other|test| | 45

3 Mar 15, 2022
This is the code for the paper "Contrastive Clustering" (AAAI 2021)

Contrastive Clustering (CC) This is the code for the paper "Contrastive Clustering" (AAAI 2021) Dependency python=3.7 pytorch=1.6.0 torchvision=0.8

Yunfan Li 210 Dec 30, 2022
Offical implementation of Shunted Self-Attention via Multi-Scale Token Aggregation

Shunted Transformer This is the offical implementation of Shunted Self-Attention via Multi-Scale Token Aggregation by Sucheng Ren, Daquan Zhou, Shengf

156 Dec 27, 2022
ReLoss - Official implementation for paper "Relational Surrogate Loss Learning" ICLR 2022

Relational Surrogate Loss Learning (ReLoss) Official implementation for paper "R

Tao Huang 31 Nov 22, 2022
Large-scale Hyperspectral Image Clustering Using Contrastive Learning, CIKM 21 Workshop

Spectral-spatial contrastive clustering (SSCC) Yaoming Cai, Yan Liu, Zijia Zhang, Zhihua Cai, and Xiaobo Liu, Large-scale Hyperspectral Image Clusteri

Yaoming Cai 4 Nov 02, 2022
FPGA: Fast Patch-Free Global Learning Framework for Fully End-to-End Hyperspectral Image Classification

FPGA & FreeNet Fast Patch-Free Global Learning Framework for Fully End-to-End Hyperspectral Image Classification by Zhuo Zheng, Yanfei Zhong, Ailong M

Zhuo Zheng 92 Jan 03, 2023
Anomaly Detection Based on Hierarchical Clustering of Mobile Robot Data

We proposed a new approach to detect anomalies of mobile robot data. We investigate each data seperately with two clustering method hierarchical and k-means. There are two sub-method that we used for

Zekeriyya Demirci 1 Jan 09, 2022
PyTorch Implementation of NCSOFT's FastPitchFormant: Source-filter based Decomposed Modeling for Speech Synthesis

FastPitchFormant - PyTorch Implementation PyTorch Implementation of FastPitchFormant: Source-filter based Decomposed Modeling for Speech Synthesis. Qu

Keon Lee 63 Jan 02, 2023
Official implementation of Few-Shot and Continual Learning with Attentive Independent Mechanisms

Few-Shot and Continual Learning with Attentive Independent Mechanisms This repository is the official implementation of Few-Shot and Continual Learnin

Chikan_Huang 25 Dec 08, 2022
Implementation of SwinTransformerV2 in TensorFlow.

SwinTransformerV2-TensorFlow A TensorFlow implementation of SwinTransformerV2 by Microsoft Research Asia, based on their official implementation of Sw

Phan Nguyen 2 May 30, 2022