MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / from_bytes

Method from_bytes

src/custom/impl/param.cpp:150–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150void Param::from_bytes(const std::string& bytes) {
151 std::map<std::string, ParamVal> ordered_vals(
152 TypedRef(ParamImpl, m_impl.get()).m_vals.begin(),
153 TypedRef(ParamImpl, m_impl.get()).m_vals.end());
154 size_t offset = 0;
155 for (auto& kv : ordered_vals) {
156 kv.second = ParamVal::from_bytes(bytes, offset);
157 }
158 TypedRef(ParamImpl, m_impl.get()).m_vals.clear();
159 TypedRef(ParamImpl, m_impl.get())
160 .m_vals.insert(ordered_vals.begin(), ordered_vals.end());
161 mgb_assert(offset == bytes.size(), "wrong data loader");
162}
163
164bool operator==(const Param& lhs, const Param& rhs) {
165 if (lhs.raw().size() != rhs.raw().size())

Callers 2

TESTFunction · 0.45
custom_loaderFunction · 0.45

Calls 6

beginMethod · 0.45
getMethod · 0.45
endMethod · 0.45
clearMethod · 0.45
insertMethod · 0.45
sizeMethod · 0.45

Tested by 1

TESTFunction · 0.36