From ae9ce1629bae37d0b9e813287516a184154ce02b Mon Sep 17 00:00:00 2001 From: gengdongjie Date: Mon, 18 May 2020 21:08:28 +0800 Subject: [PATCH] adapt to weight initializer modification --- example/resnet101_imagenet2012/train.py | 4 ++-- example/resnet50_imagenet2012/train.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/example/resnet101_imagenet2012/train.py b/example/resnet101_imagenet2012/train.py index cfe87d16a6..1401a34000 100755 --- a/example/resnet101_imagenet2012/train.py +++ b/example/resnet101_imagenet2012/train.py @@ -64,11 +64,11 @@ if __name__ == '__main__': if isinstance(cell, nn.Conv2d): cell.weight.default_input = weight_init.initializer(weight_init.XavierUniform(), cell.weight.default_input.shape(), - cell.weight.default_input.dtype()) + cell.weight.default_input.dtype()).to_tensor() if isinstance(cell, nn.Dense): cell.weight.default_input = weight_init.initializer(weight_init.TruncatedNormal(), cell.weight.default_input.shape(), - cell.weight.default_input.dtype()) + cell.weight.default_input.dtype()).to_tensor() if not config.label_smooth: config.label_smooth_factor = 0.0 loss = CrossEntropy(smooth_factor=config.label_smooth_factor, num_classes=config.class_num) diff --git a/example/resnet50_imagenet2012/train.py b/example/resnet50_imagenet2012/train.py index d050d96ec9..2d39f58cae 100755 --- a/example/resnet50_imagenet2012/train.py +++ b/example/resnet50_imagenet2012/train.py @@ -61,11 +61,11 @@ if __name__ == '__main__': if isinstance(cell, nn.Conv2d): cell.weight.default_input = weight_init.initializer(weight_init.XavierUniform(), cell.weight.default_input.shape(), - cell.weight.default_input.dtype()) + cell.weight.default_input.dtype()).to_tensor() if isinstance(cell, nn.Dense): cell.weight.default_input = weight_init.initializer(weight_init.TruncatedNormal(), cell.weight.default_input.shape(), - cell.weight.default_input.dtype()) + cell.weight.default_input.dtype()).to_tensor() if not config.use_label_smooth: config.label_smooth_factor = 0.0