data_reader.cc 21.4 KB
Newer Older
R
rensilin 已提交
1 2 3
#include "paddle/fluid/train/custom_trainer/feed/dataset/data_reader.h"

#include <cstdio>
R
openmp  
rensilin 已提交
4
#include <atomic>
R
rensilin 已提交
5 6

#include <glog/logging.h>
R
rensilin 已提交
7
#include <omp.h>
R
rensilin 已提交
8

R
rensilin 已提交
9
#include "paddle/fluid/train/custom_trainer/feed/io/file_system.h"
R
rensilin 已提交
10 11 12 13 14

namespace paddle {
namespace custom_trainer {
namespace feed {

R
rensilin 已提交
15
class LineDataParser : public DataParser {
R
rensilin 已提交
16 17 18 19 20 21 22 23 24 25 26
public:
    LineDataParser() {}

    virtual ~LineDataParser() {}

    virtual int initialize(const YAML::Node& config, std::shared_ptr<TrainerContext> context) {
        return 0;
    }

    virtual int parse(const char* str, size_t len, DataItem& data) const {
        size_t pos = 0;
R
rensilin 已提交
27
        while (pos < len && str[pos] != ' ') {
R
rensilin 已提交
28 29
            ++pos;
        }
R
rensilin 已提交
30
        if (pos >= len) {
R
rensilin 已提交
31
            VLOG(2) << "fail to parse line: " << std::string(str, len) << ", strlen: " << len;
R
rensilin 已提交
32 33
            return -1;
        }
R
rensilin 已提交
34
        VLOG(5) << "getline: " << str << " , pos: " << pos << ", len: " << len;
R
rensilin 已提交
35 36 37 38 39 40 41
        data.id.assign(str, pos);
        data.data.assign(str + pos + 1, len - pos - 1);
        return 0;
    }

    virtual int parse(const char* str, DataItem& data) const {
        size_t pos = 0;
R
rensilin 已提交
42
        while (str[pos] != '\0' && str[pos] != ' ') {
R
rensilin 已提交
43 44
            ++pos;
        }
R
rensilin 已提交
45
        if (str[pos] == '\0') {
R
rensilin 已提交
46
            VLOG(2) << "fail to parse line: " << str << ", get '\\0' at pos: " << pos;
R
rensilin 已提交
47 48
            return -1;
        }
R
rensilin 已提交
49
        VLOG(5) << "getline: " << str << " , pos: " << pos;
R
rensilin 已提交
50 51 52 53 54 55 56 57 58 59 60
        data.id.assign(str, pos);
        data.data.assign(str + pos + 1);
        return 0;
    }

    virtual int parse_to_sample(const DataItem& data, SampleInstance& instance) const {
        return 0;
    }
};
REGISTER_CLASS(DataParser, LineDataParser);

W
wangyihong01 已提交
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432
/********************************
 * feasign压缩格式
 * 情形1:slot:hot
 * |4b|4b|4b|4b|4b| 28b |
 * |slot       |0 |sign |
 * 情形2:slot:hot*n
 * |4b|4b|4b|4b|4b|4b|4b|4b|32b*n|
 * |slot       |1 |0 |len  |sign |
 * 情形3:slot:cold
 * |4b|4b|4b|4b|4b|4b| 64b |
 * |slot       |2 |0 |sign |
 * 情形4:slot:cold*n
 * |4b|4b|4b|4b|4b|4b|4b|4b|64b*n|
 * |slot       |3 |0 |len  |sign |
 ********************************/
class ArchiveDataParse : public DataParser {
public:
    static const uint8_t HOT_SIGN_SIZE = 4;
    static const uint8_t COLD_SIGN_SIZE = 8;

public:
    ArchiveDataParse() {}
    virtual ~ArchiveDataParse() {}

    struct Record {
        int show, clk;
        std::string tags;
        std::map<std::string, std::vector<float>> vec_feas;
        int sample_type;
        std::map<std::string, std::vector<int>> auc_category_info_map; //为细维度计算auc准备的数据
        std::vector<FeatureItem> hot_feas, cold_feas; //冷(int32_t)热(uint64_t)feasign

