I work with the Mazda line and that problem is very frequent in these vehicles, it usually presents by 16 gearbox, requires maintenance based on oil change and the respective filter, since a lot of dirt accumulates. I have had to change to the complete valve set. To be able to evaluate that you have to enter with a special scanner to measure the direct flows of the box in each march.
Otherwise they present input problems to the admission, it means problems with the air flow commonly known as MAF.
I hope it serves you greetings