diff --git a/example/resnet50_imagenet2012_THOR/cus_ops/batch_matmul_impl.py b/example/resnet50_imagenet2012_THOR/cus_ops/batch_matmul_impl.py index bc4ac3a2eb..201d427308 100644 --- a/example/resnet50_imagenet2012_THOR/cus_ops/batch_matmul_impl.py +++ b/example/resnet50_imagenet2012_THOR/cus_ops/batch_matmul_impl.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================ -from mindspore.ops.op_info_register import op_info_register """batch_matmul_impl""" +from mindspore.ops.op_info_register import op_info_register @op_info_register("""{ "op_name": "CusBatchMatMul", diff --git a/example/resnet50_imagenet2012_THOR/cus_ops/cholesky_trsm.py b/example/resnet50_imagenet2012_THOR/cus_ops/cholesky_trsm.py index 1a2c4bfb9b..8f09fab77d 100644 --- a/example/resnet50_imagenet2012_THOR/cus_ops/cholesky_trsm.py +++ b/example/resnet50_imagenet2012_THOR/cus_ops/cholesky_trsm.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================ -from mindspore.ops.op_info_register import op_info_register """CusCholeskyTrsm""" +from mindspore.ops.op_info_register import op_info_register @op_info_register("""{ "op_name": "CusCholeskyTrsm", diff --git a/example/resnet50_imagenet2012_THOR/cus_ops/matmul_cube_fracz_right_mul_impl.py b/example/resnet50_imagenet2012_THOR/cus_ops/matmul_cube_fracz_right_mul_impl.py index 2923afe2bd..7fc2ba35d1 100644 --- a/example/resnet50_imagenet2012_THOR/cus_ops/matmul_cube_fracz_right_mul_impl.py +++ b/example/resnet50_imagenet2012_THOR/cus_ops/matmul_cube_fracz_right_mul_impl.py @@ -109,4 +109,5 @@ NoneType = type(None) }""") def CusMatMulCubeFraczRightMul(input_x1, input_x2, input_x3, bias=None, output_y={}, trans_a=False, trans_b=False, kernel_name="matmulcube"): + """CusMatMulCubeFraczRightMul""" return diff --git a/example/resnet50_imagenet2012_THOR/model/model_thor.py b/example/resnet50_imagenet2012_THOR/model/model_thor.py index 2b33c8602d..613d15468f 100644 --- a/example/resnet50_imagenet2012_THOR/model/model_thor.py +++ b/example/resnet50_imagenet2012_THOR/model/model_thor.py @@ -530,7 +530,7 @@ class Model: valid_dataset (Dataset): Dataset to evaluate the model. list_callback (ListCallback): Executor of callback list. Default: None. cb_params (_InternalCallbackParam): Callback parameters. Default: None. - + Returns: Dict, returns the loss value & metrics values for the model in test mode. """ diff --git a/example/resnet50_imagenet2012_THOR/model/resnet.py b/example/resnet50_imagenet2012_THOR/model/resnet.py index fb05341348..7a9b5a8922 100644 --- a/example/resnet50_imagenet2012_THOR/model/resnet.py +++ b/example/resnet50_imagenet2012_THOR/model/resnet.py @@ -126,7 +126,7 @@ def _bn_last(channel): def _fc(in_channel, out_channel, damping, loss_scale, frequency): weight_shape = (out_channel, in_channel) weight = Tensor(kaiming_uniform(weight_shape, a=math.sqrt(5)) - return Dense_Thor(in_channel, out_channel, has_bias=False, weight_init=weight, + return Dense_Thor(in_channel, out_channel, has_bias=False, weight_init=weight, \ bias_init=0, damping=damping, loss_scale=loss_scale, frequency=frequency) diff --git a/example/resnet50_imagenet2012_THOR/model/thor_layer.py b/example/resnet50_imagenet2012_THOR/model/thor_layer.py index 8add3d74fa..0850ed1dee 100644 --- a/example/resnet50_imagenet2012_THOR/model/thor_layer.py +++ b/example/resnet50_imagenet2012_THOR/model/thor_layer.py @@ -196,7 +196,7 @@ class Conv2d_Thor(_Conv): self.channels_slice_flag = True self.padA_flag = False - if (self.matrix_A_dim // self.diag_block_dim) * self.diag_block_dim != self.matrix_A_dim + if (self.matrix_A_dim // self.diag_block_dim) * self.diag_block_dim != self.matrix_A_dim \ and self.matrix_A_dim > self.diag_block_dim: self.padA_flag = True pad_dim = self.diag_block_dim - self.matrix_A_dim % self.diag_block_dim diff --git a/example/resnet50_imagenet2012_THOR/train.py b/example/resnet50_imagenet2012_THOR/train.py index 3692f7b866..fe192884c4 100644 --- a/example/resnet50_imagenet2012_THOR/train.py +++ b/example/resnet50_imagenet2012_THOR/train.py @@ -82,9 +82,9 @@ def get_second_order_damping(global_step, damping_init, decay_rate, total_epochs current_step = global_step damping_each_step = np.array(damping_each_step).astype(np.float32) - damping = damping_each_step[current_step:] - print("damping_is=========", damping) - return damping + damping_now = damping_each_step[current_step:] + print("damping_is=========", damping_now) + return damping_now if __name__ == '__main__':