def _run_batch(self, *args: 'TFArgType', **kwargs: 'TFArgType') -> 'ext.NpNDArray':
    params = Params['TFArgType'](*args, **kwargs)
    with tf.device(self._device_id):

        def _mapping(item: 'TFArgType') -> 'tf_ext.TensorLike':
            if (not LazyType['tf_ext.TensorLike']('tf.Tensor').isinstance(item)):
                return t.cast('tf_ext.TensorLike', tf.convert_to_tensor(item))
            else:
                return item
        params = params.map(_mapping)
        tf.compat.v1.global_variables_initializer()
        res = self._predict_fn(*params.args, **params.kwargs)
        return t.cast('ext.NpNDArray', res.numpy())
def _run_batch(self, *args: 'TFArgType', **kwargs: 'TFArgType') -> 'ext.NpNDArray':
    params = Params['TFArgType'](*args, **kwargs)
    with tf.device(self._device_id):

        def _mapping(item: 'TFArgType') -> 'tf_ext.TensorLike':
            if (not LazyType['tf_ext.TensorLike']('tf.Tensor').isinstance(item)):
                return t.cast('tf_ext.TensorLike', tf.convert_to_tensor(item))
            else:
                return item
        params = params.map(_mapping)
        tf.compat.v1.global_variables_initializer()
        res = self._predict_fn(*params.args, **params.kwargs)
        return t.cast('ext.NpNDArray', res.numpy())