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

Method enumv

src/custom/impl/tensor.cpp:124–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122}
123
124DeviceEnum Device::enumv(void) const {
125 mgb_assert(
126 DeviceImplRef(m_impl.get()).valid(),
127 "cannot get the enum value of invalid device");
128
129 auto builtin_device_type = DeviceImplRef(m_impl.get()).device_type();
130 auto&& dev_benum2cenum = DeviceMapper::inst().dev_benum2cenum;
131 auto iter = dev_benum2cenum.find(builtin_device_type);
132 mgb_assert(
133 iter != dev_benum2cenum.end(), "invalid device type %s\n",
134 DeviceImplRef(m_impl.get()).to_string().c_str());
135 return iter->second;
136}
137
138bool Device::is_legal(const std::string& device_type) {
139 auto&& dev_cstr2bstr = DeviceMapper::inst().dev_cstr2bstr;

Callers 15

dtype_mgb2np_rawFunction · 0.45
dtype_mgb2np_descrFunction · 0.45
get_dl_datatypeMethod · 0.45
_get_dtype_numFunction · 0.45
apply_on_var_nodeFunction · 0.45
apply_on_physical_tensorFunction · 0.45
make_paramMethod · 0.45
make_paramMethod · 0.45
make_paramMethod · 0.45
apply_transformationMethod · 0.45
to_lite_layoutMethod · 0.45

Calls 7

instFunction · 0.85
validMethod · 0.45
getMethod · 0.45
device_typeMethod · 0.45
findMethod · 0.45
endMethod · 0.45
to_stringMethod · 0.45

Tested by 7

apply_on_var_nodeFunction · 0.36
TESTFunction · 0.36
make_resnet18Method · 0.36
make_pyramidsFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36