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

Method __init__

cdslib/core/nn/modules/conv.py:300–578  ·  view source on GitHub ↗

Multiple Conv1D layers with normalization and nonlinearity. Args: num_layers (int): total number of layers of the network dim_input (int): input dimension dim_features (int or list of int): an integ

(
        self,
        num_layers: int,
        dim_input: int,
        dim_output: int,
        dim_features: T.Union[T.List[int], int],
        kernel_sizes: T.Union[T.List[int], int],
        strides: T.Union[T.List[int], int] = 1,
        paddings: T.Union[T.List[int], int] = 0,
        dilations: T.Union[T.List[int], int] = 1,
        groups: T.Union[T.List[int], int] = 1,
        padding_modes: T.Union[T.List[str], str] = "zeros",
        nonlinearity: str = "leaky_relu",
        add_norm_layer: bool = True,
        norm_fun=nn.LayerNorm,
        dropout_prob: float = 0.0,
        output_add_nonlinearity: bool = False,
    )

Source from the content-addressed store, hash-verified

298 """
299
300 def __init__(
301 self,
302 num_layers: int,
303 dim_input: int,
304 dim_output: int,
305 dim_features: T.Union[T.List[int], int],
306 kernel_sizes: T.Union[T.List[int], int],
307 strides: T.Union[T.List[int], int] = 1,
308 paddings: T.Union[T.List[int], int] = 0,
309 dilations: T.Union[T.List[int], int] = 1,
310 groups: T.Union[T.List[int], int] = 1,
311 padding_modes: T.Union[T.List[str], str] = "zeros",
312 nonlinearity: str = "leaky_relu",
313 add_norm_layer: bool = True,
314 norm_fun=nn.LayerNorm,
315 dropout_prob: float = 0.0,
316 output_add_nonlinearity: bool = False,
317 ):
318 """
319 Multiple Conv1D layers with normalization and nonlinearity.
320
321 Args:
322 num_layers (int):
323 total number of layers of the network
324 dim_input (int):
325 input dimension
326 dim_features (int or list of int):
327 an integer if all layers share the same dim_feature,
328 or list of length num_layer-1 (one for each layer except the last layer).
329 kernel_sizes (int or list of int):
330 an integer if all layers share the same kernel_size,
331 or list of length num_layer (one for each layer).
332 strides (int or list of int):
333 an integer if all layers share the same stride,
334 or list of length num_layer (one for each layer).
335 paddings (int or list of int):
336 an integer if all layers share the same padding,
337 or list of length num_layer (one for each layer).
338 dilations (int or list of int):
339 an integer if all layers share the same dilation,
340 or list of length num_layer (one for each layer).
341 groups (int or list of int):
342 an integer if all layers share the same group,
343 or list of length num_layer (one for each layer).
344 padding_modes (str or list of str):
345 a str if all layers share the same padding_mode,
346 or list of length num_layer (one for each layer)
347 nonlinearity (str):
348 nonlinearity used in-between layers:
349 ``'leaky_relu'``, ``'relu'``, ``'tanh'``, ``'sigmoid'``, ``'silu'`` (torch >= 1.7.0)
350 add_norm_layer (bool):
351 whether to add normalization layers in between linear layers.
352 norm_fun:
353 function of the normalization
354 (should be a function that takes only the dim_feature,
355 pass lambda function if want to change default parameters)
356 ex: :code:`lambda x: torch.nn.LayerNorm(x, eps=1e-5, elementwise_affine=False)`
357 dropout_prob (float):

Callers

nothing calls this directly

Calls 3

compute_min_seq_lenMethod · 0.95
Conv1DLayerClass · 0.85
__init__Method · 0.45

Tested by

no test coverage detected