Posts
All the articles I have published.
-
Miscellaneous Features in Rust Candle
Published date:This article summarizes some miscellaneous features in the Rust Candle framework, including custom implementations of `masked_fill`, broadcasting mechanism (`broadcast_add`), matrix multiplication (`matmul` vs. element-wise multiplication), and an alternative implementation of the module container `ModuleList`. By comparing with PyTorch, it analyzes the differences and solutions in tensor operations and model loading in Candle.
-
Rust Large File Handling Comparison: Standard Library, Tokio, and Memory Mapping
Published date:This article compares three methods of handling large files in Rust: the standard library, Tokio, and memory mapping (mmap) in terms of memory usage. The standard library, which loads files all at once, consumes the most memory. Tokio significantly reduces memory usage through chunked optimization, while mmap, leveraging memory-mapped technology, uses almost no additional memory, offering the best performance.
-
Rust Candle Framework and PyTorch nn Module Network Layer Conversion (1)
Published date:This article compares the similarities and differences between Rust Candle and PyTorch in the implementation of neural network layers, covering sequential containers, convolutional layers (1D/2D and transposed convolution), pooling layers (max pooling and average pooling), and common activation functions. It focuses on analyzing the correspondence between the two in terms of functionality, parameter configuration, and usage, and points out that Candle does not yet support some features such as 3D convolution.
-
Rust Candle Framework and PyTorch nn Module Network Layer Conversion (2)
Published date:This article compares the implementation of common neural network layers in Rust Candle and PyTorch, including normalization layers (BatchNorm, LayerNorm, RMSNorm), recurrent layers (LSTM, GRU), Transformer, linear layers, Dropout layers, embedding layers, and upsampling layers. It summarizes the functional correspondence and differences between the two frameworks and highlights Candle's support for large model inference scenarios.
-
Reduction Operations in Rust Candle Framework and Pytorch Tensors
Published date:This article compares the implementation differences between Pytorch and Rust Candle framework for tensor reduction operations, covering common operations such as summation, mean, maximum, minimum, etc.
-
Pointwise Operations in Rust Candle Framework and Pytorch Tensors
Published date:This article compares the implementation differences between Pytorch and Rust Candle framework for pointwise tensor operations, covering common operations such as absolute value, trigonometric functions, exponentials, etc.
-
Equivalent Operations of Indexing, Slicing, Concatenation, and Mutation for Tensors in Rust Candle Framework and Pytorch
Published date:This article compares the implementation differences between Rust Candle and Pytorch in tensor indexing, slicing, concatenation, mutation, and other operations, covering common tensor operations and their equivalent methods.
-
Basic Equivalent Operations of Tensors in Rust AI Inference Framework Candle and Pytorch
Published date:This article introduces the equivalent implementations of basic tensor operations between Rust Candle and Pytorch, including tensor initialization, shape manipulation, arithmetic operations (addition, subtraction, multiplication, division), and accelerator support. It is suitable for beginners to refer to.
-
A New Choice for Efficient Inference in Rust: Model Deployment Practice Based on ONNX Runtime
Published date:This article introduces how to deploy models using Rust and ONNX Runtime, taking ResNet50 as an example, detailing the entire process of model export, loading, data preprocessing, inference, and post-processing, while analyzing its advantages and disadvantages.
-
What Are the RPIT Lifetime Capture Rules Introduced in Rust 1.85.0?
Published date:Rust 1.85.0 introduces new rules for RPIT (Return Position Impl Trait) lifetime capture. In Rust 2024, all generic parameters (including lifetimes) within scope are implicitly captured by default, without explicit declaration. Developers can use the `use<...>` syntax to precisely control which parameters are captured, avoiding unintended captures. This simplifies code and reduces errors, enhancing expressiveness. The new rules make RPIT usage more intuitive and safer.
-
Do You Prefer Comprehensive Frameworks or Elegant Libraries?
Published date:Choosing Web frameworks in different programming languages, analyzing the pros and cons of 'comprehensive' and 'elegant' frameworks in domestic and international development environments, and providing recommendations based on personal experience.
-
Can Rust Also Play Function Overloading?
Published date:This article explores how to simulate function overloading in Rust, where functions with the same name can be automatically dispatched based on parameter types or counts. Although Rust does not directly support function overloading, several techniques can achieve similar effects. The article details two methods and discusses their pros and cons.