MCPcopy Create free account
hub / github.com/MegEngine/MegCC / IsAvailable

Method IsAvailable

compiler/lib/KernelGen/BareMetal/Resize.cpp:15–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13using namespace BareMetal;
14
15bool ResizeKernel::IsAvailable(TContext* context) const {
16 auto src_dtype = context->getAttrOprand("operand:0").dtype;
17 bool dtype_ok = src_dtype == "f32";
18 bool mode_ok = context->getAttrStr("imode") == "LINEAR" ||
19 context->getAttrStr("imode") == "NEAREST";
20
21 bool format_ok = context->getAttrStr("format") == "NCHW" ||
22 (context->getAttrStr("format") == "NCHW44" &&
23 context->getAttrStr("imode") == "LINEAR");
24 return dtype_ok && mode_ok && format_ok;
25}
26//! kernel gen
27std::string ResizeKernel::GetKernelSymbol(TContext* context) const {
28 std::stringstream ss;

Callers

nothing calls this directly

Calls 2

getAttrOprandMethod · 0.80
getAttrStrMethod · 0.80

Tested by

no test coverage detected