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

Method Set

oneflow/core/framework/variable_tensor_mgr.cpp:27–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25namespace oneflow {
26
27Maybe<void> VariableTensorMgr::Set(const std::string& variable_op_name,
28 const std::shared_ptr<one::Tensor>& variable_tensor,
29 const Symbol<DType>& dtype) {
30 if (dtype && variable_tensor->dtype() != dtype) {
31 LazyMode::Guard guard{false};
32 variables_[variable_op_name] = JUST(one::functional::Cast(variable_tensor, dtype, false));
33 } else {
34 variables_[variable_op_name] = variable_tensor;
35 }
36 return Maybe<void>::Ok();
37}
38
39Maybe<one::Tensor> VariableTensorMgr::Get(const std::string& variable_op_name,
40 const Symbol<DType>& dtype) {

Callers 8

MaxByteSize4BlobDescSbpFunction · 0.45
Storage4NdSbpFunction · 0.45
GetSubLogicalShapeFunction · 0.45
InferShapeUnspecifiedDimFunction · 0.45
FOR_RANGEMethod · 0.45
operator()Method · 0.45
operator()Method · 0.45

Calls 2

CastClass · 0.50
dtypeMethod · 0.45

Tested by

no test coverage detected