MCPcopy
hub / github.com/PRIME-RL/PRIME / get

Method get

training/verl/utils/memory_buffer.py:40–48  ·  view source on GitHub ↗

Return a tensor with the input `shape` as a view into the 1-D data starting at `start_index`.

(self, shape, start_index)

Source from the content-addressed store, hash-verified

38 self.data.zero_()
39
40 def get(self, shape, start_index):
41 """Return a tensor with the input `shape` as a view into the
42 1-D data starting at `start_index`."""
43 end_index = start_index + shape.numel()
44 assert end_index <= self.numel, \
45 'requested tensor is out of the buffer range.'
46 buffer_tensor = self.data[start_index:end_index]
47 buffer_tensor = buffer_tensor.view(shape)
48 return buffer_tensor
49
50
51def calc_padded_numel(shape: torch.Size, dtype: torch.dtype):

Callers 15

get_fsdp_wrap_policyFunction · 0.45
build_memory_referenceFunction · 0.45
create_huggingface_actorFunction · 0.45
funcFunction · 0.45
get_placement_groupsMethod · 0.45
__call__Method · 0.45
_is_worker_aliveMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected