From 75eb04c55997c93f1c19b166b2187ce637fdea7d Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Thu, 1 Jul 2021 14:16:07 +0800 Subject: [PATCH] feat(mge/experimental): add WeightScaler support GitOrigin-RevId: a1d5b68498e51bf1f7dc2266b72c19d17c130195 --- .../python/megengine/experimental/__init__.py | 8 +++++++ imperative/python/megengine/functional/nn.py | 3 +-- imperative/python/scripts/format.sh | 22 +++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100755 imperative/python/scripts/format.sh diff --git a/imperative/python/megengine/experimental/__init__.py b/imperative/python/megengine/experimental/__init__.py index e69de29b..0253e7dc 100644 --- a/imperative/python/megengine/experimental/__init__.py +++ b/imperative/python/megengine/experimental/__init__.py @@ -0,0 +1,8 @@ +# -*- coding: utf-8 -*- +# MegEngine is Licensed under the Apache License, Version 2.0 (the "License") +# +# Copyright (c) 2014-2021 Megvii Inc. All rights reserved. +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/imperative/python/megengine/functional/nn.py b/imperative/python/megengine/functional/nn.py index 663d7fa5..ffe7b7c7 100644 --- a/imperative/python/megengine/functional/nn.py +++ b/imperative/python/megengine/functional/nn.py @@ -1462,6 +1462,5 @@ warp_affine = deprecated_func("1.3", "megengine.functional.vision", "warp_affine warp_perspective = deprecated_func( "1.3", "megengine.functional.vision", "warp_perspective", True ) - -from .loss import * # isort:skip from .quantized import conv_bias_activation # isort:skip +from .loss import * # isort:skip diff --git a/imperative/python/scripts/format.sh b/imperative/python/scripts/format.sh new file mode 100755 index 00000000..02220655 --- /dev/null +++ b/imperative/python/scripts/format.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +set -e +cd $(dirname $0)/.. + +ISORT_ARG="" +BLACK_ARG="" + +while getopts 'd' OPT; do + case $OPT in + d) + ISORT_ARG="--diff --check-only" + BLACK_ARG="--diff --check" + ;; + ?) + echo "Usage: `basename $0` [-d]" + esac +done + +# do not isort megengine/__init__.py file, caused we must +# init library load path before load dependent lib in core +isort $ISORT_ARG -j $(nproc) -rc megengine test examples -s megengine/__init__.py +black $BLACK_ARG --target-version=py35 -- megengine test examples -- GitLab