Notice the example code has
f = 100*(x(2) - x(1).^2).^2 + (1 - x(1)).^2;
so it is receiving an x (that is dlarray object), computing something with it, getting out a dlarray object, and passing that dlarray object to dlgradient along with the original dlarray that was input.
Whereas your attempted code has
f = @(x)benchmark_func(x,1);
Which constructs an anonymous function and passes the anonymous function to dlgradient. But dlgradient does not accept function handles.
You would need something like