public override Signal Forward(ComputeShader compute, Signal x, bool train) { mask = Refresh(x, mask); var kernel = compute.FindKernel("ReLU"); compute.SetBuffer(kernel, "_X", x.Buffer); compute.SetBuffer(kernel, "_Y", mask.Buffer); Dispatch(compute, kernel, mask.Rows, mask.Columns); var output = new Signal(mask); MatOperations.CopyMM(compute, mask, output); return(output); }
public override Signal Forward(ComputeShader compute, Signal x, bool train) { this.x = Refresh(x, this.x); MatOperations.CopyMM(compute, x, this.x); var output = new Signal(x.Rows, weights.Columns); // matmul M = input * weights MatOperations.Multiply(compute, x, weights, output); // matplus M´ = M + biases MatOperations.AddVM(compute, biases, output); // output.Log(); return(output); }