MCPcopy
hub / github.com/deepspeedai/DeepSpeed / __init__

Method __init__

tests/unit/modeling.py:121–143  ·  view source on GitHub ↗
(self, in_features, out_features, weights, biases, act='gelu', bias=True)

Source from the content-addressed store, hash-verified

119 __constants__ = ['bias']
120
121 def __init__(self, in_features, out_features, weights, biases, act='gelu', bias=True):
122 super(LinearActivation, self).__init__()
123 self.in_features = in_features
124 self.out_features = out_features
125 self.fused_gelu = False
126 self.fused_tanh = False
127 if isinstance(act, str):
128 if bias and act == 'gelu':
129 self.fused_gelu = True
130 elif bias and act == 'tanh':
131 self.fused_tanh = True
132 else:
133 self.act_fn = ACT2FN[act]
134 else:
135 self.act_fn = act
136 #self.weight = Parameter(torch.Tensor(out_features, in_features))
137 self.weight = weights[5]
138 self.bias = biases[5]
139 #if bias:
140 # self.bias = Parameter(torch.Tensor(out_features))
141 #else:
142 # self.register_parameter('bias', None)
143 #self.reset_parameters()
144
145 def reset_parameters(self):
146 init.kaiming_uniform_(self.weight, a=math.sqrt(5))

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected