Thanks to visit codestin.com
Credit goes to lib.rs

2 releases

0.1.0-alpha.2 Dec 22, 2025
0.1.0-alpha.1 Sep 29, 2025

#7 in #stride

Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App

243 downloads per month
Used in 32 crates

MIT/Apache

2MB
45K SLoC

torsh-core

Core types and traits for the ToRSh deep learning framework.

Overview

This crate provides the fundamental building blocks used throughout ToRSh:

  • Device abstraction: Unified interface for CPU, CUDA, Metal, and WebGPU backends
  • Data types: Support for various tensor element types (f32, f64, i32, etc.)
  • Shape utilities: Shape manipulation, broadcasting, and stride calculations
  • Storage abstraction: Backend-agnostic tensor storage with reference counting
  • Error types: Comprehensive error handling for ToRSh operations

Features

  • std (default): Standard library support
  • no_std: No standard library (for embedded targets)
  • serialize: Serialization support via serde

Usage

use torsh_core::prelude::*;

// Create a shape
let shape = Shape::new(vec![2, 3, 4]);
println!("Shape: {}, elements: {}", shape, shape.numel());

// Device management
let device = CpuDevice;
println!("Device: {}", device.name());

// Data types
let dtype = DType::F32;
println!("Data type: {}, size: {} bytes", dtype, dtype.size());

Integration with SciRS2

This crate builds on top of scirs2 for core scientific computing functionality, providing a PyTorch-compatible API layer.

License

Licensed under either of

at your option.

Dependencies

~98MB
~1.5M SLoC