Add input preprocess


#1

Hello. How can I add preprocessing for incoming data?

For example:

shape_dict = {'data': (1, 3, 20, 20)}
mod, params = relay.frontend.from_mxnet(model, shape_dict)

Input shape (1, 3, 20, 20) (float32) but original data shape (20, 20, 3) (uint8) how i can “inject” preprocess for data, like:

x = relay.var('img', shape=(20, 20, 3), dtype="uint8")
x = relay.cast(x, 'float32')
x = relay.transpose(x, (2, 0, 1))
x = relay.expand_dims(x, 0) <-- (1, 3, 20, 20)