MimicSetBatchSize transformation relaxes hard-coded output batch dimension of Reshape operation. For Reshape with input shape [in_batch, ...] and pattern value [out_batch, ...] it generates a sub-graph which basically keeps ratio of input and output batch size and performs the following calculation: More...
#include <mimic_set_batch_size.hpp>
Public Member Functions | |
| bool | run_on_function (std::shared_ptr< ngraph::Function > f) override |
Data Fields | |
| NGRAPH_RTTI_DECLARATION | |
MimicSetBatchSize transformation relaxes hard-coded output batch dimension of Reshape operation. For Reshape with input shape [in_batch, ...] and pattern value [out_batch, ...] it generates a sub-graph which basically keeps ratio of input and output batch size and performs the following calculation:
scale = float(out_batch) / float(in_batch) modified_batch_dim = int(ceil(float(shape(input)[0]) * scale))
This transformation should be executed only while setBatchSize method call