Safemotion Lib
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
resnet2d.BasicBlock Class Reference
Inheritance diagram for resnet2d.BasicBlock:

Public Member Functions

None __init__ (self, int inplanes, int planes, int stride=1, downsample=None)
 
torch.Tensor forward (self, torch.Tensor x)
 

Public Attributes

 conv1
 
 bn1
 
 relu
 
 conv2
 
 bn2
 
 downsample
 
 stride
 

Detailed Description

Definition at line 5 of file resnet2d.py.

Constructor & Destructor Documentation

◆ __init__()

None resnet2d.BasicBlock.__init__ ( self,
int inplanes,
int planes,
int stride = 1,
downsample = None )

Definition at line 6 of file resnet2d.py.

12 ) -> None:
13 super(BasicBlock, self).__init__()
14
15 self.conv1 = nn.Conv2d(inplanes, planes, kernel_size=(3, 1), stride=stride, padding=(1, 0), bias=False)
16 self.bn1 = nn.BatchNorm2d(planes)
17 self.relu = nn.ReLU(inplace=True)
18 self.conv2 = nn.Conv2d(inplanes, planes, kernel_size=(3, 1), stride=1, padding=(1, 0), bias=False)
19 self.bn2 = nn.BatchNorm2d(planes)
20 self.downsample = downsample
21 self.stride = stride
22

Member Function Documentation

◆ forward()

torch.Tensor resnet2d.BasicBlock.forward ( self,
torch.Tensor x )

Definition at line 23 of file resnet2d.py.

23 def forward(self, x: torch.Tensor) -> torch.Tensor:
24
25 identity = x
26
27 if self.downsample is not None:
28 identity = self.downsample(x)
29
30 out = self.conv1(x)
31 out = self.bn1(out)
32 out = self.relu(out)
33
34 out = self.conv2(out)
35 out = self.bn2(out)
36
37 out += identity
38 out = self.relu(out)
39
40 return out
41

Member Data Documentation

◆ bn1

resnet2d.BasicBlock.bn1

Definition at line 16 of file resnet2d.py.

◆ bn2

resnet2d.BasicBlock.bn2

Definition at line 19 of file resnet2d.py.

◆ conv1

resnet2d.BasicBlock.conv1

Definition at line 15 of file resnet2d.py.

◆ conv2

resnet2d.BasicBlock.conv2

Definition at line 18 of file resnet2d.py.

◆ downsample

resnet2d.BasicBlock.downsample

Definition at line 20 of file resnet2d.py.

◆ relu

resnet2d.BasicBlock.relu

Definition at line 17 of file resnet2d.py.

◆ stride

resnet2d.BasicBlock.stride

Definition at line 21 of file resnet2d.py.


The documentation for this class was generated from the following file: