MCPcopy Create free account
hub / github.com/AIS-SNU/Smart-Infinity / forward

Method forward

DeepSpeedExample/megatron/mpu/layers.py:353–369  ·  view source on GitHub ↗
(self, input_)

Source from the content-addressed store, hash-verified

351
352
353 def forward(self, input_):
354 # Set up backprop all-reduce.
355 if self.input_is_parallel:
356 input_parallel = input_
357 else:
358 input_parallel = scatter_to_model_parallel_region(input_)
359 # Matrix multiply.
360 output_parallel = F.linear(input_parallel, self.weight)
361 # All-reduce across all the partitions.
362 output_ = reduce_from_model_parallel_region(output_parallel)
363 if not self.skip_bias_add:
364 output = output_ + self.bias if self.bias is not None else output_
365 output_bias = None
366 else:
367 output = output_
368 output_bias = self.bias
369 return output, output_bias

Callers

nothing calls this directly

Tested by

no test coverage detected