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

Function parseScale

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

Source from the content-addressed store, hash-verified

22namespace nvcaffeparser1
23{
24ILayer* parseScale(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::ScaleParameter& p = msg.scale_param();
32 int C = parserutils::getC(tensors[msg.bottom(0)]->getDimensions());
33
34 Weights scale = weightFactory.isInitialized() ? weightFactory(msg.name(), WeightType::kGENERIC) : weightFactory.allocateWeights(C, std::uniform_real_distribution<float>(0.9F, 1.1F));
35 Weights shift = !p.has_bias_term() || p.bias_term() ? (weightFactory.isInitialized() ? weightFactory(msg.name(), WeightType::kBIAS) : weightFactory.allocateWeights(C)) : weightFactory.getNullWeights();
36 Weights power = weightFactory.getNullWeights();
37 weightFactory.convert(shift);
38 weightFactory.convert(scale);
39 weightFactory.convert(power);
40 return network.addScale(*tensors[msg.bottom(0)], ScaleMode::kCHANNEL, shift, scale, power);
41}
42} //namespace nvcaffeparser1

Callers

nothing calls this directly

Calls 9

checkBlobsFunction · 0.85
isInitializedMethod · 0.80
nameMethod · 0.80
allocateWeightsMethod · 0.80
getNullWeightsMethod · 0.80
addScaleMethod · 0.80
getCFunction · 0.50
getDimensionsMethod · 0.45
convertMethod · 0.45

Tested by

no test coverage detected