MCPcopy Create free account
hub / github.com/Tencent/embedx / EmbedInstanceReader

Class EmbedInstanceReader

src/model/embed_instance_reader.h:32–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30using ::deepx_core::InstanceReaderImpl;
31
32class EmbedInstanceReader : public InstanceReaderImpl {
33 protected:
34 const GraphClient* graph_client_ = nullptr;
35 const DeepClient* deep_client_ = nullptr;
36
37 LineParser line_parser_;
38
39 public:
40 virtual bool InitGraphClient(const GraphClient* graph_client);
41 virtual bool InitDeepClient(const DeepClient* deep_client);
42 virtual void PostInit(const std::string& /*node_config*/) {}
43
44 bool Open(const std::string& file) override {
45 return line_parser_.Open(file);
46 }
47
48 protected:
49 template <typename ValueType>
50 bool NextInstanceBatch(Instance* inst, int batch,
51 std::vector<ValueType>* values) {
52 if (!line_parser_.NextBatch<ValueType>(batch, values)) {
53 line_parser_.Close();
54 inst->clear_batch();
55 return false;
56 }
57 return true;
58 }
59
60 // InstanceReaderImpl
61 void InitX(Instance* /* inst */) override {}
62 void InitXBatch(Instance* /*inst*/) override {}
63 bool ParseLine() override { return true; }
64};
65
66std::unique_ptr<EmbedInstanceReader> NewEmbedInstanceReader(
67 const std::string& name);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected