| 225 | } |
| 226 | |
| 227 | void CpuDepthwiseConv2d::CpuDepthwiseConv2dOptimizedInternal::prepare(ITensorPack &tensors) |
| 228 | { |
| 229 | // if weights are not constant then we need to repack so that weights |
| 230 | // can be updated in-place |
| 231 | if (!_are_weights_const) |
| 232 | { |
| 233 | auto weights = tensors.get_const_tensor(TensorType::ACL_SRC_1); |
| 234 | auto bias = tensors.get_const_tensor(TensorType::ACL_SRC_2); |
| 235 | auto packed_weights = tensors.get_tensor(TensorType::ACL_INT_4); |
| 236 | |
| 237 | ITensorPack pack_opt; |
| 238 | pack_opt.add_tensor(TensorType::ACL_SRC_1, weights); |
| 239 | pack_opt.add_tensor(TensorType::ACL_SRC_2, bias); |
| 240 | pack_opt.add_tensor(TensorType::ACL_INT_1, packed_weights); |
| 241 | |
| 242 | // Prepare optimized function |
| 243 | _dwc_optimized_func->prepare(pack_opt); |
| 244 | |
| 245 | return; |
| 246 | } |
| 247 | |
| 248 | if (!_is_prepared) |
| 249 | { |
| 250 | auto weights = tensors.get_const_tensor(TensorType::ACL_SRC_1); |
| 251 | auto bias = tensors.get_const_tensor(TensorType::ACL_SRC_2); |
| 252 | auto packed_weights = tensors.get_tensor(TensorType::ACL_INT_4); |
| 253 | |
| 254 | // Permute weights |
| 255 | if (_permute) |
| 256 | { |
| 257 | auto permuted_weights = tensors.get_tensor(TensorType::ACL_INT_1); |
| 258 | |
| 259 | ITensorPack pack; |
| 260 | pack.add_tensor(TensorType::ACL_SRC, weights); |
| 261 | pack.add_tensor(TensorType::ACL_DST, permuted_weights); |
| 262 | _permute_weights->run(pack); |
| 263 | |
| 264 | weights->mark_as_unused(); |
| 265 | |
| 266 | ITensorPack pack_opt; |
| 267 | pack_opt.add_const_tensor(TensorType::ACL_SRC_1, permuted_weights); |
| 268 | pack_opt.add_tensor(TensorType::ACL_SRC_2, bias); |
| 269 | pack_opt.add_tensor(TensorType::ACL_INT_1, packed_weights); |
| 270 | |
| 271 | // Prepare optimized function |
| 272 | _dwc_optimized_func->prepare(pack_opt); |
| 273 | } |
| 274 | else |
| 275 | { |
| 276 | ITensorPack pack_opt; |
| 277 | pack_opt.add_tensor(TensorType::ACL_SRC_1, weights); |
| 278 | pack_opt.add_tensor(TensorType::ACL_SRC_2, bias); |
| 279 | pack_opt.add_tensor(TensorType::ACL_INT_1, packed_weights); |
| 280 | |
| 281 | // Prepare optimized function |
| 282 | _dwc_optimized_func->prepare(pack_opt); |
| 283 | } |
| 284 |
nothing calls this directly
no test coverage detected