How to change the batch size in ctc each time?

I try to use the code below to get the ocr result.


But I find that I can only input a fixed number of images as input. Is there a way to change the batch size each time when inference?
Thanks in advance.

When a graph is created, it is created with a certain input shape which includes the batch size.

You can use a lower batch size by zeroing out some of the inputs.

If you want to use a higher batch size you have to reshape which will recreate the graph with the new input shape.

Thanks for reply. I found BucketingModule can solve this task as well. Which method do you think is faster and take less resource as I want to run it on the Jetson TX1? Thank you very much.

If you are using RNN, you can use BucketingModule and it is faster.