| 12 | namespace fill { |
| 13 | |
| 14 | auto apply_on_var_node(const OpDef& def, const VarNodeArray& inputs) { |
| 15 | auto&& op = static_cast<const Fill&>(def); |
| 16 | mgb_assert(inputs.size() == 1); |
| 17 | auto comp_node = inputs[0]->comp_node(); |
| 18 | auto name = op.make_name(); |
| 19 | DTypeScalar scalar(op.dtype); |
| 20 | scalar.set_retain_dtype(op.value); |
| 21 | auto graph = inputs[0]->owner_graph(); |
| 22 | auto scalar_shape = opr::ImmutableTensor::make(*graph, scalar, {name, comp_node}); |
| 23 | return opr::Broadcast::make(scalar_shape, inputs[0], {name}); |
| 24 | } |
| 25 | |
| 26 | std::tuple<SmallVector<LogicalTensorDesc>, bool> infer_output_attrs_fallible( |
| 27 | const OpDef& def, const SmallVector<LogicalTensorDesc>& inputs) { |
nothing calls this directly
no test coverage detected