{"id":17623744,"url":"https://github.com/wiseaidev/tinygrad","last_synced_at":"2025-05-01T09:16:54.027Z","repository":{"id":223367772,"uuid":"760147861","full_name":"wiseaidev/tinygrad","owner":"wiseaidev","description":"You like pytorch? You like micrograd? You love tinygrad! ❤️ (WIP)","archived":false,"fork":false,"pushed_at":"2024-08-19T23:27:30.000Z","size":18,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-01T09:16:48.108Z","etag":null,"topics":["pytorch","rust","tinygrad","tinygrad-cuda"],"latest_commit_sha":null,"homepage":"https://docs.rs/tinygrad","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wiseaidev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-19T21:47:16.000Z","updated_at":"2024-10-20T01:41:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"bbd20c2b-2431-41a6-872f-95f7a2dce1b8","html_url":"https://github.com/wiseaidev/tinygrad","commit_stats":null,"previous_names":["wiseaidev/tinygrad"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wiseaidev%2Ftinygrad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wiseaidev%2Ftinygrad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wiseaidev%2Ftinygrad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wiseaidev%2Ftinygrad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wiseaidev","download_url":"https://codeload.github.com/wiseaidev/tinygrad/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251850182,"owners_count":21653978,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pytorch","rust","tinygrad","tinygrad-cuda"],"created_at":"2024-10-22T21:42:41.784Z","updated_at":"2025-05-01T09:16:53.990Z","avatar_url":"https://github.com/wiseaidev.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ✨️ tinygrad\n\n[![Crates.io](https://img.shields.io/crates/v/tinygrad.svg)](https://crates.io/crates/tinygrad)\n[![docs](https://docs.rs/tinygrad/badge.svg)](https://docs.rs/tinygrad/)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\nA Rust crate for building and training neural networks. `tinygrad` provides a simple interface for defining tensors, performing forward and backward passes, and implementing basic operations such as dot products and summation.\n\n## 🚀 Quick Start\n\nGet started with the `tinygrad` library by following these simple steps:\n\n1. Install the `tinygrad` crate by adding the following line to your `Cargo.toml` file:\n\n```toml\n[dependencies]\ntinygrad = \"0.1.0\"\n```\n\n1. Use the `Tensor` and `ForwardBackward` traits to create and work with tensors:\n\n```rust\nuse ndarray::{array, Array1};\nuse tinygrad::{Tensor, Context, TensorTrait};\n\n// Create a tensor\nlet value = array![1.0, 2.0, 3.0];\nlet tensor = Tensor::new(value);\n\n// Perform forward and backward passes\nlet mut ctx = Context::new();\nlet result = tensor.forward(\u0026mut ctx, vec![tensor.get_value()]);\ntensor.backward(\u0026mut ctx, array![1.0, 1.0, 1.0].view());\n```\n\n3. Implement custom operations by defining structs that implement the `ForwardBackward` trait:\n\n```rust\nuse ndarray::ArrayView1;\nuse tinygrad::{ForwardBackward, Context, TensorTrait};\n\n// Example operation: Dot product\nstruct Dot;\n\nimpl ForwardBackward for Dot {\n    fn forward(\u0026self, _ctx: \u0026mut Context, inputs: Vec\u003cArrayView1\u003cf64\u003e\u003e) -\u003e f64 {\n        let input = \u0026inputs[0];\n        let weight = \u0026inputs[1];\n        input.dot(weight)\n    }\n\n    fn backward(\u0026self, ctx: \u0026mut Context, grad_output: ArrayView1\u003cf64\u003e) {\n        // Implement backward pass\n        // ...\n    }\n}\n```\n\n# 🔧 Usage Example\n\n```rust\nuse ndarray::{array, Array1};\nuse tinygrad::{Tensor, Context, TensorTrait};\n\nfn main() {\n    let input = array![1.0, 2.0, 3.0];\n    let weight = array![4.0, 5.0, 6.0];\n\n    let input_tensor = Box::new(Tensor::new(input));\n    let weight_tensor = Box::new(Tensor::new(weight));\n\n    let dot_fn = Dot;\n    let mut ctx = Context::new();\n\n    let inputs = vec![\n        input_tensor.get_value(),\n        weight_tensor.get_value(),\n    ];\n    let output = dot_fn.forward(\u0026mut ctx, inputs);\n\n    println!(\"Dot product: {:?}\", output);\n\n    let grad_output = array![1.0, 1.0, 1.0];\n    dot_fn.backward(\u0026mut ctx, grad_output.view());\n\n    let grad_input = \u0026input_tensor.grad.clone();\n    let grad_weight = \u0026weight_tensor.grad.clone();\n\n    println!(\"Gradient for input: {:?}\", grad_input);\n    println!(\"Gradient for weight: {:?}\", grad_weight);\n}\n```\n\n# 🧪 Testing\n\nRun tests for the `tinygrad` crate using:\n\n```bash\ncargo test\n```\n\n## 🌐 GitHub Repository\n\nYou can access the source code for the `tinygrad` crate on [GitHub](https://github.com/wiseaidev/tinygrad).\n\n## 🤝 Contributing\n\nContributions and feedback are welcome! If you'd like to contribute, report an issue, or suggest an enhancement, please engage with the project on [GitHub](https://github.com/wiseaidev/tinygrad). Your contributions help improve this crate for the community.\n\n# 📘 Documentation\n\nFull documentation for `tinygrad` is available on [docs.rs](https://docs.rs/tinygrad/).\n\n# 📄 License\n\nThis project is licensed under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwiseaidev%2Ftinygrad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwiseaidev%2Ftinygrad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwiseaidev%2Ftinygrad/lists"}