Skip to main content

A PyTorch clone made using NumPy (for CPU) and CuPy (for GPU)

Project description

nptorch

A lightweight PyTorch clone - deep learning library built using NumPy (for CPU) and CuPy (for GPU). Ideal for understanding the core concepts of deep learning, backpropagation, automatic differentiation, and tensor operations in a minimalistic, easy-to-follow implementation. May be practically useful in scenarios where the library's small size and low dependency requirements are advantageous.

Install nptorch using pip:

pip install nptorch

## Getting Started


```python
import nptorch as nt

# Create tensors
x = nt.tensor([[1.0, 2], [3, 4]], requires_grad=True)
y = nt.tensor([[5.0, 6], [7, 8]], requires_grad=True)

# Perform operations
z = x + y
w = z.mean()
w.backward()

# Print results
print("z:", z)
print("x.grad:", x.grad)
print("y.grad:", y.grad)
z: tensor([[ 6.  8.]
        [10. 12.]], float32, grad_fn=<'Add' at 0x722942528260>)
x.grad: tensor([[0.25 0.25]
        [0.25 0.25]], float32)
y.grad: tensor([[0.25 0.25]
        [0.25 0.25]], float32)

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

nptorch-0.0.2.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nptorch-0.0.2-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

Details for the file nptorch-0.0.2.tar.gz.

File metadata

  • Download URL: nptorch-0.0.2.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for nptorch-0.0.2.tar.gz
Algorithm Hash digest
SHA256 c40c896ee21aa1229eb8be75403c8dfa55edf74b308bd6ea747fba574e95de40
MD5 e00c40f520d3003587beac9b52b061db
BLAKE2b-256 066de27a6c4a74819fd6c403077f3b461f3be319f2f7b571f2867a6fe5e31fbd

See more details on using hashes here.

File details

Details for the file nptorch-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: nptorch-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 19.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for nptorch-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b187beff19a3b789eea44613324fae9316d76524133a7e607d5a897be70934d0
MD5 95ce4f8d673afe869f6894cdeff79cd7
BLAKE2b-256 463f31ebdb17272f752a7168f3c6bd0adc9d271a7858431ff2564ee6745d7311

See more details on using hashes here.

Supported by

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