Enable it on a map you host
Start a local practice session. In the console, enter sv_cheats 1, then sv_infinite_ammo 1. Equip and throw a grenade. Check immediately after the throw that it is still in your loadout.
If the grenade disappears
Enter sv_infinite_ammo without a number to check the current value. If it resets when you load another map, set it again after loading. This command controls your supply in practice. Replaying your previous throw from another position uses a separate command.
Restore the regular supply
Enter sv_infinite_ammo 0 and test another throw. If you changed other practice settings, restore them separately or start a new local session.