MCPcopy Create free account
hub / github.com/THUDM/GLM / forward

Method forward

mpu/layers.py:306–320  ·  view source on GitHub ↗
(self, input_)

Source from the content-addressed store, hash-verified

304 stride=stride, return_master_weight=keep_master_weight_for_test)
305
306 def forward(self, input_):
307 # Set up backprop all-reduce.
308 if self.input_is_parallel:
309 input_parallel = input_
310 else:
311 input_parallel = scatter_to_model_parallel_region(input_)
312 # Matrix multiply.
313 output_parallel = F.linear(input_parallel, self.weight)
314 # All-reduce across all the partitions.
315 output_ = reduce_from_model_parallel_region(output_parallel)
316 if self.bias is not None:
317 output = output_ + self.bias
318 else:
319 output = output_
320 return output
321

Callers

nothing calls this directly

Tested by

no test coverage detected