* feat: add v1/v2 versioning and language selector for mdbook - Copy current content to v1/ directory (1st Edition) - Create v2/ directory with new TOC structure (2nd Edition) and placeholder chapters - Add version selector (V1/V2) and language toggle (EN/ZH) in top-right nav bar - Add build scripts: build_mdbook_v1.sh, build_mdbook_v2.sh - Update assemble_docs_publish_tree.py to support v1/v2 deployment layout - Fix mdbook preprocessor to use 'sections' key (v0.4.43 compatibility) - Update .gitignore for new build artifact directories - Deployment layout: / = v2 EN, /cn/ = v2 ZH, /v1/ = v1 EN, /v1/cn/ = v1 ZH Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * build: update CI to build and verify all four books (v1/v2 x EN/ZH) - Clarify step names: "Build v2 (EN + ZH)" and "Build v1 (EN + ZH)" - Add verification step to check all four index.html outputs exist - Deploy workflow assembles: / = v2 EN, /cn/ = v2 ZH, /v1/ = v1 EN, /v1/cn/ = v1 ZH Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: gracefully skip missing TOC entries instead of crashing resolve_toc_target() now returns None for missing files instead of raising FileNotFoundError. This fixes v1 EN build where chapter index files reference TOC entry names that don't match actual filenames. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2.0 KiB
Programming Model
Machine learning frameworks comprise various components that facilitate the efficient development of algorithms, data processing, model deployment, performance optimization, and hardware acceleration. When designing the application programming interfaces (APIs) for these components, a key consideration is striking the right balance between framework performance and usability. To achieve optimal performance, developers utilize C or C++, as these programming languages enable efficient invocation of the APIs provided by the operating system and hardware accelerators.
Regarding usability, machine learning framework users, including data scientists, biologists, chemists, and physicists, often possess strong industrial backgrounds and are skilled in using high-level scripting languages like Python, Matlab, R, and Julia. While these languages offer remarkable programming usability, they lack deep optimization capabilities for underlying hardware or operating systems compared to C and C++. Therefore, the core design objective of machine learning frameworks encompasses two aspects: providing easy-to-use APIs for implementing algorithms using high-level languages like Python, and providing low-level APIs centered around C and C++ to assist framework developers in implementing numerous high-performance components and efficiently executing them on hardware. This chapter describes strategies for achieving this design objective.
The chapter aims to achieve the following learning objectives:
-
Understanding the workflows and programming principles of machine learning frameworks.
-
Understanding the design of neural network models and layers.
-
Understanding how machine learning frameworks bridge Python and C/C++ functions.
-
Understanding the support for functional programming in machine learning frameworks.
:maxdepth: 2
Overview
Machine_Learning_Workflow
Neural_Network_Programming
Functional_Programming
Bridging_Python_and_C_C++_Functions
Chapter_Summary