Ejemplo n.º 1
0
            private static Tensor __uniform(Tensor t, double from, double to)
            {
                switch (t.dtype)
                {
                case torch.float16:
                {
                    MKL.Uniform(t.__half, from, to);
                    return(t);
                }

                case torch.float32:
                {
                    MKL.Uniform(t.__float, from, to);
                    return(t);
                }

                case torch.float64:
                {
                    MKL.Uniform(t.__double, from, to);
                    return(t);
                }

                case torch.int8:
                case torch.uint8:
                case torch.int16:
                case torch.int32:
                case torch.int64:
                {
                    throw new TorchException("TorchException: torch.uniform is not implemented for integer tensors.");
                }

                case torch.@bool:
                {
                    throw new TorchException("TorchException: torch.uniform is not implemented for bool tensors.");
                }
                }
                return(t);
            }