AI术语词典

A comprehensive multilingual AI terminology dictionary

Definition

残差连接(也称为跳跃连接)通过将输入直接添加到后续层的输出来允许梯度在网络中流动。这种架构解决了深层网络中的梯度消失问题。

Summary

一种将输入直接加到层输出上的机制,以促进深层网络中的梯度流动。

Key Concepts

Use Cases

Code Example

1
2
3
4
5
6
7
import torch.nn as nn
class ResidualBlock(nn.Module):
    def __init__(self, channels):
        super().__init__()
        self.conv = nn.Conv2d(channels, channels, 3, padding=1)
    def forward(self, x):
        return x + self.conv(x)