| 1191 | |
| 1192 | template <class Opr> |
| 1193 | void run_multi_axis_vec_empty_shape( |
| 1194 | const TensorShape& ishp, const TensorShape& idx0, const TensorShape& idx1, |
| 1195 | const TensorShape& tshp) { |
| 1196 | mgb_assert(ishp.ndim >= 4); |
| 1197 | mgb_assert(idx0.is_empty() || idx1.is_empty()); |
| 1198 | using AI = opr::indexing::AxisIndexer; |
| 1199 | auto graph = ComputingGraph::make(); |
| 1200 | HostTensorGenerator<> gen; |
| 1201 | HostTensorGenerator<dtype::Int32> gen_idx; |
| 1202 | auto host_x = gen(ishp); |
| 1203 | auto x = opr::Host2DeviceCopy::make(*graph, host_x), |
| 1204 | idx_dynamic_shape = opr::MarkDynamicVar::make( |
| 1205 | opr::ImmutableTensor::make(*graph, *gen_idx(idx0))), |
| 1206 | idx_static_shape = opr::ImmutableTensor::make(*graph, *gen_idx(idx1)), |
| 1207 | y = Opr::make( |
| 1208 | x, {AI::make_interval(-1, None, None, x.make_scalar(2)), |
| 1209 | AI::make_index(1, idx_dynamic_shape), |
| 1210 | AI::make_index(2, idx_static_shape)}); |
| 1211 | HostTensorND host_y; |
| 1212 | auto func = graph->compile({make_callback_copy(y, host_y)}); |
| 1213 | func->execute(); |
| 1214 | ASSERT_TRUE(host_y.shape().is_empty()); |
| 1215 | MGB_ASSERT_SHAPE_EQ(host_y.shape(), tshp); |
| 1216 | } |
| 1217 | |
| 1218 | template <class Opr> |
| 1219 | void run_modify_multi_axis_vec_empty_shape( |
nothing calls this directly
no test coverage detected