示例#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;
 }