MCPcopy Create free account
hub / github.com/Alpha-VLLM/LLaMA2-Accessory / forward_ColumnParallelLinear

Function forward_ColumnParallelLinear

accessory/util/quant.py:18–30  ·  view source on GitHub ↗
(self, input_: torch.Tensor)

Source from the content-addressed store, hash-verified

16)
17
18def forward_ColumnParallelLinear(self, input_: torch.Tensor) -> torch.Tensor: # type: ignore
19 # Set up backprop all-reduce.
20 input_parallel = copy_to_model_parallel_region(input_)
21 # Matrix multiply.
22 output_parallel = self.quanted_layer(input_parallel)
23 if self.bias is not None:
24 output_parallel = output_parallel + self.bias
25 if self.gather_output:
26 # All-gather across the partitions.
27 output = gather_from_model_parallel_region(output_parallel)
28 else:
29 output = output_parallel
30 return output
31
32def forward_RowParallelLinear(self, input_: torch.Tensor) -> torch.Tensor: # type:ignore
33 # Set up backprop all-reduce.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected