跳转至

Dropout Operators

本页暂无中文版。以下为英文原文。

Every op on this page is used the same way: construct it once, then call it. The constructor takes what the kernel is compiled with; the call takes the tensors. Both are documented under each op — __init__ and forward, where forward is what runs when you call op(...).

Dropout

tileops.ops.dropout.DropoutFwdOp

Dropout operation with deterministic replay via TileLang RNG.

Compatible with PyTorch dropout semantics: - Training mode: output = x * mask / (1 - p), mask ~ Bernoulli(1 - p) - Eval mode (training=False): output = x (identity) - p=0: identity - p=1: all zeros

Same seed produces identical masks for deterministic replay. Uses T.rng_init / T.rng_rand_float (backed by cuRAND Philox4_32_10 by default) for per-thread random number generation.

__init__

__init__(
    p=0.5,
    seed=0,
    training=True,
    tune=False,
)

Build the op. Shapes and dtype are taken from the first call.

Parameters:

  • p (float, default: 0.5 ) –

    Drop probability in [0, 1].

  • seed (int, default: 0 ) –

    Integer seed for RNG.

  • training (bool, default: True ) –

    If False, dropout is disabled (identity pass-through).

  • tune (bool, default: False ) –

    Whether to autotune.

forward

forward(
    input,
)

Run the op on the inputs the manifest declares.

Parameters:

  • input (Tensor) –

    Input tensor, dtype float16 | bfloat16 | float32.

Returns:

  • Tensor –

    output, as the manifest declares.