File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 3
3
from .conv import *
4
4
from .pooling import *
5
5
from .detection import *
6
+ from .layernorm import *
Original file line number Diff line number Diff line change
1
+ from torch import nn
2
+
3
+ from torchsparse .sparse_tensor import *
4
+
5
+ __all__ = ['LayerNorm' ]
6
+
7
+
8
+ class LayerNorm (nn .LayerNorm ):
9
+ def __init__ (self ,
10
+ normalized_shape ,
11
+ eps = 1e-05 ,
12
+ elementwise_affine = True ):
13
+ super ().__init__ (normalized_shape , eps = eps , elementwise_affine = elementwise_affine )
14
+
15
+ def forward (self , inputs ):
16
+ features = inputs .F
17
+ coords = inputs .C
18
+ cur_stride = inputs .s
19
+ output_features = super ().forward (features )
20
+ output_tensor = SparseTensor (output_features , coords , cur_stride )
21
+ output_tensor .coord_maps = inputs .coord_maps
22
+ output_tensor .kernel_maps = inputs .kernel_maps
23
+ return output_tensor
You can’t perform that action at this time.
0 commit comments