Depends on what you mean by 'during its invention.' The Chinese obviously invented gunpowder, somewhere around the 10th century, depending on definitions, and they pretty much immediately adapted it to military use. Despite popular mythology, the Chinese were not just making firecrackers out of their gunpowder.
Before any contact with western gunpowder weaponry, which first impacted Chinese arms development in the 16th century, the Chinese were using it in a wide variety of applications. Some of the most prominent uses were in fire lances, which were a close range weapon where a short tube of gunpowder sprayed iron shot and flames into an enemy at close range, fire arrows, which replaced bowstrings with rocket propulsion, and were fired in swarms of thousands, and thunder bombs, which were cast iron shells packed with gunpowder and hurled from trebuchets. The Chinese tended to use their gunpowder as an incendiary weapon; making cannons like the Europeans would have given them little advantage, since Chinese walls were almost impervious to gunpowder. Unlike tall, thin, stone walls like were common in European castles, the Chinese built their walls out of rammed earth, and built them stupendously thick. You can drive a car along the walls of Xian in Shaanxi province; they're nearly fifty feet thick in places. Even during the Opium Wars, when the British had modern, industrial artillery and high explosive shells, they could bombard these walls for hours and make little impression. The most efficient use of gunpowder for the Chinese was not in trying to break down walls, but in starting fires and launching arrows.
https://upload.wikimedia.org/wikipedia/commons/9/97/Xi'an_-City_wall-_014.jpg
There's a great story from the time of the Yuan dynasty, where they replaced the powdersmiths of the Yangzhou city arsenal with ones less resistant to the regime, but also less experienced. One day, a spark got into the powder, and the flames started setting off fire lances, which wasn't a crisis in and of itself. What was cause for concern was when the fire spread to the magazine of thunder bombs. The resulting explosion hurled beams made of whole trees hundreds of yards, and the Chinese became the first people to describe an explosive shockwave, talking about how the magazine explosion blew tiles off roofs thirty miles away.
The caveat is that Chinese gunpowder manufacturing missed out on one of the Europeans' key advances, kerneling their powder. The Chinese were stuck with very fine 'serpentine' powder, which leaves little space between individual grains, while coarser Western powders leave little pockets of air between grains. This lets the powder charge burn faster, which gives you a considerably more powerful shot.