Extreme like trying to pull his eyeballs out, set him on fire, taking hammers to him, slamming him in the door (all which and more I've seen and heard of toddlers do or attempt to do to dogs - older children are much worse when they are extremely violent towards animals, and I won't go into that here... it's too vile) ... or normal things like hitting at/ kicking at/ hugging too hard/ falling on/ pulling fur/ears/tail?
If it's in the extreme range, you need professional help, pronto... because those (and others like them / worse things) are signs of *either* a disorder or that he is being abused.
If it's in the normal range:
Every single time a sharp NO! and then either
- IMMEDIATELY get gentle and smile and SHOW by holding his body (kindly) and directing his arms how to appropriately while talking calmly "Like THIS not with legs, not hitting (grabbing/pulling/ whatever roughness was going on) but like THIS."
or
- Scooped up and on timeout, or swat (since you use that as discipline) and remove him from the dog... and explain simply and repeatedly that x is not allowed... that that HURTS the dog, and we don't hurt animals/people unless we're defending ourselves or someone else or learning.
DO make sure to have a lot of "like this" so that acceptable behavior is understood right along with unacceptable behavior.