/*! * Copyright (c) 2019 by Contributors * \file graph/serialize/dglgraph_data.h * \brief Graph serialization header */ #ifndef DGL_GRAPH_SERIALIZE_DGLGRAPH_DATA_H_ #define DGL_GRAPH_SERIALIZE_DGLGRAPH_DATA_H_ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "../../c_api_common.h" using dgl::ImmutableGraph; using dgl::runtime::NDArray; using namespace dgl::runtime; namespace dgl { namespace serialize { typedef std::pair NamedTensor; class GraphDataObject : public runtime::Object { public: ImmutableGraphPtr gptr; std::vector node_tensors; std::vector edge_tensors; static constexpr const char *_type_key = "graph_serialize.GraphData"; void SetData( ImmutableGraphPtr gptr, Map node_tensors, Map edge_tensors); void Save(dmlc::Stream *fs) const; bool Load(dmlc::Stream *fs); DGL_DECLARE_OBJECT_TYPE_INFO(GraphDataObject, runtime::Object); }; class GraphData : public runtime::ObjectRef { public: DGL_DEFINE_OBJECT_REF_METHODS(GraphData, runtime::ObjectRef, GraphDataObject); /*! \brief create a new GraphData reference */ static GraphData Create() { return GraphData(std::make_shared()); } }; ImmutableGraphPtr ToImmutableGraph(GraphPtr g); } // namespace serialize } // namespace dgl #endif // DGL_GRAPH_SERIALIZE_DGLGRAPH_DATA_H_