1 /**
2 * Copyright 2019 Huawei Technologies Co., Ltd
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 #include "minddata/dataset/engine/datasetops/pipeline_op.h"
17 #include <iostream>
18
19 namespace mindspore {
20 namespace dataset {
21 // Constructor
PipelineOp(int32_t op_connector_size,std::shared_ptr<SamplerRT> sampler)22 PipelineOp::PipelineOp(int32_t op_connector_size, std::shared_ptr<SamplerRT> sampler)
23 : DatasetOp(op_connector_size, sampler) {}
24
25 // A print method typically used for debugging
Print(std::ostream & out,bool show_all) const26 void PipelineOp::Print(std::ostream &out, bool show_all) const {
27 // Summary 1-liner print
28 if (!show_all) {
29 // Call super class printer
30 DatasetOp::Print(out, show_all);
31 out << " [workers: ";
32 if (this->inlined()) {
33 out << "0 (inlined)]";
34 } else {
35 out << "1]"; // Pipeline ops only have 1 worker
36 }
37 } else {
38 // Detailed print
39 DatasetOp::Print(out, show_all);
40 out << "\nNum workers: ";
41 if (this->inlined()) {
42 out << "0 (inlined)";
43 } else {
44 out << "1"; // Pipeline ops only have 1 worker
45 }
46 }
47 }
48 } // namespace dataset
49 } // namespace mindspore
50