        void clear() {
            show = 0;
            clk = 0;
            tags.clear();
            vec_feas.clear();
            sample_type = 0;
            auc_category_info_map.clear();
            hot_feas.clear();
            cold_feas.clear();
        }

        uint32_t calc_compress_feas_lens() const {
            uint32_t hot_len = hot_feas.size();
            uint32_t cold_len = cold_feas.size();
            uint32_t cursor = 0;
            int32_t pre_slot = -1;
            uint32_t k = 0;
            //热编码
            if (hot_len > 0) {
                pre_slot = hot_feas[0].slot();

                for (uint32_t i = 0; i < hot_len + 1; ++i) {
                    if (i == hot_len || pre_slot != hot_feas[i].slot()) {
                        cursor += 2;
                        //情形2
                        if (i - k > 1) {
                            cursor += 2;
                        }
                        //情形1/2
                        cursor += (HOT_SIGN_SIZE * (i - k));
                        k = i;
                    }
                    pre_slot = hot_feas[i].slot();
                }
            }
            //冷编码
            if (cold_len > 0) {
                pre_slot = cold_feas[0].slot();
                k = 0;

                for (uint32_t i = 0; i < cold_len + 1; ++i) {
                    if (i == cold_len || pre_slot != cold_feas[i].slot()) {
                        cursor += 2;
                        //情形4
                        if (i - k > 1) {
                            cursor += 2;
                        } else { //情形3
                            cursor++;
                        }
                        //情形3/4
                        cursor += (COLD_SIGN_SIZE * (i - k));
                        k = i;
                    }
                    pre_slot = cold_feas[i].slot();
                }
            }
            return cursor;
        }

        void parse_feas(char* buffer) const {
            if (buffer == nullptr) {
                return ;
            }
            uint32_t cursor = 0;
            uint32_t hot_len = hot_feas.size();
            uint32_t cold_len = cold_feas.size();
            int32_t pre_slot = -1;
            int32_t hot_sign;
            uint16_t slot;
            uint8_t flag = 0, len = 0;
            uint32_t k = 0;
            //热编码
            if (hot_len > 0) {
                pre_slot = hot_feas[0].slot();

                for (uint32_t i = 0; i < hot_len + 1; ++i) {
                    if (i == hot_len || pre_slot != hot_feas[i].slot()) {
                        memcpy(buffer + cursor, &pre_slot, 2);
                        cursor += 2;
                        //情形2
                        if (i - k > 1) {
                            flag = 0x10;
                            memcpy(buffer + cursor, &flag, 1);
                            cursor++;
                            len = i - k;
                            memcpy(buffer + cursor, &len, 1);
                            cursor++;
                        }
                        //情形1/2
                        for (uint32_t j = k; j < i; ++j) {
                            hot_sign = (int32_t) hot_feas[j].sign();
                            for (uint8_t b = 0; b < HOT_SIGN_SIZE; ++b) {
                                flag = (hot_sign >> ((HOT_SIGN_SIZE - b - 1) * 8)) & 0xFF;
                                memcpy(buffer + cursor, &flag, 1);
                                cursor++;
                            }
                        }
                        k = i;
                    }
                    pre_slot = hot_feas[i].slot();
                }
            }
            //冷编码
            if (cold_len > 0) {
                pre_slot = cold_feas[0].slot();
                k = 0;

                for (uint32_t i = 0; i < cold_len + 1; ++i) {
                    if (i == cold_len || pre_slot != cold_feas[i].slot()) {
                        memcpy(buffer + cursor, &pre_slot, 2);
                        cursor += 2;
                        //情形4
                        if (i - k > 1) {
                            flag = 0x30;
                            memcpy(buffer + cursor, &flag, 1);
                            cursor++;
                            len = i - k;
                            memcpy(buffer + cursor, &len, 1);
                            cursor++;
                        }
                        //情形3/4
                        for (uint32_t j = k; j < i; ++j) {
                            if (i - k == 1) {
                                flag = 0x20;
                                memcpy(buffer + cursor, &flag, 1);
                                cursor++;
                            }
                            memcpy(buffer + cursor, &cold_feas[j].sign(), COLD_SIGN_SIZE);
                            cursor += COLD_SIGN_SIZE;
                        }
                        k = i;
                    }
                    pre_slot = cold_feas[i].slot();
                }
            }
        }
    };

