MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / SbpGetState

Function SbpGetState

oneflow/api/python/symbol/sbp_symbol.cpp:62–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62Maybe<std::pair<std::string, int>> SbpGetState(const Symbol<SbpParallel>& sbp) {
63 if (sbp->has_broadcast_parallel()) {
64 return std::make_shared<std::pair<std::string, int>>("B", -1);
65 } else if (sbp->has_partial_sum_parallel()) {
66 return std::make_shared<std::pair<std::string, int>>("P", -1);
67 } else if (sbp->has_split_parallel()) {
68 return std::make_shared<std::pair<std::string, int>>("S", sbp->split_parallel().axis());
69 } else {
70 return Error::RuntimeError() << "Invalid sbp signature: " << sbp->DebugString();
71 }
72}
73
74Maybe<Symbol<SbpParallel>> GetSbpFromState(const std::pair<std::string, int>& state) {
75 if (state.first == "B") {

Callers 1

sbp_symbol.cppFile · 0.85

Calls 1

DebugStringMethod · 0.45

Tested by

no test coverage detected