code stringlengths 3 6.57k |
|---|
process_group (ProcessGroup, optional) |
init_rrefs (bool, optional) |
sharding_spec (:class:`torch.distributed._shard.sharding_spec.ShardingSpec`) |
size (int...) |
dtype (:class:`torch.dtype`, optional) |
default (see :func:`torch.set_default_tensor_type`) |
layout (:class:`torch.layout`, optional) |
requires_grad (bool, optional) |
pin_memory (bool, optional) |
process_group (ProcessGroup, optional) |
init_rrefs (bool, optional) |
sharding_spec (:class:`torch.distributed._shard.sharding_spec.ShardingSpec`) |
size (int...) |
dtype (:class:`torch.dtype`, optional) |
default (see :func:`torch.set_default_tensor_type`) |
layout (:class:`torch.layout`, optional) |
requires_grad (bool, optional) |
pin_memory (bool, optional) |
process_group (ProcessGroup, optional) |
init_rrefs (bool, optional) |
sharding_spec (:class:`torch.distributed._sharding_spec.ShardingSpec`) |
size (int...) |
fill_value (Scalar) |
dtype (:class:`torch.dtype`, optional) |
default (see :func:`torch.set_default_tensor_type`) |
layout (:class:`torch.layout`, optional) |
requires_grad (bool, optional) |
pin_memory (bool, optional) |
process_group (ProcessGroup, optional) |
init_rrefs (bool, optional) |
torch.nn.init.constant_(sharded_tensor, fill_value) |
sharding_spec (:class:`torch.distributed._shard.sharding_spec.ShardingSpec`) |
size (int...) |
fill_value (Scalar) |
dtype (:class:`torch.dtype`, optional) |
default (see :func:`torch.set_default_tensor_type`) |
layout (:class:`torch.layout`, optional) |
requires_grad (bool, optional) |
pin_memory (bool, optional) |
process_group (ProcessGroup, optional) |
init_rrefs (bool, optional) |
torch.nn.init.uniform_(sharded_tensor, 0, 1) |
local_shards (List[:class `torch.distributed._shard.sharded_tensor.Shard`]) |
global_size (int...) |
process_group (ProcessGroup, optional) |
init_rrefs (bool, optional) |
a (5, 5) |
Shard(torch.randn(5, 5) |
init_from_local_shards(local_shards, [10, 5]) |
Shard(torch.randn(5, 5) |
init_from_local_shards(local_shards, [10, 5]) |
state_dict_hook(module, destination, prefix, local_metadata) |
module.named_modules() |
submodule.__dict__.items() |
isinstance(attr, ShardedTensor) |
pre_load_state_dict_hook(module, state_dict, prefix, local_metadata, strict, missing_keys, unexpected_keys, error_msgs) |
module.named_modules() |
submodule.__dict__.items() |
isinstance(state_dict[key], ShardedTensor) |
setattr(submodule, attr_name, state_dict[key]) |
sharded_op_impl(func) |
sharded_op_impl(torch.nn.functional.linear) |
my_custom_sharded_linear(types, args, kwargs, process_group) |
torch.rand(10, 32) |
sharded_tensor.rand(32, 16) |
torch.rand(16) |
torch.nn.functional.linear(input, weight, bias) |
API
(https://pytorch.org/docs/stable/notes/extending.html#extending-torch) |
func(Callable) |
implementation (ex: torch.nn.functional.linear) |
decorator_sharded_func(wrapped_func) |
_register_sharded_op(func, wrapped_func) |
functools.wraps(wrapped_func) |
wrapper(*args, **kwargs) |
wrapped_func(*args, **kwargs) |
module (:class:`torch.nn.Module`) |
resharding_spec (:class:`torch.distributed._shard.sharding_spec.ShardingSpec`) |
hook_func(_module, _input, output) |
isinstance(output, ShardedTensor) |
isinstance(output, _PartialTensor) |
output.reshard(resharding_spec) |
module.register_forward_hook(hook_func) |
_collect_local_shard(module: torch.nn.Module) |
module (:class:`torch.nn.Module`) |
hook_func(_module, _input, output) |
isinstance(output, ShardedTensor) |
output.local_tensor() |
local_tensor.size(output._sharding_spec.dim) |
module.register_forward_hook(hook_func) |
Copyright (c) |
logging.getLogger(__name__) |
object() |
CountingIterator(object) |
iterable (iterable) |
start (int) |
total (int) |
n (int) |
__init__(self, iterable, start=None, total=None) |
iter(self) |
getattr(iterable, 'n', 0) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.