MCPcopy Create free account
hub / github.com/apple/ml-pointersect / forward

Method forward

cdslib/core/nn/modules/linear.py:85–102  ·  view source on GitHub ↗

r""" Args: input: :math:`(*, C_{in})`, input tensor. Returns: :math:`(*, C_{out})`, output tensor.

(self, input: torch.Tensor)

Source from the content-addressed store, hash-verified

83 self.fixed_bias = fixed_bias
84
85 def forward(self, input: torch.Tensor) -> torch.Tensor:
86 r"""
87 Args:
88 input:
89 :math:`(*, C_{in})`, input tensor.
90
91 Returns:
92 :math:`(*, C_{out})`, output tensor.
93 """
94 if self.bias is not None:
95 out = F.linear(input, self.weight * self.lr_multiplier, self.bias * self.lr_multiplier)
96 else:
97 out = F.linear(input, self.weight * self.lr_multiplier)
98
99 if self.fixed_bias is not None:
100 out = out + self.fixed_bias
101
102 return out
103
104
105class StackedLinearLayers(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected