From 06b4de43f12e8aced0ca0c093b5164618c18d14a Mon Sep 17 00:00:00 2001
From: yuxiaodianyu <dengzhuo6@huawei.com>
Date: Tue, 12 Jul 2022 09:50:47 +0800
Subject: [PATCH] modify network RCAN scripts and resnet readme

---
 official/cv/resnet/README_CN.md    | 10 +++++++---
 research/cv/RCAN/src/rcan_model.py | 11 ++++++-----
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/official/cv/resnet/README_CN.md b/official/cv/resnet/README_CN.md
index 77b3f560e..dcaa4ea34 100644
--- a/official/cv/resnet/README_CN.md
+++ b/official/cv/resnet/README_CN.md
@@ -453,16 +453,20 @@ bash run_parameter_server_train_gpu.sh [DATASET_PATH] [CONFIG_PATH] [PRETRAINED_
 
 ```bash
 # Ascend 鍒嗗竷寮忚缁冩椂鎺ㄧ悊绀轰緥:
+cd scripts/
 bash run_distribute_train.sh [RANK_TABLE_FILE] [DATASET_PATH] [CONFIG_PATH] [RUN_EVAL](optional) [EVAL_DATASET_PATH](optional)
 
 # Ascend 鍗曟満璁粌鏃舵帹鐞嗙ず渚�:
-bash run_standalone_train.sh [RANK_TABLE_FILE] [DATASET_PATH] [CONFIG_PATH] [RUN_EVAL](optional) [EVAL_DATASET_PATH](optional)
+cd scripts/
+bash run_standalone_train.sh [DATASET_PATH] [CONFIG_PATH] [RUN_EVAL](optional) [EVAL_DATASET_PATH](optional)
 
 # GPU 鍒嗗竷寮忚缁冩椂鎺ㄧ悊绀轰緥:
-bash run_distribute_train_gpu.sh [CONFIG_PATH] [RUN_EVAL](optional) [EVAL_DATASET_PATH](optional)
+cd scripts/
+bash run_distribute_train_gpu.sh [DATASET_PATH] [CONFIG_PATH] [RUN_EVAL](optional) [EVAL_DATASET_PATH](optional)
 
 # GPU 鍗曟満璁粌鏃舵帹鐞嗙ず渚�:
-bash run_standalone_train_gpu.sh [CONFIG_PATH] [RUN_EVAL](optional) [EVAL_DATASET_PATH](optional)
+cd scripts/
+bash run_standalone_train_gpu.sh [DATASET_PATH] [CONFIG_PATH] [RUN_EVAL](optional) [EVAL_DATASET_PATH](optional)
 ```
 
 璁粌鏃舵帹鐞嗛渶瑕佸湪璁剧疆`RUN_EVAL`涓篢rue锛屼笌姝ゅ悓鏃惰繕闇€瑕佽缃甡EVAL_DATASET_PATH`銆傛澶栵紝褰撹缃甡RUN_EVAL`涓篢rue鏃惰繕鍙负python鑴氭湰璁剧疆`save_best_ckpt`, `eval_start_epoch`, `eval_interval`绛夊弬鏁般€�
diff --git a/research/cv/RCAN/src/rcan_model.py b/research/cv/RCAN/src/rcan_model.py
index 0fd502076..6ffbf6680 100644
--- a/research/cv/RCAN/src/rcan_model.py
+++ b/research/cv/RCAN/src/rcan_model.py
@@ -86,11 +86,12 @@ class Upsampler(nn.Cell):
         """rcan"""
         super(Upsampler, self).__init__()
         m = []
-        if (scale & (scale - 1)) == 0:
-            for _ in range(int(math.log(scale, 2))):
-                m.append(SmallUpSampler(conv, 2, n_feats, has_bias=has_bias))
-        elif scale == 3:
-            m.append(SmallUpSampler(conv, 3, n_feats, has_bias=has_bias))
+        for s in scale:
+            if (s & (s - 1)) == 0:
+                for _ in range(int(math.log(s, 2))):
+                    m.append(SmallUpSampler(conv, 2, n_feats, has_bias=has_bias))
+            elif s == 3:
+                m.append(SmallUpSampler(conv, 3, n_feats, has_bias=has_bias))
         self.net = nn.SequentialCell(m)
 
     def construct(self, x):
-- 
GitLab