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

Method forward

DeepSpeedExample/megatron/core/transformer/mlp.py:66–82  ·  view source on GitHub ↗
(self, hidden_states)

Source from the content-addressed store, hash-verified

64 )
65
66 def forward(self, hidden_states):
67
68 # [s, b, 4 * h/p]
69 intermediate_parallel, bias_parallel = self.linear_fc1(hidden_states)
70
71 if self.config.bias_gelu_fusion:
72 assert self.config.add_bias_linear is True
73 assert self.activation_func == F.gelu
74 intermediate_parallel = bias_gelu_impl(intermediate_parallel, bias_parallel)
75 else:
76 if bias_parallel is not None:
77 intermediate_parallel = intermediate_parallel + bias_parallel
78 intermediate_parallel = self.activation_func(intermediate_parallel)
79
80 # [s, b, h]
81 output, output_bias = self.linear_fc2(intermediate_parallel)
82 return output, output_bias

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected