MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / parseReLU

Function parseReLU

parsers/caffe/caffeParser/opParsers/parseReLU.cpp:24–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22namespace nvcaffeparser1
23{
24ILayer* parseReLU(INetworkDefinition& network, const trtcaffe::LayerParameter& msg, CaffeWeightFactory& /*weightFactory*/, BlobNameToTensor& tensors)
25{
26 if (!checkBlobs(msg, 1, 1))
27 {
28 return nullptr;
29 }
30
31 const trtcaffe::ReLUParameter& p = msg.relu_param();
32
33 if (p.has_negative_slope() && p.negative_slope() != 0)
34 {
35 auto newLayer = network.addActivation(*tensors[msg.bottom(0)], ActivationType::kLEAKY_RELU);
36 newLayer->setAlpha(p.negative_slope());
37 return newLayer;
38 }
39 return network.addActivation(*tensors[msg.bottom(0)], ActivationType::kRELU);
40}
41} //namespace nvcaffeparser1

Callers

nothing calls this directly

Calls 3

checkBlobsFunction · 0.85
addActivationMethod · 0.80
setAlphaMethod · 0.45

Tested by

no test coverage detected