Auto initialize the tensor info (shape, number of channels and data type) if the current assignment is empty. * * @param[in,out] info Tensor info used to check and assign. * @param[in] shape New shape. * @param[in] num_channels New number of channels. * @param[in] data_type New data type * @param[in] quantization_info (Optional) New quant
| 41 | * @return True if the tensor info has been initialized |
| 42 | */ |
| 43 | inline bool auto_init_if_empty(ITensorInfo &info, |
| 44 | const TensorShape &shape, |
| 45 | int num_channels, |
| 46 | DataType data_type, |
| 47 | QuantizationInfo quantization_info = QuantizationInfo()) |
| 48 | { |
| 49 | if (info.tensor_shape().total_size() == 0) |
| 50 | { |
| 51 | info.set_data_type(data_type); |
| 52 | info.set_num_channels(num_channels); |
| 53 | info.set_tensor_shape(shape); |
| 54 | info.set_quantization_info(quantization_info); |
| 55 | return true; |
| 56 | } |
| 57 | |
| 58 | return false; |
| 59 | } |
| 60 | |
| 61 | /** Auto initialize the tensor info using another tensor info. |
| 62 | * |
no test coverage detected