From 6d5c580a61b92e368342dbffc547798b6b2df5b5 Mon Sep 17 00:00:00 2001
From: buxue <yiren19920727@163.com>
Date: Thu, 16 Jul 2020 19:44:24 +0800
Subject: [PATCH] change shape and dtype of tensor from interface to attr

---
 mindspore/nn/graph_kernels/graph_kernels.py | 2 +-
 mindspore/nn/layer/quant.py                 | 6 +++---
 model_zoo/gat/src/gat.py                    | 6 +++---
 tests/st/pynative/test_ops.py               | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/mindspore/nn/graph_kernels/graph_kernels.py b/mindspore/nn/graph_kernels/graph_kernels.py
index 21cc4f871..21a4c38ac 100644
--- a/mindspore/nn/graph_kernels/graph_kernels.py
+++ b/mindspore/nn/graph_kernels/graph_kernels.py
@@ -1020,7 +1020,7 @@ class LayerNorm(Cell):
 
     Examples:
         >>> x = Tensor(np.ones([20, 5, 10, 10]), mindspore.float32)
-        >>> shape1 = x.shape()[1:]
+        >>> shape1 = x.shape[1:]
         >>> m = G.LayerNorm(shape1,  begin_norm_axis=1, begin_params_axis=1)
         >>> m(x)
     """
diff --git a/mindspore/nn/layer/quant.py b/mindspore/nn/layer/quant.py
index 63cdedbfe..2f4f20329 100644
--- a/mindspore/nn/layer/quant.py
+++ b/mindspore/nn/layer/quant.py
@@ -746,8 +746,8 @@ class DenseQuant(Cell):
         self.has_bias = check_bool(has_bias)
 
         if isinstance(weight_init, Tensor):
-            if weight_init.dim() != 2 or weight_init.shape()[0] != out_channels or \
-                    weight_init.shape()[1] != in_channels:
+            if weight_init.dim() != 2 or weight_init.shape[0] != out_channels or \
+                    weight_init.shape[1] != in_channels:
                 raise ValueError("weight_init shape error")
 
         self.weight = Parameter(initializer(
@@ -755,7 +755,7 @@ class DenseQuant(Cell):
 
         if self.has_bias:
             if isinstance(bias_init, Tensor):
-                if bias_init.dim() != 1 or bias_init.shape()[0] != out_channels:
+                if bias_init.dim() != 1 or bias_init.shape[0] != out_channels:
                     raise ValueError("bias_init shape error")
 
             self.bias = Parameter(initializer(
diff --git a/model_zoo/gat/src/gat.py b/model_zoo/gat/src/gat.py
index 3cb3cc110..ff0c964e9 100644
--- a/model_zoo/gat/src/gat.py
+++ b/model_zoo/gat/src/gat.py
@@ -77,15 +77,15 @@ class GNNFeatureTransform(nn.Cell):
         self.has_bias = check_bool(has_bias)
 
         if isinstance(weight_init, Tensor):
-            if weight_init.dim() != 2 or weight_init.shape()[0] != out_channels or \
-               weight_init.shape()[1] != in_channels:
+            if weight_init.dim() != 2 or weight_init.shape[0] != out_channels or \
+               weight_init.shape[1] != in_channels:
                 raise ValueError("weight_init shape error")
 
         self.weight = Parameter(initializer(weight_init, [out_channels, in_channels]), name="weight")
 
         if self.has_bias:
             if isinstance(bias_init, Tensor):
-                if bias_init.dim() != 1 or bias_init.shape()[0] != out_channels:
+                if bias_init.dim() != 1 or bias_init.shape[0] != out_channels:
                     raise ValueError("bias_init shape error")
 
             self.bias = Parameter(initializer(bias_init, [out_channels]), name="bias")
diff --git a/tests/st/pynative/test_ops.py b/tests/st/pynative/test_ops.py
index 3cec24fb1..c43e626be 100644
--- a/tests/st/pynative/test_ops.py
+++ b/tests/st/pynative/test_ops.py
@@ -28,4 +28,4 @@ def test_cast():
     type_dst = ms.float32
     cast = P.Cast()
     result = cast(input_x, type_dst)
-    assert result.dtype() == type_dst
+    assert result.dtype == type_dst
-- 
GitLab