Skip to main content

A mini Tensor framework for tensor operations on GPU.

Project description

DeepOps

A Mini Deep learning library, accelerated on GPUs with PyCuda.

No no no.. I havent wrote this library on tensorflow or torch, it is a standalone machine. :P

Implemented backpropogations using reverse traversal, Support gradients and GPU operations, You can make a mini neural network (FNN) and use the in-house optimizer to train it on a dataset (e.g MNIST).

Tip: always give your tensor a funny name! :)

Note: Only for Educational Usage.

alt text

Installation.

pip install deepops

Tensor.

a = Tensor([1,2,3,4,5])
# deepop tensor 

Attach to a cuda device.

a = Tensor([1,2,3,4,5])
a.device("gpu:0") # attach to gpu device.

Check the Device.

a.where
# 'cpu'

Addition.

a = Tensor([1.0,2.0])
print(a + a)
# GPU Operation

Multiplication.

a = Tensor([1.0, 2.0])
print(a.mul(a))
print(a * a)

Calculate Gradients.

Tensor = dp.Tensor
a1 = Tensor([1.0, 3.0, 1.0])
b1 = Tensor([7.0, 3.0, 5.0])

a2 = Tensor([4.0, 3.0, 1.0])
a3 = Tensor([3.0, 3.0, 1.0])
a4 = Tensor([7.0, 1.0, 6.0])
b2 = Tensor([1.0, 21.0, 12.0])

c = a1 * b1 + a3
d = a2 * b2 + a4
out = c * d

# backward
out.backward()

print(out.grad)
print(a1.grad)

Run Tests.

python -m pytest -s

Contribution is highly appreciated.

Please contribute to my work.

TODOs

  • write more tests...
  • need a optimizer.
  • support more operations.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deepop-0.1.dev0.tar.gz (6.5 kB view hashes)

Uploaded Source

Built Distribution

deepop-0.1.dev0-py3-none-any.whl (8.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page