Skip to content

Instantly share code, notes, and snippets.

View quocdat32461997's full-sized avatar
🎯
Focusing

Dat Ngo quocdat32461997

🎯
Focusing
View GitHub Profile
@quocdat32461997
quocdat32461997 / masked_batch_norm.py
Created February 28, 2022 14:50 — forked from yangkky/masked_batch_norm.py
Masked 1D batchnorm in PyTorch.
import torch
import torch.nn as nn
from torch.nn import init
class MaskedBatchNorm1d(nn.Module):
""" A masked version of nn.BatchNorm1d. Only tested for 3D inputs.
Args:
num_features: :math:`C` from an expected input of size