• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2019-2021 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 
17 #ifndef MINDSPORE_CCSRC_MINDDATA_MINDRECORD_INCLUDE_SHARD_PK_SAMPLE_H_
18 #define MINDSPORE_CCSRC_MINDDATA_MINDRECORD_INCLUDE_SHARD_PK_SAMPLE_H_
19 
20 #include <memory>
21 #include <string>
22 #include <utility>
23 #include <vector>
24 #include "minddata/mindrecord/include/shard_operator.h"
25 #include "minddata/mindrecord/include/shard_shuffle.h"
26 #include "minddata/mindrecord/include/shard_category.h"
27 
28 namespace mindspore {
29 namespace mindrecord {
30 class MINDRECORD_API ShardPkSample : public ShardCategory {
31  public:
32   ShardPkSample(const std::string &category_field, int64_t num_elements, int64_t num_samples);
33 
34   ShardPkSample(const std::string &category_field, int64_t num_elements, int64_t num_categories, int64_t num_samples);
35 
36   ShardPkSample(const std::string &category_field, int64_t num_elements, int64_t num_categories, uint32_t seed,
37                 int64_t num_samples);
38 
~ShardPkSample()39   ~ShardPkSample() override{};
40 
41   Status SufExecute(ShardTaskList &tasks) override;
42 
GetNumSamples()43   int64_t GetNumSamples() const { return num_samples_; }
44 
45  private:
46   bool shuffle_;
47   std::shared_ptr<ShardShuffle> shuffle_op_;
48   int64_t num_samples_;
49 };
50 }  // namespace mindrecord
51 }  // namespace mindspore
52 
53 #endif  // MINDSPORE_CCSRC_MINDDATA_MINDRECORD_INCLUDE_SHARD_PK_SAMPLE_H_
54