Program Listing for File model_group.h
↰ Return to documentation for file (include/runtime/include/api/model_group.h
)
#ifndef MINDSPORE_INCLUDE_API_MODEL_GROUP_H
#define MINDSPORE_INCLUDE_API_MODEL_GROUP_H
#include <string>
#include <vector>
#include <map>
#include <memory>
#include <utility>
#include "include/api/model.h"
#include "include/api/status.h"
#include "include/api/types.h"
#include "include/api/context.h"
namespace mindspore {
class ModelGroupImpl;
enum class ModelGroupFlag : int {
kUnknown = 0x0000,
kShareWeight = 0x0001,
kShareWorkspace = 0x0002,
kShareWeightAndWorkspace = 0x0003,
};
class MS_API ModelGroup {
public:
explicit ModelGroup(ModelGroupFlag flags = ModelGroupFlag::kShareWorkspace);
~ModelGroup() = default;
inline Status AddModel(const std::vector<std::string> &model_path_list);
Status AddModel(const std::vector<std::pair<const void *, size_t>> &model_buff_list);
Status AddModel(const std::vector<Model> &model_list);
Status CalMaxSizeOfWorkspace(ModelType model_type, const std::shared_ptr<Context> &ms_context);
private:
std::shared_ptr<ModelGroupImpl> impl_;
Status AddModel(const std::vector<std::vector<char>> &model_path_list);
};
Status ModelGroup::AddModel(const std::vector<std::string> &model_path_list) {
std::vector<std::vector<char>> model_path_list_str;
for (auto str : model_path_list) {
model_path_list_str.push_back(StringToChar(str));
}
return AddModel(model_path_list_str);
}
} // namespace mindspore
#endif // MINDSPORE_INCLUDE_API_MODEL_GROUP_H