Ejemplo n.º 1
0
            private static Tensor __ones(Tensor t)
            {
                switch (t.dtype)
                {
                case torch.float16:
                {
                    MKL.Full(t.__half, 1);
                    return(t);
                }

                case torch.float32:
                {
                    MKL.Full(t.__float, 1);
                    return(t);
                }

                case torch.float64:
                {
                    MKL.Full(t.__double, 1);
                    return(t);
                }

                case torch.int8:
                {
                    MKL.Full(t.__int8, 1);
                    return(t);
                }

                case torch.uint8:
                {
                    MKL.Full(t.__uint8, 1);
                    return(t);
                }

                case torch.int16:
                {
                    MKL.Full(t.__int16, 1);
                    return(t);
                }

                case torch.int32:
                {
                    MKL.Full(t.__int32, 1);
                    return(t);
                }

                case torch.int64:
                {
                    MKL.Full(t.__int64, 1);
                    return(t);
                }

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