Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Facebookresearch Audiocraft NormConv

From Leeroopedia
Knowledge Sources
Domains Neural_Networks, Audio_Processing
Last Updated 2026-02-14 01:00 GMT

Overview

Concrete tool for normalized and streaming-aware convolution wrappers with weight normalization, spectral normalization, and causal padding support.

Description

This module provides NormConv1d, NormConv2d, NormConvTranspose1d, and NormConvTranspose2d wrappers that add configurable normalization (none, weight_norm, spectral_norm, time_group_norm) and causal padding to standard PyTorch convolutions. The pad1d and unpad1d helpers handle asymmetric padding for causal convolutions. These are the building blocks for SEANet encoder/decoder architectures.

Usage

Import these wrappers when building convolutional audio processing modules that need normalization and causal padding support.

Code Reference

Source Location

Signature

class NormConv1d(nn.Module):
    def __init__(self, *args, causal: bool = False, norm: str = 'none',
                 norm_kwargs: tp.Dict = {}, **kwargs): ...

class NormConvTranspose1d(nn.Module):
    def __init__(self, *args, causal: bool = False, norm: str = 'none',
                 norm_kwargs: tp.Dict = {}, **kwargs): ...

def pad1d(x: torch.Tensor, paddings: tp.Tuple[int, int],
          mode: str = 'zero', value: float = 0.) -> torch.Tensor: ...
def unpad1d(x: torch.Tensor, paddings: tp.Tuple[int, int]) -> torch.Tensor: ...

Import

from audiocraft.modules.conv import NormConv1d, NormConvTranspose1d, pad1d, unpad1d

I/O Contract

Inputs

Name Type Required Description
x torch.Tensor Yes Input tensor (1D or 2D depending on conv type)
causal bool No Enable causal (left) padding
norm str No Normalization type: 'none', 'weight_norm', 'spectral_norm', 'time_group_norm'

Outputs

Name Type Description
output torch.Tensor Convolved and normalized output

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment