The IdDict probably came from Zygote.
All of the keys you see as escaped symbols (e.g. :(Main.tmp_test_in_1)) are local or global variables that were in scope and participated in gradient calculation. So to index grads with them, use grads[tmp_test_in_1] directly. Ideally, however, you should be passing in anything you want to take the gradient of like this:
f(a, b) = ...
grad_arg1, grad_arg2 = gradient(f, arg1, arg2)
Or like this:
f(a, b) = ...
gs = gradient(() -> f(arg1, arg2), params(arg1, arg2))
grad_arg1, grad_arg2 = gs[arg1], gs[arg2]
This is covered in detail in Basics · Flux. I would highly recommend anyone new to Flux or Zygote to read through this first.