I could see an individual dog with unaddressed issues taking it as a threat but I've always hugged my dogs. Also, you don't hug a strange dog because you don't know how the dog will react to you. But as a general rule, I'd say it's okay to hug your own dog and dogs you spend a lot of time with, provided said dog isn't showing signs of being uncomfortable with the extra attention/pressure.