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

Method __init__

verl/utils/memory_buffer.py:32–39  ·  view source on GitHub ↗
(self, numel: int, numel_padded: int, dtype: torch.dtype, source: Optional[torch.Tensor] = None)

Source from the content-addressed store, hash-verified

30 """
31
32 def __init__(self, numel: int, numel_padded: int, dtype: torch.dtype, source: Optional[torch.Tensor] = None):
33 self.numel = numel
34 self.numel_padded = numel_padded
35 self.dtype = dtype
36 if source is not None:
37 self.data = source
38 else:
39 self.data = torch.zeros(self.numel_padded, dtype=self.dtype, device=get_device_name(), requires_grad=False)
40
41 def zero(self):
42 """Reset the buffer to zero."""

Callers 1

__init__Method · 0.45

Calls 1

get_device_nameFunction · 0.90

Tested by

no test coverage detected