MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / forward

Method forward

deepspeed/runtime/zero/linear.py:96–107  ·  view source on GitHub ↗
(input, weight, bias=None)

Source from the content-addressed store, hash-verified

94 @staticmethod
95 # bias is an optional argument
96 def forward(input, weight, bias=None):
97
98 if input.dim() == 2 and bias is not None:
99 # fused op is marginally faster
100 ret = torch.addmm(bias, input, weight.t())
101 else:
102 output = input.matmul(weight.t())
103 if bias is not None:
104 output += bias
105 ret = output
106
107 return ret
108
109 @staticmethod
110 def setup_context(ctx, inputs, output):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected