Sets the first dimension of the input tensor to `batch_size`. Args: batch_size: Batch size for the model. Replaces the first dimension of an input size array if undefined. (default 1) Raises: ValueError: input_tensor is not defined.
(self, batch_size)
| 1014 | return self._input_tensors and self._output_tensors |
| 1015 | |
| 1016 | def _set_batch_size(self, batch_size): |
| 1017 | """Sets the first dimension of the input tensor to `batch_size`. |
| 1018 | |
| 1019 | Args: |
| 1020 | batch_size: Batch size for the model. Replaces the first dimension of an |
| 1021 | input size array if undefined. (default 1) |
| 1022 | |
| 1023 | Raises: |
| 1024 | ValueError: input_tensor is not defined. |
| 1025 | """ |
| 1026 | if not self._has_valid_tensors(): |
| 1027 | raise ValueError("The batch size cannot be set for this model. Please " |
| 1028 | "use input_shapes parameter.") |
| 1029 | |
| 1030 | for tensor in self._input_tensors: |
| 1031 | shape = tensor.shape.as_list() |
| 1032 | if shape[0] is None: |
| 1033 | shape[0] = batch_size |
| 1034 | tensor.set_shape(shape) |
| 1035 | |
| 1036 | |
| 1037 | @_tf_export(v1=["lite.TocoConverter"]) |