    virtual int initialize(const YAML::Node& config, std::shared_ptr<TrainerContext> context) {
        _index = context->cache_dict;

        return 0;
    }

    virtual int parse(const char* str, size_t len, DataItem& data) const {
        size_t pos = paddle::string::count_nonspaces(str);
        if (pos >= len) {
            VLOG(2) << "fail to parse line: " << std::string(str, len) << ", strlen: " << len;
            return -1;
        }
        VLOG(5) << "getline: " << str << " , pos: " << pos << ", len: " << len;
        data.id.assign(str, pos);
        str += pos;

        static thread_local std::vector<float> vec_feas;
        static thread_local Record rec;
        rec.clear();

        const char* line_end = str + len;
        char* cursor = NULL;
        CHECK((rec.show = (int)strtol(str, &cursor, 10), cursor != str));
        str = cursor;
        CHECK((rec.clk = (int)strtol(str, &cursor, 10), cursor != str));
        str = cursor;
        CHECK(rec.show >= 1 && rec.clk >= 0 && rec.clk <= rec.show);

        while (*(str += paddle::string::count_nonspaces(str)) != 0) {
            if (*str == '*') {
                str++;
                size_t len = paddle::string::count_nonspaces(str);
                std::string tag(str, str + len);
                rec.tags = tag;
                str += len;
            } else if (*str == '$') {
                str++;
                CHECK((rec.sample_type = (int)strtol(str, &cursor, 10), cursor != str))<<" sample type parse err:" << str;
                str = cursor;
            } else if (*str == '#') {
                str++;
                size_t len = std::find_if_not(str, line_end,
                                              [](char c) { return std::isalnum(c) != 0 || c == '_';}) - str;
                CHECK(len > 0 && *(str + len) == ':');
                std::string name(str, len);
                str += len;
                vec_feas.clear();
                while (*str == ':') {
                    float val = 0;
                    CHECK((val = strtof(str + 1, &cursor), cursor > str));
                    vec_feas.push_back(val);
                    str = cursor;
                }
                CHECK(rec.vec_feas.insert({name, vec_feas}).second);
            } else if (*str == '@') {
                str++;
                size_t len = paddle::string::count_nonspaces(str);
                std::string all_str(str, str + len);
                str += len;
                //category_name1=value1,value2,value3|category_name2=value1,value2|....
                std::vector<std::string> all_category_vec = paddle::string::split_string(all_str, "|");
                for (size_t i = 0; i < all_category_vec.size(); ++i) {
                    std::string& single_category_str = all_category_vec[i];
                    std::vector<std::string> str_vec = paddle::string::split_string(single_category_str, "=");
                    CHECK(str_vec.size() == 2);
                    /*std::string category_name = str_vec[0];
                    std::vector<int> category_info_vec = paddle::string::split_string<int>(str_vec[1], ",");
                    CHECK(category_info_vec.size() > 0);

                    CHECK(rec.auc_category_info_map.insert({category_name, category_info_vec}).second);*/
                }
            } else {
                uint64_t sign = 0;
                int slot = -1;
                CHECK((sign = (uint64_t) strtoull(str, &cursor, 10), cursor != str));
                str = cursor;
                CHECK(*str++ == ':');
                CHECK(!isspace(*str));
                CHECK((slot = (int) strtol(str, &cursor, 10), cursor != str)) << " format error: " << str;
                CHECK((uint16_t) slot == slot);
                str = cursor;

                int32_t compress_sign = _index->sign2index(sign);
                if (compress_sign < 0) {
                    rec.cold_feas.emplace_back(sign, (uint16_t)slot);
                } else {
                    rec.hot_feas.emplace_back(compress_sign, (uint16_t)slot);
                }
            }
        }

        paddle::framework::BinaryArchive bar;
        bar << rec.show;
        bar << rec.clk;
        bar << rec.tags;
        bar << rec.vec_feas;
        bar << rec.sample_type;
        bar << rec.auc_category_info_map;
        uint32_t feas_len = rec.calc_compress_feas_lens();
        bar << feas_len;
        bar.Resize(bar.Length() + feas_len);
        rec.parse_feas(bar.Cursor());
        data.data.assign(bar.Buffer(), bar.Length());

        return 0;
    }

