All Projects → wkcn → Mobulaop

wkcn / Mobulaop

Licence: mit
A Simple & Flexible Cross Framework Operators Toolkit

Programming Languages

python
139335 projects - #7 most used programming language
operators
16 projects

Projects that are alternatives of or similar to Mobulaop

Tensorly
TensorLy: Tensor Learning in Python.
Stars: ✭ 977 (+506.83%)
Mutual labels:  mxnet, cupy, numpy
DataSciPy
Data Science with Python
Stars: ✭ 15 (-90.68%)
Mutual labels:  numpy, scientific-computing
NPY-for-Fortran
A FORTRAN module to write Numpy's *.npy and *.npz files
Stars: ✭ 30 (-81.37%)
Mutual labels:  numpy, scientific-computing
Xshinnosuke
Deep learning framework realized by Numpy purely, supports for both Dynamic Graph and Static Graph with GPU acceleration
Stars: ✭ 291 (+80.75%)
Mutual labels:  cupy, numpy
SciCompforChemists
Scientific Computing for Chemists text for teaching basic computing skills to chemistry students using Python, Jupyter notebooks, and the SciPy stack. This text makes use of a variety of packages including NumPy, SciPy, matplotlib, pandas, seaborn, NMRglue, SymPy, scikit-image, and scikit-learn.
Stars: ✭ 65 (-59.63%)
Mutual labels:  numpy, scientific-computing
gcpy
Python toolkit for GEOS-Chem.
Stars: ✭ 34 (-78.88%)
Mutual labels:  numpy, scientific-computing
Datacube Core
Open Data Cube analyses continental scale Earth Observation data through time
Stars: ✭ 285 (+77.02%)
Mutual labels:  numpy, scientific-computing
Einops
Deep learning operations reinvented (for pytorch, tensorflow, jax and others)
Stars: ✭ 4,022 (+2398.14%)
Mutual labels:  cupy, numpy
Chainer
A flexible framework of neural networks for deep learning
Stars: ✭ 5,656 (+3413.04%)
Mutual labels:  cupy, numpy
Eliot
Eliot: the logging system that tells you *why* it happened
Stars: ✭ 874 (+442.86%)
Mutual labels:  numpy, scientific-computing
PyRates
Open-source, graph-based Python code generator and analysis toolbox for dynamical systems (pre-implemented and custom models). Most pre-implemented models belong to the family of neural population models.
Stars: ✭ 33 (-79.5%)
Mutual labels:  numpy, scientific-computing
Ivy
The templated deep learning framework, enabling framework-agnostic functions, layers and libraries.
Stars: ✭ 118 (-26.71%)
Mutual labels:  mxnet, numpy
python cv AI ML
用python做计算机视觉,人工智能,机器学习,深度学习等
Stars: ✭ 73 (-54.66%)
Mutual labels:  mxnet, numpy
robot
Functions and classes for gradient-based robot motion planning, written in Ivy.
Stars: ✭ 29 (-81.99%)
Mutual labels:  mxnet, numpy
Gluon Nlp
NLP made easy
Stars: ✭ 2,344 (+1355.9%)
Mutual labels:  mxnet, numpy
Python-Matematica
Explorando aspectos fundamentais da matemática com Python e Jupyter
Stars: ✭ 41 (-74.53%)
Mutual labels:  numpy, scientific-computing
Cupy
NumPy & SciPy for GPU
Stars: ✭ 5,625 (+3393.79%)
Mutual labels:  cupy, numpy
Pynvvl
A Python wrapper of NVIDIA Video Loader (NVVL) with CuPy for fast video loading with Python
Stars: ✭ 95 (-40.99%)
Mutual labels:  cupy, numpy
Numcpp
C++ implementation of the Python Numpy library
Stars: ✭ 2,031 (+1161.49%)
Mutual labels:  numpy, scientific-computing
Pyeco
python implementation of efficient convolution operators for tracking
Stars: ✭ 150 (-6.83%)
Mutual labels:  mxnet

MobulaOP

Linux Windows Coverage Badge
Linux Build Status Windows Build Status Coverage Status 996.icu

What is it?

MobulaOP is a simple and flexible cross framework operators toolkit.

You can write custom operators by Python/C++/C/CUDA/HIP/TVM without rebuilding deep learning framework from source.

How to use it?

[中文教程]

[Tutorial]

  • Add an addition operator [Code]
import mobula

@mobula.op.register
class MyFirstOP:
    def forward(self, x, y):
        return x + y
    def backward(self, dy): 
        return [dy, dy]
    def infer_shape(self, in_shape):
        assert in_shape[0] == in_shape[1]
        return in_shape, [in_shape[0]]

# MXNet
import mxnet as mx
a = mx.nd.array([1, 2, 3])
b = mx.nd.array([4, 5, 6])
c = MyFirstOP(a, b)
print (c) # [5, 7, 9]

# PyTorch
import torch
a = torch.tensor([1, 2, 3])
b = torch.tensor([4, 5, 6])
c = MyFirstOP(a, b)
print (c) # [5, 7, 9]

# NumPy
import numpy as np
a = np.array([1, 2, 3])
b = np.array([4, 5, 6])
op = MyFirstOP[np.ndarray]()
c = op(a, b)
print (c) # [5, 7, 9]

# CuPy
import cupy as cp
a = cp.array([1, 2, 3])
b = cp.array([4, 5, 6])
op = MyFirstOP[cp.ndarray]()
c = op(a, b)
print(c) # [5, 7, 9]
  • Use custom operators without rebuilding the source of deep learning framework [Code]
# Use ROIAlign operator
import mxnet as mx
import numpy as np
import mobula

# Load ROIAlign Module
mobula.op.load('ROIAlign')

ctx = mx.cpu(0)
dtype = np.float32
N, C, H, W = 2, 3, 4, 4

data = mx.nd.array(np.arange(N*C*H*W).astype(dtype).reshape((N,C,H,W)))
rois = mx.nd.array(np.array([[0, 1, 1, 3, 3]], dtype = dtype))

data.attach_grad()
with mx.autograd.record():
    # mx.nd.NDArray and mx.sym.Symbol are both available as the inputs.
    output = mobula.op.ROIAlign(data = data, rois = rois, pooled_size = (2,2), spatial_scale = 1.0, sampling_ratio = 1)

print (output.asnumpy(), data.grad.asnumpy())
  • Import Custom C++ Operator Dynamically [Code]
import mobula
# Import Custom Operator Dynamically
mobula.op.load('./AdditionOP')

import mxnet as mx
a = mx.nd.array([1,2,3])
b = mx.nd.array([4,5,6])
c = mobula.op.AdditionOP(a, b)

print ('a + b = c \n {} + {} = {}'.format(a.asnumpy(), b.asnumpy(), c.asnumpy()))

How to get it?

# Clone the project
git clone https://github.com/wkcn/MobulaOP

# Enter the directory
cd MobulaOP

# Install MobulaOP
pip install -v -e .
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].