Skip to content

Commit

Permalink
add docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
hukkai committed Oct 12, 2023
1 parent 5d935d4 commit 2f87a57
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions mmaction/models/action_segmentors/asformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ def predict(self, batch_inputs, batch_data_samples, **kwargs):
output = [dict(ground=ground, recognition=recognition)]
return output


def exponential_descrease(idx_decoder, p=3):
return math.exp(-p * idx_decoder)

Expand Down Expand Up @@ -571,7 +572,8 @@ def forward(self, x, fencoder, mask):


class MyTransformer(nn.Module):
"""An encoder-decoder transformer"""
"""An encoder-decoder transformer."""

def __init__(self, num_decoders, num_layers, r1, r2, num_f_maps, input_dim,
num_classes, channel_masking_rate):
super(MyTransformer, self).__init__()
Expand Down Expand Up @@ -601,7 +603,7 @@ def __init__(self, num_decoders, num_layers, r1, r2, num_f_maps, input_dim,

def forward(self, x, mask):
"""Define the computation performed at every call.
Args:
x (torch.Tensor): The input data.
Returns:
Expand All @@ -616,4 +618,4 @@ def forward(self, x, mask):
feature * mask[:, 0:1, :], mask)
outputs = torch.cat((outputs, out.unsqueeze(0)), dim=0)

return outputs
return outputs

0 comments on commit 2f87a57

Please sign in to comment.