| 304 | } |
| 305 | |
| 306 | NodeID GraphBuilder::add_deconvolution_node(Graph &g, |
| 307 | NodeParams params, |
| 308 | NodeIdxPair input, |
| 309 | Size2D kernel_spatial_extend, |
| 310 | unsigned int depth, |
| 311 | PadStrideInfo deconv_info, |
| 312 | ITensorAccessorUPtr weights_accessor, |
| 313 | ITensorAccessorUPtr bias_accessor) |
| 314 | { |
| 315 | check_nodeidx_pair(input, g); |
| 316 | ARM_COMPUTE_ERROR_ON(depth == 0); |
| 317 | ARM_COMPUTE_ERROR_ON((kernel_spatial_extend.width == 0) || (kernel_spatial_extend.height == 0)); |
| 318 | |
| 319 | bool has_bias = (bias_accessor != nullptr); |
| 320 | |
| 321 | // Get input tensor descriptor |
| 322 | const TensorDescriptor input_tensor_desc = get_tensor_descriptor(g, g.node(input.node_id)->outputs()[0]); |
| 323 | const DataLayout input_data_layout = input_tensor_desc.layout; |
| 324 | |
| 325 | // Create weights node |
| 326 | TensorDescriptor w_desc = input_tensor_desc; |
| 327 | w_desc.shape.set(get_dimension_idx(input_data_layout, DataLayoutDimension::WIDTH), kernel_spatial_extend.width); |
| 328 | w_desc.shape.set(get_dimension_idx(input_data_layout, DataLayoutDimension::HEIGHT), kernel_spatial_extend.height); |
| 329 | w_desc.shape.set(get_dimension_idx(input_data_layout, DataLayoutDimension::CHANNEL), |
| 330 | get_dimension_size(input_tensor_desc, DataLayoutDimension::CHANNEL)); |
| 331 | w_desc.shape.set(get_dimension_idx(input_data_layout, DataLayoutDimension::BATCHES), depth); |
| 332 | |
| 333 | NodeID w_nid = add_const_node_with_name(g, params, "Weights", w_desc, std::move(weights_accessor)); |
| 334 | |
| 335 | // Create bias nodes |
| 336 | NodeID b_nid = EmptyNodeID; |
| 337 | if (has_bias) |
| 338 | { |
| 339 | TensorDescriptor b_desc = input_tensor_desc; |
| 340 | b_desc.shape = TensorShape(depth); |
| 341 | if (is_data_type_quantized_asymmetric(input_tensor_desc.data_type)) |
| 342 | { |
| 343 | b_desc.data_type = DataType::S32; |
| 344 | } |
| 345 | b_nid = add_const_node_with_name(g, params, "Bias", b_desc, std::move(bias_accessor)); |
| 346 | } |
| 347 | |
| 348 | // Create convolution node and connect |
| 349 | NodeID deconv_nid = g.add_node<DeconvolutionLayerNode>(descriptors::DeconvolutionLayerDescriptor{deconv_info}); |
| 350 | g.add_connection(input.node_id, input.index, deconv_nid, 0); |
| 351 | g.add_connection(w_nid, 0, deconv_nid, 1); |
| 352 | if (has_bias) |
| 353 | { |
| 354 | g.add_connection(b_nid, 0, deconv_nid, 2); |
| 355 | } |
| 356 | set_node_params(g, deconv_nid, params); |
| 357 | |
| 358 | return deconv_nid; |
| 359 | } |
| 360 | |
| 361 | NodeID GraphBuilder::add_concatenate_node(Graph &g, |
| 362 | NodeParams params, |
nothing calls this directly
no test coverage detected