Skip to content

Commit 779732c

Browse files
committed
fix docs for Torch
1 parent 002397d commit 779732c

File tree

2 files changed

+13
-13
lines changed
  • docs/backend-reference
  • i18n/zh/docusaurus-plugin-content-docs/current/backend-reference

2 files changed

+13
-13
lines changed

docs/backend-reference/torch.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,22 +79,22 @@ otherwise `Tensor2Mat` will use the default CUDA stream.
7979

8080
- [The scheduling system](../Intra-node/schedule.mdx) ensures that the initialization and forward of the backend instance are executed in the same independent thread. Torch perceives that it is in this independent thread mode before activating its own functionality.
8181
- Torch will determine whether the current thread is [bound to the default stream](../preliminaries/pytorch_libtorch) during initialization. If so, it will activate its own functionality: switch the thread to an independent stream during initialization and perform stream synchronization during forward.
82-
- The Sequential container ensures that the initialization order of its sub-backends is opposite to the forward order, such as `Sequential[Torch[A],Torch[B]]`, which initializes in reverse order and forwards in order:
82+
- The Sequential container ensures that the initialization order of its sub-backends is opposite to the forward order, such as `Sequential[SyncTensor[A],SyncTensor[B]]`, which initializes in reverse order and forwards in order:
8383
```mermaid
8484
flowchart LR
85-
BI["Torch[B].init"] --> AI["Torch[A].init"]
86-
AI --> AF["Torch[A].forward"]
87-
AF --> BF["Torch[B].forward "]
85+
BI["SyncTensor[B].init"] --> AI["SyncTensor[A].init"]
86+
AI --> AF["SyncTensor[A].forward"]
87+
AF --> BF["SyncTensor[B].forward "]
8888
```
89-
Torch[A] is not the default stream during initialization, so it does not need to set a new stream or be responsible for stream synchronization during forward. At this time, Torch[B] sets a new stream, so Torch[B] is responsible for stream synchronization.
90-
- Mat2Tensor and Tensor2Mat backends have their own stream synchronization functions for the current stream. However, they cannot change the stream bound by the thread and still need to switch to an independent stream through `S[Tensor2Mat,...,Torch]`, otherwise it will affect performance.
89+
SyncTensor[A] is not the default stream during initialization, so it does not need to set a new stream or be responsible for stream synchronization during forward. At this time, SyncTensor[B] sets a new stream, so SyncTensor[B] is responsible for stream synchronization.
90+
- Mat2Tensor and Tensor2Mat backends have their own stream synchronization functions for the current stream. However, they cannot change the stream bound by the thread and still need to switch to an independent stream through `S[Tensor2Mat,...,SyncTensor]`, otherwise it will affect performance.
9191

9292
</details>
9393

9494

9595
## Torch
9696
Similar to [SyncTensor](#synctensor), but with additional cross-card functionality. Effective from version 0.3.2b1.
97-
- Torch::backend: default=Identity
97+
- Torch::backend: required
9898
- device_id: Default is -1, which sets the current device to this ID. During initialization, it is equivalent to calling `c10::cuda::set_device(device_id)` or `torch.cuda.set_device(device_id)`. During forward propagation, the input data type must be `at::Tensor` or `vector<at::Tensor>`. This backend will move the data to the specified graphics card.
9999

100100
## SaveTensor

i18n/zh/docusaurus-plugin-content-docs/current/backend-reference/torch.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ displayed_sidebar: api
8383

8484
- [调度系统](../Intra-node/schedule.mdx)将确保后端实例的初始化和前向在同一个独立的线程中执行。Torch感知到处于此独立线程模式,才会激活自身功能。
8585
- Torch会在初始化时判断当前线程是否[绑定到了默认流](../preliminaries/pytorch_libtorch)。是的话,将激活自身功能:在初始化时将该线程切换到独立的流,并在前向时进行流同步。
86-
- Sequential 容器可确保其子后端初始化的顺序和前向的顺序相反, 比如 `Sequential[Torch[A],Torch[B]]`, 会倒序初始化, 正序前向:
86+
- Sequential 容器可确保其子后端初始化的顺序和前向的顺序相反, 比如 `Sequential[SyncTensor[A],SyncTensor[B]]`, 会倒序初始化, 正序前向:
8787
```mermaid
8888
flowchart LR
89-
BI["Torch[B].init"] --> AI["Torch[A].init"]
90-
AI --> AF["Torch[A].forward"]
91-
AF --> BF["Torch[B].forward "]
89+
BI["SyncTensor[B].init"] --> AI["SyncTensor[A].init"]
90+
AI --> AF["SyncTensor[A].forward"]
91+
AF --> BF["SyncTensor[B].forward "]
9292
```
93-
Torch[A] 在 初始化时已经不是默认流,则它不用设置新的流, forward时也不用负责流的同步, 此时 Torch[B] 设置了新的流,则由 Torch[B] 负责流的同步;
94-
- Mat2Tensor, Tensor2Mat 后端自带当前流的同步功能;然而其无法改变线程绑定的流,仍需要通过 `S[Tensor2Mat,...,Torch]` 切换到独立流,否则会影响性能。
93+
SyncTensor[A] 在 初始化时已经不是默认流,则它不用设置新的流, forward时也不用负责流的同步, 此时 SyncTensor[B] 设置了新的流,则由 SyncTensor[B] 负责流的同步;
94+
- Mat2Tensor, Tensor2Mat 后端自带当前流的同步功能;然而其无法改变线程绑定的流,仍需要通过 `S[Tensor2Mat,...,SyncTensor]` 切换到独立流,否则会影响性能。
9595

9696
</details>
9797

0 commit comments

Comments
 (0)