diff --git a/official/cv/efficientnet/src/efficientnet.py b/official/cv/efficientnet/src/efficientnet.py index f7a14cfb4b6025c1c3d27bb139eb08458ef07c94..ce6e6a3ec17a576448ef884e860c943fd3e3cec3 100644 --- a/official/cv/efficientnet/src/efficientnet.py +++ b/official/cv/efficientnet/src/efficientnet.py @@ -18,11 +18,9 @@ import math import re from copy import deepcopy -import mindspore as ms from mindspore import nn from mindspore.common.initializer import (Normal, One, Uniform, Zero) from mindspore.ops import operations as P -from mindspore.ops.composite import clip_by_value relu = P.ReLU() sigmoid = P.Sigmoid() @@ -345,14 +343,6 @@ def _decode_arch_def(arch_def, depth_multiplier=1.0, depth_trunc='ceil'): return arch_args -def hard_swish(x): - x = P.Cast()(x, ms.float32) - y = x + 3.0 - y = clip_by_value(y, 0.0, 6.0) - y = y / 6.0 - return x * y - - class BlockBuilder(nn.Cell): def __init__(self, builder_in_channels, builder_block_args, channel_multiplier=1.0, channel_divisor=8, channel_min=None, pad_type='', act_fn=None, se_gate_fn=sigmoid, se_reduce_mid=False, @@ -702,7 +692,7 @@ def _gen_efficientnet(channel_multiplier=1.0, depth_multiplier=1.0, num_classes= channel_multiplier=channel_multiplier, num_features=num_features, bn_args=_resolve_bn_args(kwargs), - act_fn=hard_swish, + act_fn=nn.HSwish(), **kwargs ) return model diff --git a/official/cv/ssd/train.py b/official/cv/ssd/train.py index 30a5c70d034149c77a4ed2b31ce3c3df07a99524..e18062d5f409ce7f16fa2ef35bd4e9465b110988 100644 --- a/official/cv/ssd/train.py +++ b/official/cv/ssd/train.py @@ -125,9 +125,6 @@ def train_net(): ms.set_auto_parallel_context(all_reduce_fusion_config=config.all_reduce_fusion_config) rank = get_rank() - # Set mempool block size in PYNATIVE_MODE for improving memory utilization, which will not take effect in GRAPH_MODE - ms.set_context(mempool_block_size="31GB") - mindrecord_file = create_mindrecord(config.dataset, "ssd.mindrecord", True) if config.only_create_dataset: