MCPcopy Create free account
hub / github.com/ARM-software/armnn / IsDepthwiseConvolutionSupported

Method IsDepthwiseConvolutionSupported

src/armnn/BackendHelper.cpp:472–524  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

470}
471
472bool LayerSupportHandle::IsDepthwiseConvolutionSupported(
473 const TensorInfo& input,
474 const TensorInfo& output,
475 const DepthwiseConvolution2dDescriptor& descriptor,
476 const TensorInfo& weights,
477 const Optional<TensorInfo>& biases,
478 Optional<std::string&> reasonIfUnsupported)
479{
480 TensorInfo biasesVal = biases.has_value() ? biases.value() : TensorInfo();
481 TensorInfos infos{input, output, weights, biasesVal};
482
483 Optional<const BackendOptions::BackendOption> capability ;
484 if (!m_BackendId.IsUndefined())
485 {
486 capability = GetCapability("NonConstWeights", m_BackendId);
487 if (!capability.has_value() || capability.value().GetValue().AsBool() == false)
488 {
489 if (!weights.IsConstant())
490 {
491 if (reasonIfUnsupported.has_value())
492 {
493 reasonIfUnsupported.value() =
494 "Backend is not capable of supporting dynamic weights (NonConstWeights) and "
495 "DepthwiseConvolution2d weights are set as dynamic (non constant). ";
496 }
497 return false;
498 }
499 if (descriptor.m_BiasEnabled && !biasesVal.IsConstant())
500 {
501 if (reasonIfUnsupported.has_value())
502 {
503 reasonIfUnsupported.value() =
504 "Backend is not capable of supporting dynamic biases (NonConstWeights) and "
505 "DepthwiseConvolution2d biases are set as dynamic (non constant). ";
506 }
507 return false;
508 }
509 // At the first stage we will only print a warning. this is to give
510 // backend developers a chance to adopt and read weights from input slots.
511 ARMNN_LOG(warning) << "The backend makes use of a deprecated interface to read constant tensors. "
512 "If you are a backend developer please find more information in our "
513 "doxygen documentation on github https://github.com/ARM-software/armnn "
514 "under the keyword 'ConstTensorsAsInputs'.";
515 }
516 }
517
518 return m_LayerSupport->IsLayerSupported(LayerType::DepthwiseConvolution2d,
519 infos,
520 descriptor,
521 EmptyOptional(),
522 EmptyOptional(),
523 reasonIfUnsupported);
524}
525
526bool LayerSupportHandle::IsDequantizeSupported(const TensorInfo& input,
527 const TensorInfo& output,

Callers

nothing calls this directly

Calls 10

GetCapabilityFunction · 0.85
IsUndefinedMethod · 0.80
AsBoolMethod · 0.80
IsConstantMethod · 0.80
TensorInfoClass · 0.50
EmptyOptionalClass · 0.50
has_valueMethod · 0.45
valueMethod · 0.45
GetValueMethod · 0.45
IsLayerSupportedMethod · 0.45

Tested by

no test coverage detected