Package Exports
- stargrad
- stargrad/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (stargrad) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
StarGrad
StarGrad is a powerful JavaScript library that provides automatic gradient calculation and mathematical tools, inspired by PyTorch's functionality. It's designed to make deep learning and mathematical computations more accessible to JavaScript developers.
Features
- Automatic gradient calculation
- Tensor operations similar to PyTorch
- Mathematical operations and functions
- GPU acceleration support (coming soon)
- TypeScript support
Installation
You can install StarGrad using npm:
npm install stargrad
Quick Start
Import StarGrad in your project:
import { Tensor } from 'stargrad';
// Create a tensor
const x = new Tensor([1, 2, 3]);
// Perform operations
const y = x.mul(2); // Multiply by 2
const z = y.add(1); // Add 1
// Calculate gradients
z.backward();
Documentation
Core Concepts
- Tensors: The fundamental data structure in StarGrad
- Autograd: Automatic gradient calculation system
- Operations: Mathematical operations on tensors
Basic Operations
// Create tensors
const a = new Tensor([1, 2, 3]);
const b = new Tensor([4, 5, 6]);
// Basic arithmetic
const sum = a.add(b);
const product = a.mul(b);
const quotient = a.div(b);
// Matrix operations
const matrix = new Tensor([[1, 2], [3, 4]]);
const transpose = matrix.transpose();
Contributing
We welcome contributions! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
If you encounter any issues or have questions, please open an issue on our GitHub repository.