import numpy as np
from scipy.io.wavfile import read
from vgpu_cache import VGPUCache   # <-- import the generalized cache

cache = VGPUCache()   # global instance

w = np.random.rand(100,1)
x = np.random.rand(100,1)
yt = np.random.rand(100,1)

while True:
    y = np.vstack([cache.matmul(x[i,None],w[i,None]) for i in range(100)])
    err = yt - y
    w += err * 0.01
    x += err * 0.01
    print(np.sum(err**2))

