| 22 | namespace nvcaffeparser1 |
| 23 | { |
| 24 | ILayer* 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 |
nothing calls this directly
no test coverage detected