trainer_context.h 948 字节
Newer Older
X
xiexionghang 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#pragma once
#include <string>
#include <memory>
#include <vector>
#include <yaml-cpp/yaml.h>
#include "paddle/fluid/platform/place.h"
#include "paddle/fluid/train/custom_trainer/feed/common/runtime_environment.h"


namespace paddle {
namespace custom_trainer {
namespace feed {

class Process;
X
xiexionghang 已提交
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
class EpochAccessor;

enum class ModelSaveWay {
    ModelSaveTrainCheckpoint = 0,
    ModelSaveInferenceDelta = 1,
    ModelSaveInferenceBase = 2
};

class TableMeta {
public:
    TableMeta() {}
    ~TableMeta() {}
    int table_id() {
        return _id;
    }
private:
    int _id;
};
X
xiexionghang 已提交
33 34 35 36 37

class TrainerContext {
public:
YAML::Node trainer_config;
paddle::platform::CPUPlace cpu_place;
X
xiexionghang 已提交
38 39
std::vector<TableMeta> params_table_list;
std::shared_ptr<EpochAccessor> epoch_accessor;
X
xiexionghang 已提交
40 41 42 43 44 45 46
std::shared_ptr<RuntimeEnvironment> environment;
std::vector<std::shared_ptr<Process>> process_list;
};

}  // namespace feed
}  // namespace custom_trainer
}  // namespace paddle