From 72928d2217a8b76a69f1f28e2efe047b51b0fd79 Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Thu, 3 Sep 2020 13:00:31 +0000 Subject: [PATCH] Gradient stuff --- rgbAI/lib/func.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rgbAI/lib/func.py b/rgbAI/lib/func.py index 7a7d9b9..c47e1a8 100644 --- a/rgbAI/lib/func.py +++ b/rgbAI/lib/func.py @@ -48,5 +48,8 @@ class AIlib: print( "Max layer index: " + str(maxLayer) ) def gradient( cost1:float, cost2:float, inp1:np.array, inp2:np.array ): - return (cost2 - cost1) / (inp2 - inp1) + dY = np.asarray(cost2 - cost1) + dX = np.asarray(inp2 - inp1) + print(dY, dX) + return dY / dX