Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Athena

Another deep learning library.
Experimeted with directly generating ops rather than lowering from AST tree. The ops can be run on CPU(numpy) or GPU(custom cuda kernels).
Good enough to solve xor, mnist, iris, etc... on GPU. Currently only supports NVIDIA.

EXAMPLE

from athena import *

PROG.driver = CudaDriver()

'''
Shape Static Tensor
By marking a tensor to be static(sshape=True) in shape, the tensor
is allocated in the beginning on the device and is not freed until the end
'''
x = Tensor(data=None, shape = (1,2), num=3, sshape=True)
v = Tensor(data=[[1,2]])
d = x + v

#compile the above operations
PROG.compile()

#print the ops generated in the forward pass
PROG.printForward()
#print the ops generated in the backward pass
PROG.printBackward()

PROG.forward()
print(d.numpy())  #no need to .detach()
PROG.backward(d)  #backward with respect to Tensor d
AllocTmp: (1, 2), 0
AllocTmp: (1, 2), 0
AllocTmp: (1, 2), 0
Add: <Tensor (1, 2) @ 0>, <Tensor (1, 2) @ 2>
Add: <Tensor (1, 2) @ 1>, <Tensor (1, 2) @ 5>
Add: <Tensor (1, 2) @ 3>, <Tensor (1, 2) @ 5>
[[4. 5.]]

BUILD

Clone the repo and your good to go. If you want GPU support, you will nead nvcc cuda compiler. Run nvidia.sh to compile the cuda kernels.

Contributors

Languages