Open
docs: fix Tensor construction examples to compile #94
docs: fix Tensor construction examples to compile #94
Open
SuneeAdd on Oct 24
Total: 17 files changed+68-51
@@ -59,10 +59,11 @@ static void Run() {
59 /* ACL init and stream create */59 /* ACL init and stream create */
60 ...60 ...
61 61 
62- Atvoss::Tensor<InputDtype> in1(deviceIn1, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);62+ uint64_t shapeArray[8] = {3, 4, 0, 0, 0, 0, 0, 0};
63- Atvoss::Tensor<InputDtype> in2(deviceIn2, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);63+ Atvoss::Tensor<InputDtype> in1(deviceIn1, shapeArray, 2);
64+ Atvoss::Tensor<InputDtype> in2(deviceIn2, shapeArray, 2);
64 InputDtype in3 = 5.0;65 InputDtype in3 = 5.0;
65- Atvoss::Tensor<OutputDtype> out(deviceOut, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);66+ Atvoss::Tensor<OutputDtype> out(deviceOut, shapeArray, 2);
66 67 
67 // 🔥🔥🔥 使用示例 🔥🔥🔥68 // 🔥🔥🔥 使用示例 🔥🔥🔥
68 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();69 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();
@@ -111,10 +111,11 @@ static void Run() {
111 /* ACL init and stream create */111 /* ACL init and stream create */
112 ...112 ...
113 113 
114- Atvoss::Tensor<InputDtype> in1(deviceIn1, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);114+ uint64_t shapeArray[8] = {3, 4, 0, 0, 0, 0, 0, 0};
115- Atvoss::Tensor<InputDtype> in2(deviceIn2, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);115+ Atvoss::Tensor<InputDtype> in1(deviceIn1, shapeArray, 2);
116+ Atvoss::Tensor<InputDtype> in2(deviceIn2, shapeArray, 2);
116 InputDtype in3 = 5.0;117 InputDtype in3 = 5.0;
117- Atvoss::Tensor<OutputDtype> out(deviceOut, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);118+ Atvoss::Tensor<OutputDtype> out(deviceOut, shapeArray, 2);
118 119 
119 // 🔥🔥🔥 使用示例 🔥🔥🔥120 // 🔥🔥🔥 使用示例 🔥🔥🔥
120 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();121 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();
@@ -95,10 +95,11 @@ static void Run() {
95 /* ACL init and stream create */95 /* ACL init and stream create */
96 ...96 ...
97 97 
98- Atvoss::Tensor<InputDtype> in1(deviceIn1, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);98+ uint64_t shapeArray[8] = {3, 4, 0, 0, 0, 0, 0, 0};
99- Atvoss::Tensor<InputDtype> in2(deviceIn2, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);99+ Atvoss::Tensor<InputDtype> in1(deviceIn1, shapeArray, 2);
100+ Atvoss::Tensor<InputDtype> in2(deviceIn2, shapeArray, 2);
100 InputDtype in3 = 5.0;101 InputDtype in3 = 5.0;
101- Atvoss::Tensor<OutputDtype> out(deviceOut, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);102+ Atvoss::Tensor<OutputDtype> out(deviceOut, shapeArray, 2);
102 103 
103 // 🔥🔥🔥 使用示例 🔥🔥🔥104 // 🔥🔥🔥 使用示例 🔥🔥🔥
104 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).build();105 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).build();
@@ -122,10 +122,11 @@ static void Run() {
122 /* ACL init and stream create */122 /* ACL init and stream create */
123 ...123 ...
124 124 
125- Atvoss::Tensor<InputDtype> in1(deviceIn1, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);125+ uint64_t shapeArray[8] = {3, 4, 0, 0, 0, 0, 0, 0};
126- Atvoss::Tensor<InputDtype> in2(deviceIn2, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);126+ Atvoss::Tensor<InputDtype> in1(deviceIn1, shapeArray, 2);
127+ Atvoss::Tensor<InputDtype> in2(deviceIn2, shapeArray, 2);
127 InputDtype in3 = 5.0;128 InputDtype in3 = 5.0;
128- Atvoss::Tensor<OutputDtype> out(deviceOut, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);129+ Atvoss::Tensor<OutputDtype> out(deviceOut, shapeArray, 2);
129 130 
130 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();131 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();
131 132 
@@ -90,10 +90,11 @@ static void Run() {
90 /* ACL init and stream create */90 /* ACL init and stream create */
91 ...91 ...
92 92 
93- Atvoss::Tensor<InputDtype> in1(deviceIn1, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);93+ uint64_t shapeArray[8] = {3, 4, 0, 0, 0, 0, 0, 0};
94- Atvoss::Tensor<InputDtype> in2(deviceIn2, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);94+ Atvoss::Tensor<InputDtype> in1(deviceIn1, shapeArray, 2);
95+ Atvoss::Tensor<InputDtype> in2(deviceIn2, shapeArray, 2);
95 InputDtype in3 = 5.0;96 InputDtype in3 = 5.0;
96- Atvoss::Tensor<OutputDtype> out(deviceOut, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);97+ Atvoss::Tensor<OutputDtype> out(deviceOut, shapeArray, 2);
97 98 
98 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();99 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();
99 100 
@@ -94,10 +94,11 @@ static void Run() {
94 /* ACL init and stream create */94 /* ACL init and stream create */
95 ...95 ...
96 96 
97- Atvoss::Tensor<InputDtype> in1(deviceIn1, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);97+ uint64_t shapeArray[8] = {3, 4, 0, 0, 0, 0, 0, 0};
98- Atvoss::Tensor<InputDtype> in2(deviceIn2, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);98+ Atvoss::Tensor<InputDtype> in1(deviceIn1, shapeArray, 2);
99+ Atvoss::Tensor<InputDtype> in2(deviceIn2, shapeArray, 2);
99 InputDtype in3 = 5.0;100 InputDtype in3 = 5.0;
100- Atvoss::Tensor<OutputDtype> out(deviceOut, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);101+ Atvoss::Tensor<OutputDtype> out(deviceOut, shapeArray, 2);
101 102 
102 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();103 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();
103 104 
@@ -76,10 +76,11 @@ static void Run() {
76 /* ACL init and stream create */76 /* ACL init and stream create */
77 ...77 ...
78 78 
79- Atvoss::Tensor<InputDtype> in1(deviceIn1, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);79+ uint64_t shapeArray[8] = {3, 4, 0, 0, 0, 0, 0, 0};
80- Atvoss::Tensor<InputDtype> in2(deviceIn2, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);80+ Atvoss::Tensor<InputDtype> in1(deviceIn1, shapeArray, 2);
81+ Atvoss::Tensor<InputDtype> in2(deviceIn2, shapeArray, 2);
81 InputDtype in3 = 5.0;82 InputDtype in3 = 5.0;
82- Atvoss::Tensor<OutputDtype> out(deviceOut, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);83+ Atvoss::Tensor<OutputDtype> out(deviceOut, shapeArray, 2);
83 84 
84 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();85 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();
85 86 
@@ -120,10 +120,11 @@ static void Run() {
120 /* ACL init and stream create */120 /* ACL init and stream create */
121 ...121 ...
122 122 
123- Atvoss::Tensor<InputDtype> in1(deviceIn1, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);123+ uint64_t shapeArray[8] = {3, 4, 0, 0, 0, 0, 0, 0};
124- Atvoss::Tensor<InputDtype> in2(deviceIn2, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);124+ Atvoss::Tensor<InputDtype> in1(deviceIn1, shapeArray, 2);
125+ Atvoss::Tensor<InputDtype> in2(deviceIn2, shapeArray, 2);
125 InputDtype in3 = 5.0;126 InputDtype in3 = 5.0;
126- Atvoss::Tensor<OutputDtype> out(deviceOut, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);127+ Atvoss::Tensor<OutputDtype> out(deviceOut, shapeArray, 2);
127 128 
128 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();129 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();
129 130 
@@ -100,10 +100,11 @@ static void Run() {
100 /* ACL init and stream create */100 /* ACL init and stream create */
101 ...101 ...
102 102 
103- Atvoss::Tensor<InputDtype> in1(deviceIn1, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);103+ uint64_t shapeArray[8] = {3, 4, 0, 0, 0, 0, 0, 0};
104- Atvoss::Tensor<InputDtype> in2(deviceIn2, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);104+ Atvoss::Tensor<InputDtype> in1(deviceIn1, shapeArray, 2);
105+ Atvoss::Tensor<InputDtype> in2(deviceIn2, shapeArray, 2);
105 InputDtype in3 = 5.0;106 InputDtype in3 = 5.0;
106- Atvoss::Tensor<OutputDtype> out(deviceOut, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);107+ Atvoss::Tensor<OutputDtype> out(deviceOut, shapeArray, 2);
107 108 
108 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();109 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();
109 110 
@@ -67,10 +67,11 @@ static void Run() {
67 /* ACL init and stream create */67 /* ACL init and stream create */
68 ...68 ...
69 69 
70- Atvoss::Tensor<InputDtype> in1(deviceIn1, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);70+ uint64_t shapeArray[8] = {3, 4, 0, 0, 0, 0, 0, 0};
71- Atvoss::Tensor<InputDtype> in2(deviceIn2, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);71+ Atvoss::Tensor<InputDtype> in1(deviceIn1, shapeArray, 2);
72+ Atvoss::Tensor<InputDtype> in2(deviceIn2, shapeArray, 2);
72 InputDtype in3 = 5.0;73 InputDtype in3 = 5.0;
73- Atvoss::Tensor<OutputDtype> out(deviceOut, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);74+ Atvoss::Tensor<OutputDtype> out(deviceOut, shapeArray, 2);
74 75 
75 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();76 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();
76 77 
@@ -112,10 +112,11 @@ static void Run() {
112 /* ACL init and stream create */112 /* ACL init and stream create */
113 ...113 ...
114 114 
115- Atvoss::Tensor<InputDtype> in1(deviceIn1, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);115+ uint64_t shapeArray[8] = {3, 4, 0, 0, 0, 0, 0, 0};
116- Atvoss::Tensor<InputDtype> in2(deviceIn2, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);116+ Atvoss::Tensor<InputDtype> in1(deviceIn1, shapeArray, 2);
117+ Atvoss::Tensor<InputDtype> in2(deviceIn2, shapeArray, 2);
117 InputDtype in3 = 5.0;118 InputDtype in3 = 5.0;
118- Atvoss::Tensor<OutputDtype> out(deviceOut, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);119+ Atvoss::Tensor<OutputDtype> out(deviceOut, shapeArray, 2);
119 120 
120 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();121 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();
121 122 
@@ -90,10 +90,11 @@ static void Run() {
90 /* ACL init and stream create */90 /* ACL init and stream create */
91 ...91 ...
92 92 
93- Atvoss::Tensor<InputDtype> in1(deviceIn1, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);93+ uint64_t shapeArray[8] = {3, 4, 0, 0, 0, 0, 0, 0};
94- Atvoss::Tensor<InputDtype> in2(deviceIn2, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);94+ Atvoss::Tensor<InputDtype> in1(deviceIn1, shapeArray, 2);
95+ Atvoss::Tensor<InputDtype> in2(deviceIn2, shapeArray, 2);
95 InputDtype in3 = 5.0;96 InputDtype in3 = 5.0;
96- Atvoss::Tensor<OutputDtype> out(deviceOut, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);97+ Atvoss::Tensor<OutputDtype> out(deviceOut, shapeArray, 2);
97 98 
98 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();99 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();
99 100 
@@ -105,10 +105,11 @@ static void Run() {
105 /* ACL init and stream create */105 /* ACL init and stream create */
106 ...106 ...
107 107 
108- Atvoss::Tensor<InputDtype> in1(deviceIn1, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);108+ uint64_t shapeArray[8] = {3, 4, 0, 0, 0, 0, 0, 0};
109- Atvoss::Tensor<InputDtype> in2(deviceIn2, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);109+ Atvoss::Tensor<InputDtype> in1(deviceIn1, shapeArray, 2);
110+ Atvoss::Tensor<InputDtype> in2(deviceIn2, shapeArray, 2);
110 InputDtype in3 = 5.0;111 InputDtype in3 = 5.0;
111- Atvoss::Tensor<OutputDtype> out(deviceOut, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);112+ Atvoss::Tensor<OutputDtype> out(deviceOut, shapeArray, 2);
112 113 
113 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();114 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();
114 115 
@@ -114,10 +114,11 @@ static void Run() {
114 /* ACL init and stream create */114 /* ACL init and stream create */
115 ...115 ...
116 116 
117- Atvoss::Tensor<InputDtype> in1(deviceIn1, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);117+ uint64_t shapeArray[8] = {3, 4, 0, 0, 0, 0, 0, 0};
118- Atvoss::Tensor<InputDtype> in2(deviceIn2, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);118+ Atvoss::Tensor<InputDtype> in1(deviceIn1, shapeArray, 2);
119+ Atvoss::Tensor<InputDtype> in2(deviceIn2, shapeArray, 2);
119 InputDtype in3 = 5.0;120 InputDtype in3 = 5.0;
120- Atvoss::Tensor<OutputDtype> out(deviceOut, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);121+ Atvoss::Tensor<OutputDtype> out(deviceOut, shapeArray, 2);
121 122 
122 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();123 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();
123 124 
@@ -79,10 +79,11 @@ static void Run() {
79 /* ACL init and stream create */79 /* ACL init and stream create */
80 ...80 ...
81 81 
82- Atvoss::Tensor<InputDtype> in1(deviceIn1, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);82+ uint64_t shapeArray[8] = {3, 4, 0, 0, 0, 0, 0, 0};
83- Atvoss::Tensor<InputDtype> in2(deviceIn2, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);83+ Atvoss::Tensor<InputDtype> in1(deviceIn1, shapeArray, 2);
84+ Atvoss::Tensor<InputDtype> in2(deviceIn2, shapeArray, 2);
84 InputDtype in3 = 5.0;85 InputDtype in3 = 5.0;
85- Atvoss::Tensor<OutputDtype> out(deviceOut, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);86+ Atvoss::Tensor<OutputDtype> out(deviceOut, shapeArray, 2);
86 87 
87 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();88 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();
88 89 
@@ -104,10 +104,11 @@ static void Run() {
104 /* ACL init and stream create */104 /* ACL init and stream create */
105 ...105 ...
106 106 
107- Atvoss::Tensor<InputDtype> in1(deviceIn1, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);107+ uint64_t shapeArray[8] = {3, 4, 0, 0, 0, 0, 0, 0};
108- Atvoss::Tensor<InputDtype> in2(deviceIn2, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);108+ Atvoss::Tensor<InputDtype> in1(deviceIn1, shapeArray, 2);
109+ Atvoss::Tensor<InputDtype> in2(deviceIn2, shapeArray, 2);
109 InputDtype in3 = 5.0;110 InputDtype in3 = 5.0;
110- Atvoss::Tensor<OutputDtype> out(deviceOut, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);111+ Atvoss::Tensor<OutputDtype> out(deviceOut, shapeArray, 2);
111 112 
112 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();113 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();
113 114 
@@ -107,10 +107,11 @@ static void Run() {
107 /* ACL init and stream create */107 /* ACL init and stream create */
108 ...108 ...
109 109 
110- Atvoss::Tensor<InputDtype> in1(deviceIn1, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);110+ uint64_t shapeArray[8] = {3, 4, 0, 0, 0, 0, 0, 0};
111- Atvoss::Tensor<InputDtype> in2(deviceIn2, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);111+ Atvoss::Tensor<InputDtype> in1(deviceIn1, shapeArray, 2);
112+ Atvoss::Tensor<InputDtype> in2(deviceIn2, shapeArray, 2);
112 InputDtype in3 = 5.0;113 InputDtype in3 = 5.0;
113- Atvoss::Tensor<OutputDtype> out(deviceOut, {{3, 4, 0, 0, 0, 0, 0, 0}}, 2);114+ Atvoss::Tensor<OutputDtype> out(deviceOut, shapeArray, 2);
114 115 
115 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();116 auto arguments = Atvoss::ArgumentsBuilder{}.inputOutput(in1, in2, in3, out).attr("dim", 5).build();
116 117