   for (int i = 0; i < 7; ++i) {
     VERIFY_IS_APPROX(out(i), expected_out(i));
   }
+
+  cudaFree(d_in_x);
+  cudaFree(d_in_n);
+  cudaFree(d_out);
 }
 
 template <typename Scalar>

  Scalar* d_a;
  Scalar* d_x;
  Scalar* d_out;
  cudaMalloc((void**)(&d_a), bytes);
  cudaMalloc((void**)(&d_x), bytes);
  cudaMalloc((void**)(&d_out), bytes);

  cudaMemcpy(d_a, a.data(), bytes, cudaMemcpyHostToDevice);
  cudaMemcpy(d_x, x.data(), bytes, cudaMemcpyHostToDevice);


  Scalar* d_in;
  Scalar* d_out;
  assert(cudaMalloc((void**)(&d_in), bytes) == cudaSuccess);
  assert(cudaMalloc((void**)(&d_out), bytes) == cudaSuccess);

  cudaMemcpy(d_in, in.data(), bytes, cudaMemcpyHostToDevice);

