IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Python class

SumsOverDevices

SumsOverDevices​

class max.nn.common_layers.moe_exchange.SumsOverDevices(*args, **kwargs)

source

Bases: Protocol

A feed-forward block whose devices may each hold a partial result.

A block that doesn’t implement this runs per row: it takes whichever rows a device holds and returns their complete outputs.

complete_rows()​

complete_rows(y)

source

Completes a forward result that the devices hold in parts.

Parameters:

y (Tensor) – What forward returned for rows replicated on the mesh.

Returns:

The complete output rows, replicated on the mesh.

Return type:

Tensor

needs_every_row​

property needs_every_row: bool

source

Whether every device must hold every row of the input.