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

Function GetTensorValidInCurRank

oneflow/core/framework/nn_graph.cpp:62–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60namespace {
61
62Maybe<bool> GetTensorValidInCurRank(const std::shared_ptr<one::Tensor>& tensor) {
63 if (tensor->is_global()) {
64 const auto& parallel_id = JUST(GetParallelId4CurrentProcessCtx(JUST(tensor->parallel_desc())));
65 if (parallel_id->has_value()) {
66 return true;
67 } else {
68 return false;
69 }
70 } else {
71 return true;
72 }
73}
74
75Maybe<std::string> GetTensorMetaString(const std::shared_ptr<one::Tensor>& tensor) {
76 std::string ret = "shape=" + tensor->shape()->ToString() + ", dtype=" + tensor->dtype()->name();

Calls 3

is_globalMethod · 0.45
parallel_descMethod · 0.45
has_valueMethod · 0.45

Tested by

no test coverage detected