megatron.core.utils#

Description

Utility functions used throughout Megatron core

Classes

GlobalMemoryBuffer()

Global buffer to avoid dynamic memory allocations.

MakeViewlessTensor(*args, **kwargs)

Autograd function to make a viewless tensor.

Functions

assert_viewless_tensor(tensor[, extra_msg])

Assert that a tensor is not a view (i.e., its '._base' field is not set).

divide(numerator, denominator)

Ensure that numerator is divisible by the denominator and return the division value.

ensure_divisibility(numerator, denominator)

Ensure that numerator is divisible by the denominator.

make_viewless_tensor(inp, requires_grad, ...)

Entry-point for creating viewless tensors.

safely_set_viewless_tensor_data(tensor, ...)

Safely set tensor's '.data' field.