MaxxVit! A very configurable MaxVit and CoAtNet impl with lots of goodies..

pull/1415/head
Ross Wightman 2 years ago
parent 8c9696c9df
commit ffaf97f813

@ -25,6 +25,7 @@ from .inception_resnet_v2 import *
from .inception_v3 import *
from .inception_v4 import *
from .levit import *
from .maxxvit import *
from .mlp_mixer import *
from .mobilenetv3 import *
from .mobilevit import *

@ -21,7 +21,7 @@ from .fast_norm import is_fast_norm, set_fast_norm, fast_group_norm, fast_layer_
from .filter_response_norm import FilterResponseNormTlu2d, FilterResponseNormAct2d
from .gather_excite import GatherExcite
from .global_context import GlobalContext
from .helpers import to_ntuple, to_2tuple, to_3tuple, to_4tuple, make_divisible
from .helpers import to_ntuple, to_2tuple, to_3tuple, to_4tuple, make_divisible, extend_tuple
from .inplace_abn import InplaceAbn
from .linear import Linear
from .mixed_conv2d import MixedConv2d

@ -29,3 +29,15 @@ def make_divisible(v, divisor=8, min_value=None, round_limit=.9):
if new_v < round_limit * v:
new_v += divisor
return new_v
def extend_tuple(x, n):
# pdas a tuple to specified n by padding with last value
if not isinstance(x, (tuple, list)):
x = (x,)
else:
x = tuple(x)
pad_n = n - len(x)
if pad_n <= 0:
return x[:n]
return x + (x[-1],) * pad_n

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save