from layer import *
import numpy as np
import pickle
"""
DIMENTION = 3
VAR_RANGE = 1
N = 10
ALPHA = 0.1
SIGMA = VAR_RANGE * ALPHA

gen: np.random.Generator = np.random.default_rng()
or_weight = (gen.uniform(high = VAR_RANGE,low = -VAR_RANGE,size=(1,DIMENTION)))
or_bias = (gen.uniform(high = VAR_RANGE, low = -VAR_RANGE,size=()))
print(or_bias)

input_x = gen.uniform(low = -VAR_RANGE,high=VAR_RANGE,size=(DIMENTION,N))
y = or_weight @ input_x + or_bias
error = gen.normal(0,SIGMA,size = (1,N))
y += error
print(y)
"""

input_var = Variable(np.array([[1,2,3],[1,5,0]]))
weight = Variable(np.array([[2],[-1],[1]]))
bias = Variable(np.array([1]))
v = relu((input_var @ weight) + bias)
#print(v.numpy())
#print(v.numpy().shape, np.array([[1,1]]).shape)
k = matmul(np.array([[1,1]]), v)
print(make_mermaid_graph(k))

print(f"result : {k.numpy()}")
k.backprop(np.ones(()))
print(f"grad input : {input_var.grad}, w : {weight.grad}, b : {bias.grad}")