    virtual int parse(const char* str, DataItem& data) const {

    }

    virtual int parse_to_sample(const DataItem& data, SampleInstance& instance) const {
        instance.id = data.id;
        if (data.data.empty()) {
            return -1;
        }

        //FIXME
        int show, clk;
        std::string tags;
        std::map<std::string, std::vector<float>> vec_feas;
        int sample_type;
        std::map<std::string, std::vector<int>> auc_category_info_map;
        uint32_t feas_len = 0;

        paddle::framework::BinaryArchive bar;
        bar.SetReadBuffer(const_cast<char*>(&data.data[0]), data.data.size(), nullptr);

        bar >> show;
        bar >> clk;
        bar >> tags;
        bar >> vec_feas;
        bar >> sample_type;
        bar >> auc_category_info_map;
        bar >> feas_len;
        parse_feas_to_ins(bar.Cursor(), feas_len, instance.features);

        return 0;
    }

private:
    void parse_feas_to_ins(char* buffer, uint32_t len, std::vector<FeatureItem>& ins) const {
        if (buffer == nullptr) {
            return ;
        }

        uint32_t cursor = 0;
        uint16_t slot;
        uint8_t flag;
        while (cursor < len) {
            memcpy(&slot, buffer + cursor, 2);
            cursor += 2;

            memcpy(&flag, buffer + cursor, 1);
            flag &= 0xF0;

            CHECK(flag == 0x00 || flag == 0x10|| flag == 0x20 || flag == 0x30);

            if (flag == 0x00 || flag == 0x10) {
                uint8_t len = 1;
                if (flag == 0x10) {
                    cursor++;
                    memcpy(&len, buffer + cursor, 1);
                    cursor++;
                }
                for (uint8_t i = 0; i < len; ++i) {
                    int32_t sign;
                    for (uint8_t j = 0; j < HOT_SIGN_SIZE; ++j) {
                        memcpy((char*)&sign + HOT_SIGN_SIZE-j-1, buffer + cursor, 1);
                        cursor++;
                    }

                    uint64_t sign64 = sign & 0x0FFFFFFF;
                    sign64 = _index->index2sign((int32_t)sign64);
                    ins.emplace_back(sign64, slot);
                }
            }

            if (flag == 0x20 || flag == 0x30) {
                uint8_t len = 1;
                cursor++;
                if (flag == 0x30) {
                    memcpy(&len, buffer + cursor, 1);
                    cursor++;
                }

                for (uint8_t i = 0; i < len; ++i) {
                    uint64_t sign64;
                    memcpy(&sign64, buffer + cursor, COLD_SIGN_SIZE);
                    cursor += COLD_SIGN_SIZE;
                    ins.emplace_back(sign64, slot);
                }
            }
        }
    }

private:
    std::shared_ptr<SignCacheDict> _index;

};
REGISTER_CLASS(DataParser, ArchiveDataParse);

R
rensilin 已提交
433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455
int DataReader::initialize(const YAML::Node& config, std::shared_ptr<TrainerContext> context) {
    _parser.reset(CREATE_CLASS(DataParser, config["parser"]["class"].as<std::string>()));
    if (_parser == nullptr) {
        VLOG(2) << "fail to get parser: " << config["parser"]["class"].as<std::string>();
        return -1;
    }
    if (_parser->initialize(config["parser"], context) != 0) {
        VLOG(2) << "fail to initialize parser" << config["parser"]["class"].as<std::string>();
        return -1;
    }
    _pipeline_cmd = config["pipeline_cmd"].as<std::string>();
    return 0;
}

class LineDataReader : public DataReader {
public:
    LineDataReader() {}
    virtual ~LineDataReader() {}
    virtual int initialize(const YAML::Node& config, std::shared_ptr<TrainerContext> context) {
        if (DataReader::initialize(config, context) != 0) {
            return -1;
        }
        _done_file_name = config["done_file"].as<std::string>();
R
rensilin 已提交
456
        _filename_prefix = config["filename_prefix"].as<std::string>("");
R
rensilin 已提交
457 458 459 460 461 462 463 464 465 466

        if (config["file_system"] && config["file_system"]["class"]) {
            _file_system.reset(
                    CREATE_CLASS(FileSystem, config["file_system"]["class"].as<std::string>()));
            if (_file_system == nullptr ||
                _file_system->initialize(config["file_system"], context) != 0) {
                VLOG(2) << "fail to create class: "
                        << config["file_system"]["class"].as<std::string>();
                return -1;
            }
X
xiexionghang 已提交
467 468
        } else if (context->file_system != nullptr) { 
            _file_system = context->file_system;
R
rensilin 已提交
469 470 471 472 473 474 475
        } else {
            _file_system.reset(CREATE_CLASS(FileSystem, "LocalFileSystem"));
            if (_file_system == nullptr || _file_system->initialize(YAML::Load(""), context) != 0) {
                VLOG(2) << "fail to init file system";
                return -1;
            }
        }
R
rensilin 已提交
476 477 478 479 480
        return 0;
    }

