uber-research/sbnet

Running with variable input size

rafaelbou opened this issue · 2 comments

Hi,
Can I use the code with variable input size?
As we can see, the functions below use in_size as the first input parameter:
def calc_block_params(in_size, bsize, ksize, strides, padding, static=True):
def calc_block_params_res_block(in_size, bsize, ksize_list, strides, padding):

I'm using FCN so my network can handle with variable input size, but the function above require explicit input size.

Thanks for your help,
Rafael.

Hi,

The low level sbnet_module.reduce_mask op supports block counts that come from a tensor rather than a static list/attribute. This means it is possible to compute the block counts dynamically from your input resolution but sparse_conv_lib.calc_block_params currently expects a python list and hasn't been tested to work with dynamic shapes. This would involve something along the lines of passing [tf.shape(x)[0], tf.shape(x)[1]] to the function but this is currently untested and would involve a whole dynamic subgraph getting generated for the shape path.

We are looking into adding this functionality along with a few other fixes (such as upgrade to TF 1.8) within a couple weeks time frame. In the meantime if you need a faster solution one suggestion is to try porting the existing code to support dynamic shape computation.

Also see:
https://stackoverflow.com/questions/37096225/how-to-understand-static-shape-and-dynamic-shape-in-tensorflow

Hi,

Now calc_block_params and calc_block_params_res_block supports tf.Tensor type for in_size parameter.

Thanks,
Mengye