MCPcopy Create free account
hub / github.com/pytorch/executorch / embedding_byte

Function embedding_byte

exir/passes/_quant_patterns_and_replacements.py:132–154  ·  view source on GitHub ↗
(
    weight: torch.Tensor,
    weight_scales: torch.Tensor,
    weight_zero_points: Optional[torch.Tensor],
    weight_quant_min: int,
    weight_quant_max: int,
    indices: torch.Tensor,
)

Source from the content-addressed store, hash-verified

130
131@impl(quantized_decomposed_lib, "embedding_byte", "CompositeExplicitAutograd")
132def embedding_byte(
133 weight: torch.Tensor,
134 weight_scales: torch.Tensor,
135 weight_zero_points: Optional[torch.Tensor],
136 weight_quant_min: int,
137 weight_quant_max: int,
138 indices: torch.Tensor,
139) -> torch.Tensor:
140 embedding_weight_checks(weight, weight_scales, weight_zero_points)
141 group_size = weight.size(1) // (
142 weight_scales.size(1) if weight_scales.dim() == 2 else 1
143 )
144 weight = torch.ops.quantized_decomposed.dequantize_per_channel_group.default(
145 weight,
146 weight_scales,
147 weight_zero_points,
148 weight_quant_min,
149 weight_quant_max,
150 weight.dtype,
151 group_size,
152 weight_scales.dtype,
153 )
154 return torch.ops.aten.embedding.default(weight, indices)
155
156
157@register_fake("quantized_decomposed::embedding_byte.out")

Callers 1

embedding_byte_out_metaFunction · 0.85

Calls 2

embedding_weight_checksFunction · 0.85
defaultMethod · 0.45

Tested by

no test coverage detected