    //判断样本数据是否已就绪,就绪表明可以开始download
    virtual bool is_data_ready(const std::string& data_dir) {
R
rensilin 已提交
481 482
        auto done_file_path = _file_system->path_join(data_dir, _done_file_name);
        if (_file_system->exists(done_file_path)) {
R
rensilin 已提交
483 484 485 486 487
            return true;
        }
        return false;
    }

R
rensilin 已提交
488 489
    virtual std::vector<std::string> data_file_list(const std::string& data_dir) {
        std::vector<std::string> data_files;
R
rensilin 已提交
490 491
        for (auto& filepath : _file_system->list(data_dir)) {
            auto filename = _file_system->path_split(filepath).second;
R
rensilin 已提交
492 493
            if (filename != _done_file_name &&
                string::begin_with(filename, _filename_prefix)) {
R
rensilin 已提交
494 495 496 497 498 499
                data_files.push_back(std::move(filepath));
            }
        }
        return data_files;
    }

R
rensilin 已提交
500
    //读取数据样本流中
R
rensilin 已提交
501
    virtual int read_all(const std::string& data_dir, framework::Channel<DataItem> data_channel) {
X
xiexionghang 已提交
502 503 504 505
        auto file_list = data_file_list(data_dir);
        return read_all(file_list, data_channel);
    }
    virtual int read_all(const std::vector<std::string>& file_list, ::paddle::framework::Channel<DataItem> data_channel) {
R
fs_bug  
rensilin 已提交
506
        const int file_list_size = file_list.size();
R
openmp  
rensilin 已提交
507
        std::atomic<bool> is_failed(false);
R
rensilin 已提交
508

R
fs_bug  
rensilin 已提交
509 510 511 512 513 514 515
        const int max_threads = omp_get_max_threads();
        std::vector<framework::ChannelWriter<DataItem>> writers; // writer is not thread safe
        writers.reserve(max_threads);
        for (int i = 0; i < max_threads; ++i) {
            writers.emplace_back(data_channel.get());
        }
        VLOG(5) << "file_list: " << string::join_strings(file_list, ' ');
R
rensilin 已提交
516 517
        #pragma omp parallel for
        for (int i = 0; i < file_list_size; ++i) {
R
fs_bug  
rensilin 已提交
518 519 520 521 522 523 524 525
            if (is_failed) {
                continue;
            }
            const int thread_num = omp_get_thread_num();
            framework::ChannelWriter<DataItem> *writer = nullptr;
            if (thread_num < max_threads) {
                writer = &writers[thread_num];
            }
R
rensilin 已提交
526
            const auto& filepath = file_list[i];
R
fs_bug  
rensilin 已提交
527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542
            std::shared_ptr<FILE> fin = _file_system->open_read(filepath, _pipeline_cmd);
            if (fin == nullptr) {
                VLOG(2) << "fail to open file: " << filepath << ", with cmd: " << _pipeline_cmd;
                is_failed = true;
                continue;
            }
            char *buffer = nullptr;
            size_t buffer_size = 0;
            ssize_t line_len = 0;
            while ((line_len = getline(&buffer, &buffer_size, fin.get())) != -1) {
                // 去掉行位回车
                if (line_len > 0 && buffer[line_len - 1] == '\n') {
                    buffer[--line_len] = '\0';
                }
                // 忽略空行
                if (line_len <= 0) {
R
openmp  
rensilin 已提交
543
                    continue;
R
rensilin 已提交
544
                }
R
fix  
rensilin 已提交
545
                DataItem data_item;
R
fs_bug  
rensilin 已提交
546 547 548 549 550 551 552
                if (_parser->parse(buffer, line_len, data_item) == 0) {
                    VLOG(5) << "parse data: " << data_item.id << " " << data_item.data << ", filename: " << filepath << ", thread_num: " << thread_num << ", max_threads: " << max_threads;
                    if (writer == nullptr) {
                        if (!data_channel->Put(std::move(data_item))) {
                            VLOG(2) << "fail to put data, thread_num: " << thread_num;
                        }
                    } else {
R
rensilin 已提交
553
                        (*writer) << std::move(data_item);
R
rensilin 已提交
554
                    }
R
rensilin 已提交
555
                }
R
fs_bug  
rensilin 已提交
556 557 558 559 560 561 562 563 564 565
            }
            if (buffer != nullptr) {
                free(buffer);
                buffer = nullptr;
                buffer_size = 0;
            }
            if (ferror(fin.get()) != 0) {
                VLOG(2) << "fail to read file: " << filepath;
                is_failed = true;
                continue;
R
rensilin 已提交
566
            }
R
fix  
rensilin 已提交
567
            if (_file_system->err_no() != 0) {
R
rensilin 已提交
568
                _file_system->reset_err_no();
R
openmp  
rensilin 已提交
569 570
                is_failed = true;
                continue;
R
rensilin 已提交
571 572
            }
        }
R
fs_bug  
rensilin 已提交
573 574 575 576 577 578 579 580
        // omp end

        for (int i = 0; i < max_threads; ++i) {
            writers[i].Flush();
            if (!writers[i]) {
                VLOG(2) << "writer " << i << " is failed";
                is_failed = true;
            }
R
rensilin 已提交
581
        }
R
rensilin 已提交
582
        data_channel->Close();
R
openmp  
rensilin 已提交
583
        return is_failed ? -1 : 0;
R
rensilin 已提交
584 585 586 587 588
    }

    virtual const DataParser* get_parser() {
        return _parser.get();
    }
R
rensilin 已提交
589

R
rensilin 已提交
590
private:
R
openmp  
rensilin 已提交
591
    std::string _done_file_name;  // without data_dir
R
rensilin 已提交
592
    std::string _filename_prefix;
X
xiexionghang 已提交
593
    std::shared_ptr<FileSystem> _file_system;
R
rensilin 已提交
594 595 596
};
REGISTER_CLASS(DataReader, LineDataReader);

R
rensilin 已提交
597 598 599
}  // namespace feed
}  // namespace custom_trainer
}  // namespace paddle