class_docstr: ## Linear projections for shortcut connection
  
  This does the $W_s x$ projection described above.
class_docstr_tok: ["#","#","Linear","projections","for","shortcut","connection","This","does","the","$","W_s","x","$","projection","described","above","."]
docstr: * `in_channels` is the number of channels in $x$
  * `out_channels` is the number of channels in $\mathcal{F}(x, \{W_i\})$
  * `stride` is the stride length in the convolution operation for $F$.
  We do the same stride on the shortcut connection, to match the feature-map size.
docstr_tok: ["*","`","in_channels","`","is","the","number","of","channels","in","$","x","$","*","`","out_channels","`","is","the","number","of","channels","in","$","\\mathcal","{","F","}","(","x",",","\\","{","W_i\\","}",")","$","*","`","stride","`","is","the","stride","length","in","the","convolution","operation","for","$","F","$",".","We","do","the","same","stride","on","the","shortcut","connection",",","to","match","the","feature-map","size","."]
code: def __init__(self, in_channels: int, out_channels: int, stride: int):
      """
      * `in_channels` is the number of channels in $x$
      * `out_channels` is the number of channels in $\mathcal{F}(x, \{W_i\})$
      * `stride` is the stride length in the convolution operation for $F$.
      We do the same stride on the shortcut connection, to match the feature-map size.
      """
      super().__init__()
  
      # Convolution layer for linear projection $W_s x$
      self.conv = nn.Conv2d(
          in_channels, out_channels, kernel_size=1, stride=stride
      )
      # Paper suggests adding batch normalization after each convolution operation
      self.bn = nn.BatchNorm2d(out_channels)
  
file_path: annotated_deep_learning_paper_implementations/labml_nn/resnet/__init__.py
imports: from typing import List, Optional
  import torch
  from torch import nn
  from labml_helpers.module import Module
label_desc: Use image node_id 1 to create a new ShortcutProjection object from inherited base classes: Module with example: obj = ShortcutProjection(in_channels, out_channels, stride)