【Triton 教程】triton_language.zeros

36 阅读1分钟

Triton 是一种用于并行编程的语言和编译器。它旨在提供一个基于 Python 的编程环境,以高效编写自定义 DNN 计算内核,并能够在现代 GPU 硬件上以最大吞吐量运行。

更多 Triton 中文文档可访问 →triton.hyper.ai/

triton.language.zeros(shape, dtype

对于给定的shape 和 dtype,返回 1 个填充了标量值 0 的张量。

参数:

  • shape (tuple of ints) - 新数组的形状,例如 (8,16) 或 (8,)。
  • dtype (DType) - 新数组的数据类型,例如 tl.float16