public static void UseEngine(IBackend backend, DeviceType deviceType, bool cudnn = false) { _backend = backend; ActFunc = backend.GetActFunc(); if (cudnn && deviceType != DeviceType.CUDA) { throw new ArgumentException("CuDnn work with CUDA device type"); } UseCudnn = cudnn; _backend.SetDevice(deviceType); }