{"action":"created","issue":{"url":"https://api.github.com/repos/PaddlePaddle/Paddle/issues/12028","repository_url":"https://api.github.com/repos/PaddlePaddle/Paddle","labels_url":"https://api.github.com/repos/PaddlePaddle/Paddle/issues/12028/labels{/name}","comments_url":"https://api.github.com/repos/PaddlePaddle/Paddle/issues/12028/comments","events_url":"https://api.github.com/repos/PaddlePaddle/Paddle/issues/12028/events","html_url":"https://github.com/PaddlePaddle/Paddle/issues/12028","id":339225772,"node_id":"MDU6SXNzdWUzMzkyMjU3NzI=","number":12028,"title":"library interface binary compatibility","user":{"login":"panyx0718","id":2887803,"node_id":"MDQ6VXNlcjI4ODc4MDM=","avatar_url":"https://avatars0.githubusercontent.com/u/2887803?v=4","gravatar_id":"","url":"https://api.github.com/users/panyx0718","html_url":"https://github.com/panyx0718","followers_url":"https://api.github.com/users/panyx0718/followers","following_url":"https://api.github.com/users/panyx0718/following{/other_user}","gists_url":"https://api.github.com/users/panyx0718/gists{/gist_id}","starred_url":"https://api.github.com/users/panyx0718/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/panyx0718/subscriptions","organizations_url":"https://api.github.com/users/panyx0718/orgs","repos_url":"https://api.github.com/users/panyx0718/repos","events_url":"https://api.github.com/users/panyx0718/events{/privacy}","received_events_url":"https://api.github.com/users/panyx0718/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"Superjomn","id":328693,"node_id":"MDQ6VXNlcjMyODY5Mw==","avatar_url":"https://avatars1.githubusercontent.com/u/328693?v=4","gravatar_id":"","url":"https://api.github.com/users/Superjomn","html_url":"https://github.com/Superjomn","followers_url":"https://api.github.com/users/Superjomn/followers","following_url":"https://api.github.com/users/Superjomn/following{/other_user}","gists_url":"https://api.github.com/users/Superjomn/gists{/gist_id}","starred_url":"https://api.github.com/users/Superjomn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Superjomn/subscriptions","organizations_url":"https://api.github.com/users/Superjomn/orgs","repos_url":"https://api.github.com/users/Superjomn/repos","events_url":"https://api.github.com/users/Superjomn/events{/privacy}","received_events_url":"https://api.github.com/users/Superjomn/received_events","type":"User","site_admin":false},"assignees":[{"login":"Superjomn","id":328693,"node_id":"MDQ6VXNlcjMyODY5Mw==","avatar_url":"https://avatars1.githubusercontent.com/u/328693?v=4","gravatar_id":"","url":"https://api.github.com/users/Superjomn","html_url":"https://github.com/Superjomn","followers_url":"https://api.github.com/users/Superjomn/followers","following_url":"https://api.github.com/users/Superjomn/following{/other_user}","gists_url":"https://api.github.com/users/Superjomn/gists{/gist_id}","starred_url":"https://api.github.com/users/Superjomn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Superjomn/subscriptions","organizations_url":"https://api.github.com/users/Superjomn/orgs","repos_url":"https://api.github.com/users/Superjomn/repos","events_url":"https://api.github.com/users/Superjomn/events{/privacy}","received_events_url":"https://api.github.com/users/Superjomn/received_events","type":"User","site_admin":false},{"login":"reyoung","id":728699,"node_id":"MDQ6VXNlcjcyODY5OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/728699?v=4","gravatar_id":"","url":"https://api.github.com/users/reyoung","html_url":"https://github.com/reyoung","followers_url":"https://api.github.com/users/reyoung/followers","following_url":"https://api.github.com/users/reyoung/following{/other_user}","gists_url":"https://api.github.com/users/reyoung/gists{/gist_id}","starred_url":"https://api.github.com/users/reyoung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reyoung/subscriptions","organizations_url":"https://api.github.com/users/reyoung/orgs","repos_url":"https://api.github.com/users/reyoung/repos","events_url":"https://api.github.com/users/reyoung/events{/privacy}","received_events_url":"https://api.github.com/users/reyoung/received_events","type":"User","site_admin":false},{"login":"panyx0718","id":2887803,"node_id":"MDQ6VXNlcjI4ODc4MDM=","avatar_url":"https://avatars0.githubusercontent.com/u/2887803?v=4","gravatar_id":"","url":"https://api.github.com/users/panyx0718","html_url":"https://github.com/panyx0718","followers_url":"https://api.github.com/users/panyx0718/followers","following_url":"https://api.github.com/users/panyx0718/following{/other_user}","gists_url":"https://api.github.com/users/panyx0718/gists{/gist_id}","starred_url":"https://api.github.com/users/panyx0718/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/panyx0718/subscriptions","organizations_url":"https://api.github.com/users/panyx0718/orgs","repos_url":"https://api.github.com/users/panyx0718/repos","events_url":"https://api.github.com/users/panyx0718/events{/privacy}","received_events_url":"https://api.github.com/users/panyx0718/received_events","type":"User","site_admin":false}],"milestone":null,"comments":0,"created_at":"2018-07-08T13:26:18Z","updated_at":"2018-07-09T04:10:15Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"```\r\nclass PaddlePredictor {\r\n public:\r\n  struct Config;\r\n  PaddlePredictor() = default;\r\n  PaddlePredictor(const PaddlePredictor&) = delete;\r\n  PaddlePredictor& operator=(const PaddlePredictor&) = delete;\r\n\r\n  // Predict an record.\r\n  // The caller should be responsible for allocating and releasing the memory of\r\n  // `inputs`. `inputs` should be available until Run returns. Caller should be\r\n  // responsible for the output tensor's buffer, either allocated or passed from\r\n  // outside.\r\n  virtual bool Run(const std::vector<PaddleTensor>& inputs,\r\n                   std::vector<PaddleTensor>* output_data) = 0;\r\n\r\n  // Clone a predictor that share the model weights, the Cloned predictor should\r\n  // be thread-safe.\r\n  virtual std::unique_ptr<PaddlePredictor> Clone() = 0;\r\n\r\n  // Destroy the Predictor.\r\n  virtual ~PaddlePredictor() = default;\r\n\r\n  // The common configs for all the predictors.\r\n  struct Config {\r\n    std::string model_dir;  // path to the model directory.\r\n  };\r\n};\r\n```\r\n\r\nPerhaps we are not at this stage yet, but it's worth thinking about it\r\nIt would be great if user can upgrade our library (shared) without re-compiling their codes.\r\nhttps://events.static.linuxfound.org/sites/events/files/slides/Binary_Compatibility_for_library_devs.pdf\r\n\r\nvirtual method in C++ (Or C++ in general) might cause some binary compatibility issues.\r\nmight need binary compatibility checker in CI at some point."},"comment":{"url":"https://api.github.com/repos/PaddlePaddle/Paddle/issues/comments/403354452","html_url":"https://github.com/PaddlePaddle/Paddle/issues/12028#issuecomment-403354452","issue_url":"https://api.github.com/repos/PaddlePaddle/Paddle/issues/12028","id":403354452,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMzM1NDQ1Mg==","user":{"login":"reyoung","id":728699,"node_id":"MDQ6VXNlcjcyODY5OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/728699?v=4","gravatar_id":"","url":"https://api.github.com/users/reyoung","html_url":"https://github.com/reyoung","followers_url":"https://api.github.com/users/reyoung/followers","following_url":"https://api.github.com/users/reyoung/following{/other_user}","gists_url":"https://api.github.com/users/reyoung/gists{/gist_id}","starred_url":"https://api.github.com/users/reyoung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reyoung/subscriptions","organizations_url":"https://api.github.com/users/reyoung/orgs","repos_url":"https://api.github.com/users/reyoung/repos","events_url":"https://api.github.com/users/reyoung/events{/privacy}","received_events_url":"https://api.github.com/users/reyoung/received_events","type":"User","site_admin":false},"created_at":"2018-07-09T04:10:15Z","updated_at":"2018-07-09T04:10:15Z","author_association":"CONTRIBUTOR","body":"It is very hard to keep ABI unchanged when using virtual methods.\r\n\r\nThe common way to expose C++ API is using Pimpl style classes and not to use any virtual methods."}}
{"actor":{"display_login":"reyoung"}}