| 156 | } |
| 157 | |
| 158 | void CopyOpTest::TestCopyConstantLayout021(size_t n1, size_t n2, size_t n3) { |
| 159 | Array3D<int32> a(n1, n2, n3); |
| 160 | for (size_t i = 0; i < n1; ++i) { |
| 161 | for (size_t j = 0; j < n2; ++j) { |
| 162 | for (size_t k = 0; k < n3; ++k) { |
| 163 | a(i, j, k) = i * n3 * n2 + j * n3 + k; |
| 164 | } |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | HloComputation::Builder builder(TestName()); |
| 169 | |
| 170 | Literal literal = LiteralUtil::CreateR3FromArray3D(a); |
| 171 | |
| 172 | HloInstruction* constant = builder.AddInstruction( |
| 173 | HloInstruction::CreateConstant(std::move(literal))); |
| 174 | |
| 175 | builder.AddInstruction(HloInstruction::CreateUnary( |
| 176 | constant->shape(), HloOpcode::kCopy, constant)); |
| 177 | |
| 178 | std::unique_ptr<HloComputation> computation = builder.Build(); |
| 179 | |
| 180 | auto module = CreateNewVerifiedModule(); |
| 181 | module->AddEntryComputation(std::move(computation)); |
| 182 | ForceResultLayout(module.get(), LayoutUtil::MakeLayout({1, 2, 0})); |
| 183 | Literal result = ExecuteAndTransfer(std::move(module), {}); |
| 184 | |
| 185 | LiteralTestUtil::ExpectR3EqualArray3D(a, result); |
| 186 | } |
| 187 | |
| 188 | void CopyOpTest::TestCopyConstantLayoutR4(size_t n1, size_t n2, size_t n3, |
| 189 | size_t n4, |
nothing calls this directly
no test coverage detected