MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / to

Method to

deepspeed/linear/quantization.py:118–129  ·  view source on GitHub ↗

Move the parameter to the given device. Then, if the device is a cuda device, quantize it.

(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

116 return self.to(device, non_blocking=non_blocking)
117
118 def to(self, *args, **kwargs):
119 """
120 Move the parameter to the given device. Then, if the device is a cuda device,
121 quantize it.
122 """
123 tensor = super().to(*args, **kwargs)
124 if not isinstance(tensor, type(self)):
125 tensor = torch.Tensor._make_subclass(type(self), tensor, self.requires_grad)
126 tensor.__dict__.update(self.__dict__)
127 self.quantizer.to(*args, **kwargs)
128 tensor._ensure_quantized(tensor)
129 return tensor
130
131
132class QuantizedLinear(nn.Linear):

Callers 5

offloadMethod · 0.95
cudaMethod · 0.95

Calls 2

_ensure_quantizedMethod · 0.80
updateMethod · 0.45