| 181 | #endif |
| 182 | |
| 183 | std::vector<uint8_t> create_graph_dump( |
| 184 | float bias, float extra_scale, float sleep, MGBDType dtype) { |
| 185 | HostTensorGenerator<> gen; |
| 186 | auto host_x = gen({1}, "cpux"); |
| 187 | auto graph = ComputingGraph::make(); |
| 188 | auto x = opr::Host2DeviceCopy::make(*graph, host_x); |
| 189 | if (sleep) |
| 190 | x = opr::Sleep::make(x, sleep); |
| 191 | x = opr::ExternCOprRunner::make_placeholder( |
| 192 | {x}, {TensorShape{1}}, |
| 193 | dtype == MGB_DTYPE_FLOAT32 |
| 194 | ? "bias_adder_dump:test" |
| 195 | : (dtype == MGB_DTYPE_INT32 ? "bias_adder_dump_i32" |
| 196 | : "bias_adder_dump_f16"), |
| 197 | &bias, sizeof(bias), {}, {dtype_c2cpp(dtype)}) |
| 198 | ->output(0); |
| 199 | if (extra_scale) |
| 200 | x = x * extra_scale; |
| 201 | |
| 202 | std::vector<uint8_t> ret; |
| 203 | auto dumper = GraphDumper::make(OutputFile::make_vector_proxy(&ret)); |
| 204 | dumper->dump({x}); |
| 205 | return ret; |
| 206 | } |
| 207 | |
| 208 | void check_dump_by_compute( |
| 209 | std::unique_ptr<serialization::InputFile> input_file, CompNode cn, |
no test coverage detected