MCPcopy
hub / github.com/hpcaitech/ColossalAI / append

Method append

colossalai/legacy/nn/parallel/reducer.py:46–55  ·  view source on GitHub ↗
(self, tensor: Tensor, callback_fn: Callable)

Source from the content-addressed store, hash-verified

44 self.buffer.storage().resize_(0)
45
46 def append(self, tensor: Tensor, callback_fn: Callable):
47 tensor_size = tensor.numel()
48 offset = self.offset
49 self.buffer[offset : offset + tensor_size].copy_(tensor.flatten())
50 self.offset += tensor_size
51
52 # callback will be given the reduced result
53 if callback_fn is not None:
54 result_view = self.buffer[offset : offset + tensor_size].view(tensor.shape)
55 self.callbacks.append(functools.partial(callback_fn, result_view))
56
57 @property
58 def avail_size(self) -> int:

Callers 15

setup.pyFile · 0.45
solution_annotation_passFunction · 0.45
_process_node_argumentsFunction · 0.45
__repr__Method · 0.45
list_operationsMethod · 0.45
_linearize_graphMethod · 0.45
run_chen_greedyMethod · 0.45
_construct_chainMethod · 0.45
_extract_inputMethod · 0.45

Calls 1

flattenMethod · 0.45

Tested by 15

run_fwd_bwd_iter_inputFunction · 0.36
examine_ppFunction · 0.36
run_ppFunction · 0.36
test_flash_attn_funcFunction · 0.36
check_forward_backwardFunction · 0.36
check_forward_backwardFunction · 0.36
check_forward_backwardFunction · 0.36
run_no_pipelineFunction · 0.36