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

Method __init__

cdslib/core/nn/modules/subspace.py:206–282  ·  view source on GitHub ↗

r""" Args: in_features (int): input feature dimension out_features (int): output feature dimension style_features (int): style feature dimension, i.e., dimension of `s`. bias (bool):

(
        self,
        in_features: int,
        out_features: int,
        style_features: int,
        bias: bool = True,
        fixed_bias: float = None,
        input_bias: bool = True,
        fixed_input_bias: float = None,
        bias_init_val: float = 0.0,
        input_bias_init_val: float = 0.0,
        lr_multiplier: float = 1.0,
        demodulate: bool = False,
        normalize_basis: bool = True,
        orthogonalize_basis: bool = False,
    )

Source from the content-addressed store, hash-verified

204 """
205
206 def __init__(
207 self,
208 in_features: int,
209 out_features: int,
210 style_features: int,
211 bias: bool = True,
212 fixed_bias: float = None,
213 input_bias: bool = True,
214 fixed_input_bias: float = None,
215 bias_init_val: float = 0.0,
216 input_bias_init_val: float = 0.0,
217 lr_multiplier: float = 1.0,
218 demodulate: bool = False,
219 normalize_basis: bool = True,
220 orthogonalize_basis: bool = False,
221 ):
222 r"""
223 Args:
224 in_features (int):
225 input feature dimension
226 out_features (int):
227 output feature dimension
228 style_features (int):
229 style feature dimension, i.e., dimension of `s`.
230 bias (bool):
231 whether to learn bias :math:`b`
232 fixed_bias (float):
233 a fixed bias b0 added after Wx + b + b0.
234 input_bias (bool):
235 whether to learn x0
236 fixed_input_bias (float):
237 a fixed bias x1 added after x0
238 lr_multiplier (float):
239 a factor controls the learning rate of the layer.
240 demodulate (bool):
241 whether to normalize the row of W.
242 normalize_basis (bool):
243 whether to normalize the basis to have unit l2 norm
244 orthogonalize_basis (bool):
245 whether to orthogonalize the basis
246 """
247 super().__init__()
248
249 self.eps = 1e-8
250 self.in_features = in_features
251 self.out_features = out_features
252 self.style_features = style_features
253 self.fixed_bias = fixed_bias
254 self.input_bias = input_bias
255 self.fixed_input_bias = fixed_input_bias
256 self.demodulate = demodulate
257 self.lr_multiplier = lr_multiplier
258 self.normalize_basis = normalize_basis
259 self.orthogonalize_basis = orthogonalize_basis
260
261 # W
262 self.linear = ShiftedLinearLayer(
263 in_features=in_features,

Callers

nothing calls this directly

Calls 3

ShiftedLinearLayerClass · 0.85
SubspaceClass · 0.85
__init__Method · 0.45

Tested by

no test coverage detected