| 428 | } |
| 429 | |
| 430 | SmallVector<Handle> ChannelImpl::apply_op( |
| 431 | std::shared_ptr<OpDef> op, const SmallVector<Handle>& inputs) { |
| 432 | MGB_LOCK_GUARD(m_spin); |
| 433 | assert_available(); |
| 434 | auto* input = reinterpret_cast<TensorInfo*>(inputs[0]); |
| 435 | if (op->same_type<GetVarShape>() && input->shape_valid()) { |
| 436 | size_t ndim = input->desc.layout.ndim; |
| 437 | auto& gvs = op->cast_final_safe<GetVarShape>(); |
| 438 | if (gvs.axis == MEGDNN_MAX_NDIM) { |
| 439 | HostTensorND shape_tensor{input->desc.comp_node, {ndim}, dtype::Int32()}; |
| 440 | DeviceTensorND shape_tensor_device = shape_tensor.proxy_to_default_cpu(); |
| 441 | cg::copy_shape_to_tensor_value(shape_tensor_device, input->desc.layout); |
| 442 | return {reinterpret_cast<Handle>(put_impl(shape_tensor, false))}; |
| 443 | } |
| 444 | } |
| 445 | return apply_op_impl(std::move(op), inputs); |
| 446 | } |
| 447 | |
| 448 | SmallVector<Handle> ChannelImpl::apply_op_impl( |
| 449 | std::shared_ptr<OpDef> op, const SmallVector<Handle>& inputs) { |
nothing calls this directly
no test coverage detected