Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nn.Graph python #5309

Merged
merged 41 commits into from
Jul 7, 2021
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
6ce8c1f
graph api
strint Jun 22, 2021
f614f31
add graph dummy test
strint Jun 23, 2021
adf991a
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
strint Jun 23, 2021
6e85a1c
add test
strint Jun 23, 2021
18da328
add recursive module mode
strint Jun 23, 2021
228897f
graph.build test pass
strint Jun 23, 2021
b169806
add detail check on graph inner node
strint Jun 24, 2021
a7540ea
support config and train
strint Jun 24, 2021
b4d15ac
add repr for debug
strint Jun 24, 2021
f0284e5
test buffer
strint Jun 24, 2021
ca533f5
test buffer add
strint Jun 24, 2021
9a16d33
refine test
strint Jun 24, 2021
efe33cc
add comment
strint Jun 28, 2021
f8cb919
refine test
strint Jun 29, 2021
1fcf033
refactor Node to Block
strint Jul 1, 2021
7ecd08a
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
strint Jul 1, 2021
d2bad79
add named_state
strint Jul 1, 2021
8717b38
refine Graph.named_state()
strint Jul 1, 2021
ba8c638
add state_tensortuple
strint Jul 1, 2021
8243288
graph._compile()
strint Jul 1, 2021
da86d05
add mc session 0
strint Jul 4, 2021
a627625
nn.graph: state tuple to private var; add BlockType; add simple multi…
strint Jul 4, 2021
2b5c87f
NNGraphIf
lixinqi Jul 5, 2021
6d768b7
Merge branch 'master' into nn_graph
oneflow-ci-bot Jul 5, 2021
7e26236
rm old graph.cpp
strint Jul 5, 2021
19a5d4d
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
strint Jul 5, 2021
05a8dca
Merge branch 'nn_graph' of https://github.com/Oneflow-Inc/oneflow int…
strint Jul 5, 2021
bbf0ace
nn.graph: add cpp NNGraph; export and call NNGraph
strint Jul 5, 2021
9449745
add comment
strint Jul 5, 2021
3623191
nn.Graph: rm prototype MultiClientSession
strint Jul 6, 2021
3167ded
nn.Graph: rm prototype MultiClientSession test
strint Jul 6, 2021
c359204
nn.Graph: add TODO
strint Jul 6, 2021
64227c4
nn.Graph: format for review
strint Jul 6, 2021
696aa17
merge master
strint Jul 6, 2021
cae2759
nn.Graph: format
strint Jul 6, 2021
4e36ffa
nn.Graph: format
strint Jul 6, 2021
6f8f0c9
Merge branch 'master' into dev_graph
strint Jul 6, 2021
e4a5036
nn.Graph: pass flake8 check
strint Jul 6, 2021
804fd6b
Merge branch 'dev_graph' of https://github.com/Oneflow-Inc/oneflow in…
strint Jul 6, 2021
7514fa0
Merge branch 'master' into dev_graph
strint Jul 6, 2021
5950bc2
Merge branch 'master' into dev_graph
chengtbf Jul 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 30 additions & 0 deletions oneflow/api/python/framework/nn_graph.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
Copyright 2020 The OneFlow Authors. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include <pybind11/pybind11.h>
#include <string>
#include "oneflow/api/python/of_api_registry.h"
#include "oneflow/core/framework/nn_graph_if.h"

namespace py = pybind11;

namespace oneflow {
ONEFLOW_API_PYBIND11_MODULE("", m) {
using namespace oneflow;
py::class_<NNGraph, std::shared_ptr<NNGraph>>(m, "NNGraph")
.def(py::init<const std::string&>())
.def_property_readonly("name", &NNGraph::job_name);
}
} // namespace oneflow
8 changes: 7 additions & 1 deletion oneflow/core/framework/nn_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,11 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
#include "oneflow/core/framework/nn_graph_if.h"
#include "oneflow/core/common/util.h"
namespace oneflow {

namespace oneflow {}
const std::vector<std::string>& NNGraph::inputs_op_names() const { UNIMPLEMENTED(); }

const std::vector<std::string>& NNGraph::outputs_op_names() const { UNIMPLEMENTED(); }

} // namespace oneflow
13 changes: 13 additions & 0 deletions oneflow/core/framework/nn_graph_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ class NNGraphIf {
NNGraphIf() = default;
};

class NNGraph final : public NNGraphIf {
public:
NNGraph() = delete;
explicit NNGraph(const std::string& name) : name_(name) {}

const std::string& job_name() const { return name_; }
const std::vector<std::string>& inputs_op_names() const;
const std::vector<std::string>& outputs_op_names() const;

private:
std::string name_;
};

} // namespace oneflow

#endif // ONEFLOW_CORE_FRAMEWORK_NN_GRAPH_IF_H_