MCPcopy Create free account
hub / github.com/DataArcTech/DataArc-SynData-Toolkit / get

Method get

verl/utils/memory_buffer.py:45–52  ·  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

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

Callers 15

__init__Method · 0.45
executeMethod · 0.45
executeMethod · 0.45
executeMethod · 0.45
__init__Method · 0.45
createMethod · 0.45
executeMethod · 0.45
executeMethod · 0.45
__init__Method · 0.45
executeMethod · 0.45
createMethod · 0.45
executeMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected