Removed gradient overloading as nvcc doesn't handle it correctly