bittensor.utils.registration.torch_utils#

Torch compatibility utilities for Bittensor.

Attributes#

Classes#

LazyLoadedTorch

A lazy-loading proxy for the torch module.

Functions#

legacy_torch_api_compat(func)

Convert function operating on numpy Input&Output to legacy torch Input&Output API if use_torch() is True.

log_no_torch_error()

use_torch()

Force the use of torch over numpy for certain operations.

Module Contents#

class bittensor.utils.registration.torch_utils.LazyLoadedTorch#

A lazy-loading proxy for the torch module.

bittensor.utils.registration.torch_utils.legacy_torch_api_compat(func)#

Convert function operating on numpy Input&Output to legacy torch Input&Output API if use_torch() is True.

Parameters:

func – Function with numpy Input/Output to be decorated.

Returns:

Decorated function.

Return type:

decorated

bittensor.utils.registration.torch_utils.log_no_torch_error()#
bittensor.utils.registration.torch_utils.torch#
bittensor.utils.registration.torch_utils.use_torch()#

Force the use of torch over numpy for certain operations.

Return type:

bool