From 27c9efb922832e5e6785a492e84a46934d9a47f8 Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Mon, 9 Oct 2017 15:46:30 +0100 Subject: COMPMID-554 Add Nodes - BatchNormalization - DepthConvert - Dequantization - Flatten - Quantization - Reshape Change-Id: Ie01a04b7a6cc8e2b5481cf2345268e6871580d7f Reviewed-on: http://mpd-gerrit.cambridge.arm.com/91618 Tested-by: Kaizen Reviewed-by: Anthony Barbier --- src/graph/nodes/BatchNormalizationLayer.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/graph/nodes/BatchNormalizationLayer.cpp') diff --git a/src/graph/nodes/BatchNormalizationLayer.cpp b/src/graph/nodes/BatchNormalizationLayer.cpp index bce19016d7..a433f39dc4 100644 --- a/src/graph/nodes/BatchNormalizationLayer.cpp +++ b/src/graph/nodes/BatchNormalizationLayer.cpp @@ -56,6 +56,11 @@ std::unique_ptr BatchNormalizationLayer::instantiate_nod _gamma.set_info(TensorInfo(TensorShape(batch_norm_size), in->info()->num_channels(), in->info()->data_type(), in->info()->fixed_point_position())); } + bool mean_is_loaded = _mean.tensor() != nullptr; + bool var_is_loaded = _var.tensor() != nullptr; + bool gamma_is_loaded = _gamma.tensor() != nullptr; + bool beta_is_loaded = _beta.tensor() != nullptr; + // Create node context NodeContext node_ctx(OperationType::BatchNormalizationLayer); node_ctx.set_target(_target_hint); @@ -67,6 +72,24 @@ std::unique_ptr BatchNormalizationLayer::instantiate_nod node_ctx.add_output(out); node_ctx.add_parameter("epsilon", _epsilon); + // Fill tensors + if(!mean_is_loaded) + { + _mean.allocate_and_fill_if_needed(); + } + if(!var_is_loaded) + { + _var.allocate_and_fill_if_needed(); + } + if(!gamma_is_loaded) + { + _gamma.allocate_and_fill_if_needed(); + } + if(!beta_is_loaded) + { + _beta.allocate_and_fill_if_needed(); + } + // Get function return OperationRegistry::get().find_operation(OperationType::BatchNormalizationLayer, _target_hint)->configure(node_ctx); } \ No newline at end of file -- cgit v1.2.1