动态

详情 返回 返回

【Triton 教程】triton_language.broadcast_to - 动态 详情

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

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

triton.language.broadcast_to(input, *shape)

嘗試將給定的張量廣播到新的 shape

參數

  • input (Block) - 輸入張量。
  • shape - 所需的形狀。

shape 可以以 1 個元組或獨立參數被傳入:

# These are equivalent 
# 這些是等效的
broadcast_to(x, (32, 32))
broadcast_to(x, 32, 32)

該函數也可作為 tensor 的 1 個成員函數調用,使用 x.broadcast_to(...) 而不是 broadcast_to(x, ...)

user avatar huandanshendeshoushudao 头像 aitinggedejinzhengu 头像 u_16640205 头像 yejianfeixue 头像 haoqidedalianmao 头像 huidadebianpao 头像 huaiyue_63f0b9e085bf0 头像 swiftcommunity 头像 hunter_58d48c41761b8 头像 alluxio_com 头像 laoshidejiandao 头像 chenzhuodeyagao 头像
点赞 16 用户, 点赞了这篇动态!
点赞

Add a new 评论

Some HTML is okay.