博客 / 詳情

返回

【Triton 教程】triton_language.join

Triton 是一種用於並行編程的語言和編譯器。它旨在提供一個基於 Python 的編程環境,以高效編寫自定義 DNN 計算內核,並能夠在現代 GPU 硬件上以最大吞吐量運行。

更多 Triton 中文文檔可訪問 →https://triton.hyper.ai/

triton.language.join(a, b)

在 1 個新的次要維度中連接給定的張量。

For example, given two tensors of shape (4,8), produces a new tensor of shape (4,8,2). Given two scalars, returns a tensor of shape (2).

例如,給定 2 個形狀為 (4,8) 的張量,生成 1 個新的形狀為 (4,8,2) 的張量。給定 2 個標量,返回 1 個形狀為 (2) 的張量。

2 個輸入被廣播到相同的形狀。

If you want to join more than two elements, you can use multiple calls to this function. This reflects the constraint in Triton that tensors must have power-of-two sizes.

如果你想連接超過 2 個元素,可以多次調用這個函數。這反映了 Triton 中的約束,即張量的大小必須是 2 的冪。

join 是 split 的逆操作。

參數

  • a (Tensor)– 第 1 個輸入張量。
  • b (Tensor) - 第 2 個輸入張量。
user avatar u_16213335 頭像 xiaopaipiper 頭像 jianhuan 頭像 codelogs 頭像
4 位用戶收藏了這個故事!

發佈 評論

Some HTML is okay.