MLBEDSW-4070: Addresses errors with the LeakyReLU operator.
LeakyReLU IFMs will now have unique addresses
and the alpha tensor will have correct scaling.
Signed-off-by: erik.andersson@arm.com <erik.andersson@arm.com>
Change-Id: If94fa91a0b61175309ac450bf6b38a63362780ab
diff --git a/ethosu/vela/graph_optimiser.py b/ethosu/vela/graph_optimiser.py
index 4e7c0fd..1e890bb 100644
--- a/ethosu/vela/graph_optimiser.py
+++ b/ethosu/vela/graph_optimiser.py
@@ -937,12 +937,13 @@
scalar = 0
else:
quantization.scale_f32 = alpha
- scalar = 1
+ scalar = alpha
alpha_tens = create_const_tensor(
- op.name + "_alpha_scalar", [], ifm.dtype, [scalar], np.int8, quantization=quantization
+ op.name + "_alpha_scalar", [], ifm.dtype, [scalar], np.float32, quantization=quantization
)
+ alpha_tens.quant_values = np.array([1])
mul_alpha.add_input_tensor(alpha_tens)
- fm_alpha = ofm.clone(op.name + "_alpha")
+ fm_alpha = ofm.clone(op.name + "_alpha", set_unique=True)
mul_alpha.set_output_tensor(fm_alpha)
mul_alpha.set_ifm_ofm_shapes()
DebugDatabase.add_optimised(op, mul_alpha)