| 1573 | } // namespace |
| 1574 | |
| 1575 | Maybe<Operator> ConstructAndInferOp(const OperatorConf& op_conf, |
| 1576 | const OpNodeSignature& upstream_signature, const Scope& scope) { |
| 1577 | const auto& parallel_desc = *JUST(scope.GetParallelDesc(op_conf)); |
| 1578 | bool is_local = scope.opt_local_parallel_conf().has_local_parallel(); |
| 1579 | const auto& op = JUST(ConstructOp(op_conf)); |
| 1580 | JUST(CheckOpInputSignature(*op, upstream_signature)); |
| 1581 | JUST(op->FillOpParallelDesc(parallel_desc)); |
| 1582 | HashMap<std::string, std::unique_ptr<BlobDesc>> bn_in_op2blob_desc; |
| 1583 | for (const auto& ibn : op->input_bns()) { |
| 1584 | const auto& map = upstream_signature.logical_blob_desc_signature().bn_in_op2blob_desc(); |
| 1585 | bn_in_op2blob_desc[ibn].reset(new BlobDesc(map.at(ibn))); |
| 1586 | } |
| 1587 | const auto& ConstBlobDesc4Ibn = [&](const std::string& ibn) -> const BlobDesc& { |
| 1588 | return *bn_in_op2blob_desc.at(ibn); |
| 1589 | }; |
| 1590 | JUST(op->FillLogicalInBlobDesc(ConstBlobDesc4Ibn)); |
| 1591 | // infer is_local |
| 1592 | JUST(InferLocalSignature(op.get(), upstream_signature, is_local, parallel_desc)); |
| 1593 | SbpSignature sbp_sig_conf; |
| 1594 | // iner sbp |
| 1595 | JUST(InferOpOutSbpParallel(op.get(), upstream_signature, ConstBlobDesc4Ibn, sbp_sig_conf, |
| 1596 | parallel_desc)); |
| 1597 | // infer logical blob_desc |
| 1598 | JUST(op->InferLogicalOutBlobDescsIf()); |
| 1599 | return op; |
| 1600 | } |
| 1601 | |
| 1602 | namespace { |
| 1603 |
nothing calls this directly
no test coverage detected