# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# +
#default_exp layers
# -

#hide
from IPython.display import clear_output
from nbdev.export import notebook2script
# %reload_ext autoreload
# %autoreload 2

# +
#export
import torch
from torch import nn
import logging

logger = logging.getLogger()
logger.setLevel("INFO")


# -

# # layers
#
# > 一般常見的 NN layers。

#export
class Identity(nn.Module):

    def __init__(self, *args, **kwargs):
        super().__init__()

    def forward(self, x):
        return x


# +
l = Identity()
x = torch.randn(64, 1, 3, 3)
out = l(x)

assert torch.all(torch.eq(x, out))
# -

#hide
notebook2script()
clear_output()

StarcoderdataJupyterScriptsDedupFiltered