Пример #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;
 }