code stringlengths 17 6.64M |
|---|
class MishJit(nn.Module):
def __init__(self, inplace: bool=False):
super(MishJit, self).__init__()
def forward(self, x):
return mish_jit(x)
|
@torch.jit.script
def hard_sigmoid_jit(x, inplace: bool=False):
return (x + 3).clamp(min=0, max=6).div(6.0)
|
class HardSigmoidJit(nn.Module):
def __init__(self, inplace: bool=False):
super(HardSigmoidJit, self).__init__()
def forward(self, x):
return hard_sigmoid_jit(x)
|
@torch.jit.script
def hard_swish_jit(x, inplace: bool=False):
return (x * (x + 3).clamp(min=0, max=6).div(6.0))
|
class HardSwishJit(nn.Module):
def __init__(self, inplace: bool=False):
super(HardSwishJit, self).__init__()
def forward(self, x):
return hard_swish_jit(x)
|
@torch.jit.script
def swish_jit_fwd(x):
return x.mul(torch.sigmoid(x))
|
@torch.jit.script
def swish_jit_bwd(x, grad_output):
x_sigmoid = torch.sigmoid(x)
return (grad_output * (x_sigmoid * (1 + (x * (1 - x_sigmoid)))))
|
class SwishJitAutoFn(torch.autograd.Function):
' torch.jit.script optimised Swish w/ memory-efficient checkpoint\n Inspired by conversation btw Jeremy Howard & Adam Pazske\n https://twitter.com/jeremyphoward/status/1188251041835315200\n\n Swish - Described originally as SiLU (https://arxiv.org/abs/1702.0... |
def swish_me(x, inplace=False):
return SwishJitAutoFn.apply(x)
|
class SwishMe(nn.Module):
def __init__(self, inplace: bool=False):
super(SwishMe, self).__init__()
def forward(self, x):
return SwishJitAutoFn.apply(x)
|
@torch.jit.script
def mish_jit_fwd(x):
return x.mul(torch.tanh(F.softplus(x)))
|
@torch.jit.script
def mish_jit_bwd(x, grad_output):
x_sigmoid = torch.sigmoid(x)
x_tanh_sp = F.softplus(x).tanh()
return grad_output.mul((x_tanh_sp + ((x * x_sigmoid) * (1 - (x_tanh_sp * x_tanh_sp)))))
|
class MishJitAutoFn(torch.autograd.Function):
' Mish: A Self Regularized Non-Monotonic Neural Activation Function - https://arxiv.org/abs/1908.08681\n A memory efficient, jit scripted variant of Mish\n '
@staticmethod
def forward(ctx, x):
ctx.save_for_backward(x)
return mish_jit_fwd... |
def mish_me(x, inplace=False):
return MishJitAutoFn.apply(x)
|
class MishMe(nn.Module):
def __init__(self, inplace: bool=False):
super(MishMe, self).__init__()
def forward(self, x):
return MishJitAutoFn.apply(x)
|
@torch.jit.script
def hard_sigmoid_jit_fwd(x, inplace: bool=False):
return (x + 3).clamp(min=0, max=6).div(6.0)
|
@torch.jit.script
def hard_sigmoid_jit_bwd(x, grad_output):
m = ((torch.ones_like(x) * ((x >= (- 3.0)) & (x <= 3.0))) / 6.0)
return (grad_output * m)
|
class HardSigmoidJitAutoFn(torch.autograd.Function):
@staticmethod
def forward(ctx, x):
ctx.save_for_backward(x)
return hard_sigmoid_jit_fwd(x)
@staticmethod
def backward(ctx, grad_output):
x = ctx.saved_tensors[0]
return hard_sigmoid_jit_bwd(x, grad_output)
|
def hard_sigmoid_me(x, inplace: bool=False):
return HardSigmoidJitAutoFn.apply(x)
|
class HardSigmoidMe(nn.Module):
def __init__(self, inplace: bool=False):
super(HardSigmoidMe, self).__init__()
def forward(self, x):
return HardSigmoidJitAutoFn.apply(x)
|
@torch.jit.script
def hard_swish_jit_fwd(x):
return (x * (x + 3).clamp(min=0, max=6).div(6.0))
|
@torch.jit.script
def hard_swish_jit_bwd(x, grad_output):
m = (torch.ones_like(x) * (x >= 3.0))
m = torch.where(((x >= (- 3.0)) & (x <= 3.0)), ((x / 3.0) + 0.5), m)
return (grad_output * m)
|
class HardSwishJitAutoFn(torch.autograd.Function):
'A memory efficient, jit-scripted HardSwish activation'
@staticmethod
def forward(ctx, x):
ctx.save_for_backward(x)
return hard_swish_jit_fwd(x)
@staticmethod
def backward(ctx, grad_output):
x = ctx.saved_tensors[0]
... |
def hard_swish_me(x, inplace=False):
return HardSwishJitAutoFn.apply(x)
|
class HardSwishMe(nn.Module):
def __init__(self, inplace: bool=False):
super(HardSwishMe, self).__init__()
def forward(self, x):
return HardSwishJitAutoFn.apply(x)
|
def is_no_jit():
return _NO_JIT
|
class set_no_jit():
def __init__(self, mode: bool) -> None:
global _NO_JIT
self.prev = _NO_JIT
_NO_JIT = mode
def __enter__(self) -> None:
pass
def __exit__(self, *args: Any) -> bool:
global _NO_JIT
_NO_JIT = self.prev
return False
|
def is_exportable():
return _EXPORTABLE
|
class set_exportable():
def __init__(self, mode: bool) -> None:
global _EXPORTABLE
self.prev = _EXPORTABLE
_EXPORTABLE = mode
def __enter__(self) -> None:
pass
def __exit__(self, *args: Any) -> bool:
global _EXPORTABLE
_EXPORTABLE = self.prev
retu... |
def is_scriptable():
return _SCRIPTABLE
|
class set_scriptable():
def __init__(self, mode: bool) -> None:
global _SCRIPTABLE
self.prev = _SCRIPTABLE
_SCRIPTABLE = mode
def __enter__(self) -> None:
pass
def __exit__(self, *args: Any) -> bool:
global _SCRIPTABLE
_SCRIPTABLE = self.prev
retu... |
class set_layer_config():
' Layer config context manager that allows setting all layer config flags at once.\n If a flag arg is None, it will not change the current value.\n '
def __init__(self, scriptable: Optional[bool]=None, exportable: Optional[bool]=None, no_jit: Optional[bool]=None, no_activation... |
def layer_config_kwargs(kwargs):
' Consume config kwargs and return contextmgr obj '
return set_layer_config(scriptable=kwargs.pop('scriptable', None), exportable=kwargs.pop('exportable', None), no_jit=kwargs.pop('no_jit', None))
|
def _ntuple(n):
def parse(x):
if isinstance(x, collections.abc.Iterable):
return x
return tuple(repeat(x, n))
return parse
|
def _is_static_pad(kernel_size, stride=1, dilation=1, **_):
return ((stride == 1) and (((dilation * (kernel_size - 1)) % 2) == 0))
|
def _get_padding(kernel_size, stride=1, dilation=1, **_):
padding = (((stride - 1) + (dilation * (kernel_size - 1))) // 2)
return padding
|
def _calc_same_pad(i: int, k: int, s: int, d: int):
return max(((((((- (i // (- s))) - 1) * s) + ((k - 1) * d)) + 1) - i), 0)
|
def _same_pad_arg(input_size, kernel_size, stride, dilation):
(ih, iw) = input_size
(kh, kw) = kernel_size
pad_h = _calc_same_pad(ih, kh, stride[0], dilation[0])
pad_w = _calc_same_pad(iw, kw, stride[1], dilation[1])
return [(pad_w // 2), (pad_w - (pad_w // 2)), (pad_h // 2), (pad_h - (pad_h // 2)... |
def _split_channels(num_chan, num_groups):
split = [(num_chan // num_groups) for _ in range(num_groups)]
split[0] += (num_chan - sum(split))
return split
|
def conv2d_same(x, weight: torch.Tensor, bias: Optional[torch.Tensor]=None, stride: Tuple[(int, int)]=(1, 1), padding: Tuple[(int, int)]=(0, 0), dilation: Tuple[(int, int)]=(1, 1), groups: int=1):
(ih, iw) = x.size()[(- 2):]
(kh, kw) = weight.size()[(- 2):]
pad_h = _calc_same_pad(ih, kh, stride[0], dilati... |
class Conv2dSame(nn.Conv2d):
" Tensorflow like 'SAME' convolution wrapper for 2D convolutions\n "
def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True):
super(Conv2dSame, self).__init__(in_channels, out_channels, kernel_size, stride, 0, di... |
class Conv2dSameExport(nn.Conv2d):
" ONNX export friendly Tensorflow like 'SAME' convolution wrapper for 2D convolutions\n\n NOTE: This does not currently work with torch.jit.script\n "
def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True):
... |
def get_padding_value(padding, kernel_size, **kwargs):
dynamic = False
if isinstance(padding, str):
padding = padding.lower()
if (padding == 'same'):
if _is_static_pad(kernel_size, **kwargs):
padding = _get_padding(kernel_size, **kwargs)
else:
... |
def create_conv2d_pad(in_chs, out_chs, kernel_size, **kwargs):
padding = kwargs.pop('padding', '')
kwargs.setdefault('bias', False)
(padding, is_dynamic) = get_padding_value(padding, kernel_size, **kwargs)
if is_dynamic:
if is_exportable():
assert (not is_scriptable())
... |
class MixedConv2d(nn.ModuleDict):
' Mixed Grouped Convolution\n Based on MDConv and GroupedConv in MixNet impl:\n https://github.com/tensorflow/tpu/blob/master/models/official/mnasnet/mixnet/custom_layers.py\n '
def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding='', dil... |
def get_condconv_initializer(initializer, num_experts, expert_shape):
def condconv_initializer(weight):
'CondConv initializer function.'
num_params = np.prod(expert_shape)
if ((len(weight.shape) != 2) or (weight.shape[0] != num_experts) or (weight.shape[1] != num_params)):
rai... |
class CondConv2d(nn.Module):
' Conditional Convolution\n Inspired by: https://github.com/tensorflow/tpu/blob/master/models/official/efficientnet/condconv/condconv_layers.py\n\n Grouped convolution hackery for parallel execution of the per-sample kernel filters inspired by this discussion:\n https://githu... |
def select_conv2d(in_chs, out_chs, kernel_size, **kwargs):
assert ('groups' not in kwargs)
if isinstance(kernel_size, list):
assert ('num_experts' not in kwargs)
m = MixedConv2d(in_chs, out_chs, kernel_size, **kwargs)
else:
depthwise = kwargs.pop('depthwise', False)
groups ... |
def get_bn_args_tf():
return _BN_ARGS_TF.copy()
|
def resolve_bn_args(kwargs):
bn_args = (get_bn_args_tf() if kwargs.pop('bn_tf', False) else {})
bn_momentum = kwargs.pop('bn_momentum', None)
if (bn_momentum is not None):
bn_args['momentum'] = bn_momentum
bn_eps = kwargs.pop('bn_eps', None)
if (bn_eps is not None):
bn_args['eps'] ... |
def resolve_se_args(kwargs, in_chs, act_layer=None):
se_kwargs = (kwargs.copy() if (kwargs is not None) else {})
for (k, v) in _SE_ARGS_DEFAULT.items():
se_kwargs.setdefault(k, v)
if (not se_kwargs.pop('reduce_mid')):
se_kwargs['reduced_base_chs'] = in_chs
if (se_kwargs['act_layer'] is... |
def resolve_act_layer(kwargs, default='relu'):
act_layer = kwargs.pop('act_layer', default)
if isinstance(act_layer, str):
act_layer = get_act_layer(act_layer)
return act_layer
|
def make_divisible(v: int, divisor: int=8, min_value: int=None):
min_value = (min_value or divisor)
new_v = max(min_value, ((int((v + (divisor / 2))) // divisor) * divisor))
if (new_v < (0.9 * v)):
new_v += divisor
return new_v
|
def round_channels(channels, multiplier=1.0, divisor=8, channel_min=None):
'Round number of filters based on depth multiplier.'
if (not multiplier):
return channels
channels *= multiplier
return make_divisible(channels, divisor, channel_min)
|
def drop_connect(inputs, training: bool=False, drop_connect_rate: float=0.0):
'Apply drop connect.'
if (not training):
return inputs
keep_prob = (1 - drop_connect_rate)
random_tensor = (keep_prob + torch.rand((inputs.size()[0], 1, 1, 1), dtype=inputs.dtype, device=inputs.device))
random_te... |
class SqueezeExcite(nn.Module):
def __init__(self, in_chs, se_ratio=0.25, reduced_base_chs=None, act_layer=nn.ReLU, gate_fn=sigmoid, divisor=1):
super(SqueezeExcite, self).__init__()
reduced_chs = make_divisible(((reduced_base_chs or in_chs) * se_ratio), divisor)
self.conv_reduce = nn.Con... |
class ConvBnAct(nn.Module):
def __init__(self, in_chs, out_chs, kernel_size, stride=1, pad_type='', act_layer=nn.ReLU, norm_layer=nn.BatchNorm2d, norm_kwargs=None):
super(ConvBnAct, self).__init__()
assert (stride in [1, 2])
norm_kwargs = (norm_kwargs or {})
self.conv = select_con... |
class DepthwiseSeparableConv(nn.Module):
' DepthwiseSeparable block\n Used for DS convs in MobileNet-V1 and in the place of IR blocks with an expansion\n factor of 1.0. This is an alternative to having a IR with optional first pw conv.\n '
def __init__(self, in_chs, out_chs, dw_kernel_size=3, stride... |
class InvertedResidual(nn.Module):
' Inverted residual block w/ optional SE'
def __init__(self, in_chs, out_chs, dw_kernel_size=3, stride=1, pad_type='', act_layer=nn.ReLU, noskip=False, exp_ratio=1.0, exp_kernel_size=1, pw_kernel_size=1, se_ratio=0.0, se_kwargs=None, norm_layer=nn.BatchNorm2d, norm_kwargs=N... |
class CondConvResidual(InvertedResidual):
' Inverted residual block w/ CondConv routing'
def __init__(self, in_chs, out_chs, dw_kernel_size=3, stride=1, pad_type='', act_layer=nn.ReLU, noskip=False, exp_ratio=1.0, exp_kernel_size=1, pw_kernel_size=1, se_ratio=0.0, se_kwargs=None, norm_layer=nn.BatchNorm2d, n... |
class EdgeResidual(nn.Module):
' EdgeTPU Residual block with expansion convolution followed by pointwise-linear w/ stride'
def __init__(self, in_chs, out_chs, exp_kernel_size=3, exp_ratio=1.0, fake_in_chs=0, stride=1, pad_type='', act_layer=nn.ReLU, noskip=False, pw_kernel_size=1, se_ratio=0.0, se_kwargs=Non... |
class EfficientNetBuilder():
' Build Trunk Blocks for Efficient/Mobile Networks\n\n This ended up being somewhat of a cross between\n https://github.com/tensorflow/tpu/blob/master/models/official/mnasnet/mnasnet_models.py\n and\n https://github.com/facebookresearch/maskrcnn-benchmark/blob/master/maskr... |
def _parse_ksize(ss):
if ss.isdigit():
return int(ss)
else:
return [int(k) for k in ss.split('.')]
|
def _decode_block_str(block_str):
" Decode block definition string\n\n Gets a list of block arg (dicts) through a string notation of arguments.\n E.g. ir_r2_k3_s2_e1_i32_o16_se0.25_noskip\n\n All args can exist in any order with the exception of the leading string which\n is assumed to indicate the bl... |
def _scale_stage_depth(stack_args, repeats, depth_multiplier=1.0, depth_trunc='ceil'):
' Per-stage depth scaling\n Scales the block repeats in each stage. This depth scaling impl maintains\n compatibility with the EfficientNet scaling method, while allowing sensible\n scaling for other models that may ha... |
def decode_arch_def(arch_def, depth_multiplier=1.0, depth_trunc='ceil', experts_multiplier=1, fix_first_last=False):
arch_args = []
for (stack_idx, block_strings) in enumerate(arch_def):
assert isinstance(block_strings, list)
stack_args = []
repeats = []
for block_str in block_... |
def initialize_weight_goog(m, n='', fix_group_fanout=True):
if isinstance(m, CondConv2d):
fan_out = ((m.kernel_size[0] * m.kernel_size[1]) * m.out_channels)
if fix_group_fanout:
fan_out //= m.groups
init_weight_fn = get_condconv_initializer((lambda w: w.data.normal_(0, math.sqr... |
def initialize_weight_default(m, n=''):
if isinstance(m, CondConv2d):
init_fn = get_condconv_initializer(partial(nn.init.kaiming_normal_, mode='fan_out', nonlinearity='relu'), m.num_experts, m.weight_shape)
init_fn(m.weight)
elif isinstance(m, nn.Conv2d):
nn.init.kaiming_normal_(m.weig... |
class GenEfficientNet(nn.Module):
' Generic EfficientNets\n\n An implementation of mobile optimized networks that covers:\n * EfficientNet (B0-B8, L2, CondConv, EdgeTPU)\n * MixNet (Small, Medium, and Large, XL)\n * MNASNet A1, B1, and small\n * FBNet C\n * Single-Path NAS Pixel1\n ... |
def _create_model(model_kwargs, variant, pretrained=False):
as_sequential = model_kwargs.pop('as_sequential', False)
model = GenEfficientNet(**model_kwargs)
if pretrained:
load_pretrained(model, model_urls[variant])
if as_sequential:
model = model.as_sequential()
return model
|
def _gen_mnasnet_a1(variant, channel_multiplier=1.0, pretrained=False, **kwargs):
'Creates a mnasnet-a1 model.\n\n Ref impl: https://github.com/tensorflow/tpu/tree/master/models/official/mnasnet\n Paper: https://arxiv.org/pdf/1807.11626.pdf.\n\n Args:\n channel_multiplier: multiplier to number of ch... |
def _gen_mnasnet_b1(variant, channel_multiplier=1.0, pretrained=False, **kwargs):
'Creates a mnasnet-b1 model.\n\n Ref impl: https://github.com/tensorflow/tpu/tree/master/models/official/mnasnet\n Paper: https://arxiv.org/pdf/1807.11626.pdf.\n\n Args:\n channel_multiplier: multiplier to number of ch... |
def _gen_mnasnet_small(variant, channel_multiplier=1.0, pretrained=False, **kwargs):
'Creates a mnasnet-b1 model.\n\n Ref impl: https://github.com/tensorflow/tpu/tree/master/models/official/mnasnet\n Paper: https://arxiv.org/pdf/1807.11626.pdf.\n\n Args:\n channel_multiplier: multiplier to number of... |
def _gen_mobilenet_v2(variant, channel_multiplier=1.0, depth_multiplier=1.0, fix_stem_head=False, pretrained=False, **kwargs):
' Generate MobileNet-V2 network\n Ref impl: https://github.com/tensorflow/models/blob/master/research/slim/nets/mobilenet/mobilenet_v2.py\n Paper: https://arxiv.org/abs/1801.04381\n... |
def _gen_fbnetc(variant, channel_multiplier=1.0, pretrained=False, **kwargs):
" FBNet-C\n\n Paper: https://arxiv.org/abs/1812.03443\n Ref Impl: https://github.com/facebookresearch/maskrcnn-benchmark/blob/master/maskrcnn_benchmark/modeling/backbone/fbnet_modeldef.py\n\n NOTE: the impl above do... |
def _gen_spnasnet(variant, channel_multiplier=1.0, pretrained=False, **kwargs):
'Creates the Single-Path NAS model from search targeted for Pixel1 phone.\n\n Paper: https://arxiv.org/abs/1904.02877\n\n Args:\n channel_multiplier: multiplier to number of channels per layer.\n '
arch_def = [['ds_r... |
def _gen_efficientnet(variant, channel_multiplier=1.0, depth_multiplier=1.0, pretrained=False, **kwargs):
"Creates an EfficientNet model.\n\n Ref impl: https://github.com/tensorflow/tpu/blob/master/models/official/efficientnet/efficientnet_model.py\n Paper: https://arxiv.org/abs/1905.11946\n\n EfficientN... |
def _gen_efficientnet_edge(variant, channel_multiplier=1.0, depth_multiplier=1.0, pretrained=False, **kwargs):
arch_def = [['er_r1_k3_s1_e4_c24_fc24_noskip'], ['er_r2_k3_s2_e8_c32'], ['er_r4_k3_s2_e8_c48'], ['ir_r5_k5_s2_e8_c96'], ['ir_r4_k5_s1_e8_c144'], ['ir_r2_k5_s2_e8_c192']]
with layer_config_kwargs(kwar... |
def _gen_efficientnet_condconv(variant, channel_multiplier=1.0, depth_multiplier=1.0, experts_multiplier=1, pretrained=False, **kwargs):
'Creates an efficientnet-condconv model.'
arch_def = [['ds_r1_k3_s1_e1_c16_se0.25'], ['ir_r2_k3_s2_e6_c24_se0.25'], ['ir_r2_k5_s2_e6_c40_se0.25'], ['ir_r3_k3_s2_e6_c80_se0.2... |
def _gen_efficientnet_lite(variant, channel_multiplier=1.0, depth_multiplier=1.0, pretrained=False, **kwargs):
"Creates an EfficientNet-Lite model.\n\n Ref impl: https://github.com/tensorflow/tpu/tree/master/models/official/efficientnet/lite\n Paper: https://arxiv.org/abs/1905.11946\n\n EfficientNet para... |
def _gen_mixnet_s(variant, channel_multiplier=1.0, pretrained=False, **kwargs):
'Creates a MixNet Small model.\n\n Ref impl: https://github.com/tensorflow/tpu/tree/master/models/official/mnasnet/mixnet\n Paper: https://arxiv.org/abs/1907.09595\n '
arch_def = [['ds_r1_k3_s1_e1_c16'], ['ir_r1_k3_a1.1_p... |
def _gen_mixnet_m(variant, channel_multiplier=1.0, depth_multiplier=1.0, pretrained=False, **kwargs):
'Creates a MixNet Medium-Large model.\n\n Ref impl: https://github.com/tensorflow/tpu/tree/master/models/official/mnasnet/mixnet\n Paper: https://arxiv.org/abs/1907.09595\n '
arch_def = [['ds_r1_k3_s... |
def mnasnet_050(pretrained=False, **kwargs):
' MNASNet B1, depth multiplier of 0.5. '
model = _gen_mnasnet_b1('mnasnet_050', 0.5, pretrained=pretrained, **kwargs)
return model
|
def mnasnet_075(pretrained=False, **kwargs):
' MNASNet B1, depth multiplier of 0.75. '
model = _gen_mnasnet_b1('mnasnet_075', 0.75, pretrained=pretrained, **kwargs)
return model
|
def mnasnet_100(pretrained=False, **kwargs):
' MNASNet B1, depth multiplier of 1.0. '
model = _gen_mnasnet_b1('mnasnet_100', 1.0, pretrained=pretrained, **kwargs)
return model
|
def mnasnet_b1(pretrained=False, **kwargs):
' MNASNet B1, depth multiplier of 1.0. '
return mnasnet_100(pretrained, **kwargs)
|
def mnasnet_140(pretrained=False, **kwargs):
' MNASNet B1, depth multiplier of 1.4 '
model = _gen_mnasnet_b1('mnasnet_140', 1.4, pretrained=pretrained, **kwargs)
return model
|
def semnasnet_050(pretrained=False, **kwargs):
' MNASNet A1 (w/ SE), depth multiplier of 0.5 '
model = _gen_mnasnet_a1('semnasnet_050', 0.5, pretrained=pretrained, **kwargs)
return model
|
def semnasnet_075(pretrained=False, **kwargs):
' MNASNet A1 (w/ SE), depth multiplier of 0.75. '
model = _gen_mnasnet_a1('semnasnet_075', 0.75, pretrained=pretrained, **kwargs)
return model
|
def semnasnet_100(pretrained=False, **kwargs):
' MNASNet A1 (w/ SE), depth multiplier of 1.0. '
model = _gen_mnasnet_a1('semnasnet_100', 1.0, pretrained=pretrained, **kwargs)
return model
|
def mnasnet_a1(pretrained=False, **kwargs):
' MNASNet A1 (w/ SE), depth multiplier of 1.0. '
return semnasnet_100(pretrained, **kwargs)
|
def semnasnet_140(pretrained=False, **kwargs):
' MNASNet A1 (w/ SE), depth multiplier of 1.4. '
model = _gen_mnasnet_a1('semnasnet_140', 1.4, pretrained=pretrained, **kwargs)
return model
|
def mnasnet_small(pretrained=False, **kwargs):
' MNASNet Small, depth multiplier of 1.0. '
model = _gen_mnasnet_small('mnasnet_small', 1.0, pretrained=pretrained, **kwargs)
return model
|
def mobilenetv2_100(pretrained=False, **kwargs):
' MobileNet V2 w/ 1.0 channel multiplier '
model = _gen_mobilenet_v2('mobilenetv2_100', 1.0, pretrained=pretrained, **kwargs)
return model
|
def mobilenetv2_140(pretrained=False, **kwargs):
' MobileNet V2 w/ 1.4 channel multiplier '
model = _gen_mobilenet_v2('mobilenetv2_140', 1.4, pretrained=pretrained, **kwargs)
return model
|
def mobilenetv2_110d(pretrained=False, **kwargs):
' MobileNet V2 w/ 1.1 channel, 1.2 depth multipliers'
model = _gen_mobilenet_v2('mobilenetv2_110d', 1.1, depth_multiplier=1.2, fix_stem_head=True, pretrained=pretrained, **kwargs)
return model
|
def mobilenetv2_120d(pretrained=False, **kwargs):
' MobileNet V2 w/ 1.2 channel, 1.4 depth multipliers '
model = _gen_mobilenet_v2('mobilenetv2_120d', 1.2, depth_multiplier=1.4, fix_stem_head=True, pretrained=pretrained, **kwargs)
return model
|
def fbnetc_100(pretrained=False, **kwargs):
' FBNet-C '
if pretrained:
kwargs['bn_eps'] = BN_EPS_TF_DEFAULT
model = _gen_fbnetc('fbnetc_100', 1.0, pretrained=pretrained, **kwargs)
return model
|
def spnasnet_100(pretrained=False, **kwargs):
' Single-Path NAS Pixel1'
model = _gen_spnasnet('spnasnet_100', 1.0, pretrained=pretrained, **kwargs)
return model
|
def efficientnet_b0(pretrained=False, **kwargs):
' EfficientNet-B0 '
model = _gen_efficientnet('efficientnet_b0', channel_multiplier=1.0, depth_multiplier=1.0, pretrained=pretrained, **kwargs)
return model
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.