Skip to content

Commit

Permalink
check_version
Browse files Browse the repository at this point in the history
  • Loading branch information
kennymckormick committed Jul 1, 2021
1 parent 043c81d commit 2e445ba
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mmaction/models/common/transformer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from distutils.version import LooseVersion

import torch
import torch.nn as nn
from einops import rearrange
Expand Down Expand Up @@ -43,6 +45,9 @@ def __init__(self,
self.num_heads = num_heads
self.num_frames = num_frames
self.norm = build_norm_layer(norm_cfg, self.embed_dims)[1]

if LooseVersion(torch.__version__) < LooseVersion('1.9.0'):
kwargs.pop('batch_first', None)
self.attn = nn.MultiheadAttention(embed_dims, num_heads, attn_drop,
**kwargs)
self.proj_drop = nn.Dropout(proj_drop)
Expand Down Expand Up @@ -118,6 +123,8 @@ def __init__(self,
self.num_heads = num_heads
self.num_frames = num_frames
self.norm = build_norm_layer(norm_cfg, self.embed_dims)[1]
if LooseVersion(torch.__version__) < LooseVersion('1.9.0'):
kwargs.pop('batch_first', None)
self.attn = nn.MultiheadAttention(embed_dims, num_heads, attn_drop,
**kwargs)
self.proj_drop = nn.Dropout(proj_drop)
Expand Down

0 comments on commit 2e445ba

Please sign in to comment.