torsh-core

Crates.iotorsh-core
lib.rstorsh-core
version0.1.0-alpha.2
created_at2025-09-29 23:42:03.827772+00
updated_at2025-12-22 04:32:35.634286+00
descriptionCore types and traits for ToRSh deep learning framework
homepagehttps://github.com/cool-japan/torsh/
repositoryhttps://github.com/cool-japan/torsh/
max_upload_size
id1860397
size2,493,338
KitaSan (cool-japan)

documentation

README

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.

Commit count: 0

cargo fmt