| 41 | } |
| 42 | |
| 43 | SmallVector<TensorPtr> apply_on_physical_tensor( |
| 44 | const OpDef& def, const SmallVector<TensorPtr>& inputs, |
| 45 | SmallVector<LogicalTensorDesc>& output_descs, const bool& validated) { |
| 46 | auto&& op = def.cast_final_safe<Fill>(); |
| 47 | auto comp_node = inputs[0]->comp_node(); |
| 48 | TensorShape tshp; |
| 49 | cg::copy_tensor_value_to_shape(tshp, inputs[0]->get_value().proxy_to_default_cpu()); |
| 50 | TensorLayout oup_layout = TensorLayout{tshp, op.dtype}; |
| 51 | auto output = Tensor::make(oup_layout, comp_node); |
| 52 | |
| 53 | if (oup_layout.total_nr_elems() != 0) { // empty tensor like Tensor([]) |
| 54 | DnnOprCaller<megdnn::Fill> caller(comp_node, megdnn::Fill::Param{op.value}); |
| 55 | caller.exec_with_ws(output); |
| 56 | } |
| 57 | return {output}; |
| 58 | } |
| 59 | |
| 60 | SmallVector<VarNode::LayoutConstraintCallback> get_input_layout_constraint( |
| 61 | const OpDef& def, const SmallVector<TensorPtr>& inputs) { |
nothing calls this directly
no test coverage detected