예제 #1
0
        public void CalculateTanh(TanhLayer layer)
        {
            var dims = ComputeBlocksTreads(layer.Outputs.Length);

            Gpu.Launch(dims.Item1, dims.Item2).CalculateTanhGPU(
                layer.Inputs.GPUArray,
                layer.Outputs.GPUArray,
                layer.Outputs.Length
                );
        }
예제 #2
0
        public void BackPropagateTanh(TanhLayer layer)
        {
            var dims = ComputeBlocksTreads(layer.Inputs.Length);

            Gpu.Launch(dims.Item1, dims.Item2).BackPropagateTanhGPU(
                layer.Inputs.Length,
                layer.InputGradients.GPUArray,
                layer.Gradients.GPUArray,
                layer.Outputs.GPUArray
                );
        }
예제 #3
0
        public TanhLayer AddTanhLayer(string id = "")
        {
            var lastLayer = Layers.Last();

            if (lastLayer == null)
            {
                throw new Exception("There must be one or more layers in the network");
            }
            var tanhLayer = new TanhLayer(_gpuModule, lastLayer, id: id);

            Layers.Add(tanhLayer);
            return(tanhLayer);
        }
예제 #4
0
 public void BackPropagateTanh(TanhLayer layer)
 {
     var dims = ComputeBlocksTreads(layer.Inputs.Length);
     Gpu.Launch(dims.Item1, dims.Item2).BackPropagateTanhGPU(
        layer.Inputs.Length,
        layer.InputGradients.GPUArray,
        layer.Gradients.GPUArray,
        layer.Outputs.GPUArray
     );
 }
예제 #5
0
 public void CalculateTanh(TanhLayer layer)
 {
     var dims = ComputeBlocksTreads(layer.Outputs.Length);
     Gpu.Launch(dims.Item1, dims.Item2).CalculateTanhGPU(
        layer.Inputs.GPUArray,
        layer.Outputs.GPUArray,
        layer.Outputs.Length
     );
 }
예제 #6
0
 public TanhLayer AddTanhLayer(string id = "")
 {
     var lastLayer = Layers.Last();
     if (lastLayer == null) throw new Exception("There must be one or more layers in the network");
     var tanhLayer = new TanhLayer(_gpuModule, lastLayer, id: id);
     Layers.Add(tanhLayer);
     return tanhLayer;
 }