Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

3outeille/Yaae

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

51 Commits

Repository files navigation

Introduction

  • Yaae (Yet another autodiff engine) is an automatic differentiation engine written in Numpy which comes with a small neural networks library. It supports scalar operations as well as tensors operations and comes with various functions such as exponential, relu, sigmoid ... For educational puprose only.

  • Here is my blog post explaining how an automatic differentiation works and my design/implementation choices.

Quickstart

  • Let's compare a simple example using Yaae and Pytorch.
# Yaae.
w1 = Node(2, requires_grad=True)
w2 = Node(3, requires_grad=True)
w3 = w2 * w1
w4 = w1.sin()
w5 = w3 + w4
z = w5
z.backward()
w1_yaae, w2_yaae, z_yaae = w1, w2, z
# Pytorch.
w1 = torch.Tensor([2]).double()
w1.requires_grad = True
w2 = torch.Tensor([3]).double()
w2.requires_grad = True
w3 = w2 * w1
w4 = w1.sin()
w5 = w3 + w4
z = w5
z.backward()
w1_torch, w2_torch, z_torch = w1, w2, z
# Forward pass.
assert z_yaae.data == z_torch.data.item() # True.
# Backward pass.
assert w1_yaae.grad.data == w1_torch.grad.item() # True.
assert w2_yaae.grad.data == w2_torch.grad.item() # True.

Example of usage

  • If you are still skeptical, here is my GAN implemented with Yaae.

Installation

  • Create a virtual environment in the root folder using virtualenv and activate it.
# On Linux terminal, using virtualenv.
virtualenv my_yaae_env
# Activate it.
source my_yaee_env/bin/activate
  • Install requirements.txt.
pip install -r requirements.txt
# Tidy up the root folder.
python3 setup.py clean

About

Yaae: Yet another autodiff engine (written in Numpy).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

Languages

AltStyle によって変換されたページ (->オリジナル) /