Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supporting dynamic shape of tensors #55

Open
Hakuyume opened this issue Jul 25, 2018 · 1 comment
Open

Supporting dynamic shape of tensors #55

Hakuyume opened this issue Jul 25, 2018 · 1 comment
Labels
enhancement New feature or request

Comments

@Hakuyume
Copy link
Contributor

Hakuyume commented Jul 25, 2018

I want a feature that users can specify the shape of tensors after the model is built. Currently, the shape of tensors are determined when the model is built (more accurately, when the variable table profile is built). However, this is inconvenient in some cases.

  • When processing a stream of data, the batchsize is not constant. Users need to wait enough data or add dummy data for padding.
  • Some networks do not resize images into a constant size. For example, Faster R-CNN does not.

In order to allocate memory, I think we can assume the maximum shape of tensors are specified when building a model.

@msakai
Copy link
Member

msakai commented Jul 30, 2018

Just FYI: Glow adopted fixed shape of tensors.

Glow: Graph Lowering Compiler Techniques for Neural Networks

We have considered the idea of developing some kind of parametric tensor types to support features such as varying batch sizes. However, we have decided to implement a simple strict type system instead and let the high-level machine learning framework specialize the computation before constructing the Glow graph. We evaluated the mechanisms that the modern programming languages use to implement generics and concluded that most hardware accelerators do not support some of these mechanisms. Production systems that use Glow may generate multiple Glow graphs for different batch sizes, or recompute the graph just-in-time.

@msakai msakai added the enhancement New feature or request label Aug 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants