Closed iamgeo92 closed 1 year ago
Are you using CUDA? There is a mechanism to support that: https://liuliu.github.io/s4nnc/documentation/nnc/modelbuilder which can be used even if there are hard-coded numbers in the Model build process. See example: https://github.com/liuliu/s4nnc/blob/bf594f3bb12075d221db3893dfff8150c8de34f5/examples/imdb/main.swift#L86
Sorry, i forgot to mention. I was walking about macos with MPS. MPS does support variable image sizes, but it seems much slower.
Oh. Yes, we use MPSGraph like how PyTorch uses it. We use it only to build individual ops for fixed shape, and cache these compiled ops for faster execution later.
In the code i see that the startWidth and startHeight is fixed. Whats the best way to support variable image size? One way is to recreate the model whenever the input size is changed, but thats super slow.
can we somehow recreate the model with a different size fast?
What are your thoughts/suggestions?