EagerPy is a thin wrapper around **PyTorch** and **TensorFlow Eager** that unifies their interface and thus allows writing code that works with both.
Project description
EagerPy is a thin wrapper around PyTorch and TensorFlow Eager that unifies their interface and thus allows writing code that works with both.
Warning: this is work in progress; the tests should run through just fine, but lot’s of features are still missing. Let me know if this project is useful to you and which features are needed.
Installation
pip install eagerpy
Example
import eagerpy as ep
import torch
x = torch.tensor([1., 2., 3.])
x = ep.PyTorchTensor(x)
import tensorflow as tf
x = tf.constant([1., 2., 3.])
x = ep.TensorFlowTensor(x)
# In both cases, the resulting EagerPy tensor provides the same
# interface and a library build on top of the interface provided
# by EagerPy will work with both PyTorch and TensorFlow tensors.
# EagerPy tensors provide a lot of functionality through methods, e.g.
x.sum()
x.sqrt()
x.clip(0, 1)
# but EagerPy also provides them as functions, e.g.
ep.sum(x)
ep.sqrt(x)
ep.clip(x, 0, 1)
ep.uniform((3, 3), low=-1., high=1.)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
eagerpy-0.0.2.tar.gz
(3.9 kB
view details)
File details
Details for the file eagerpy-0.0.2.tar.gz
.
File metadata
- Download URL: eagerpy-0.0.2.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1a6c00ac2d93321e558f5e5a066ecda43130135900b275f364bf05b6524700f |
|
MD5 | d485fa96bb2167b6de66b8de3b1ce7b6 |
|
BLAKE2b-256 | d78a1c7e8a5a6d95ce59cb66f79471e9ea8f3bb5ee88059a90784ef4e3e21c08 |