| 1228 | } |
| 1229 | |
| 1230 | HostTensorND TensorRTReplacePass::Impl::get_value(VarNode* var, ConvFormat format) { |
| 1231 | auto cg = m_opt_state.graph().comp_graph(); |
| 1232 | auto inferred_val = HostTensorND(var->comp_node(), dtype::Float32()); |
| 1233 | auto cb = [&](DeviceTensorND& val) { inferred_val.copy_from(val); }; |
| 1234 | if (format == ConvFormat::NCHW) { |
| 1235 | mgb_assert(var->dtype() == dtype::Float32()); |
| 1236 | auto orig_level = cg->options().log_level; |
| 1237 | cg->options().log_level = 0; |
| 1238 | MGB_TRY { cg->compile({{var, cb}})->execute(); } |
| 1239 | MGB_FINALLY(cg->options().log_level = orig_level); |
| 1240 | } else { |
| 1241 | mgb_assert(format == ConvFormat::NCHW4); |
| 1242 | if (var->shape().ndim == 5) { |
| 1243 | // assume nchw4 layout |