pyiqa.archs.interpolate_compat_tensorflow ========================================= .. py:module:: pyiqa.archs.interpolate_compat_tensorflow .. autoapi-nested-parse:: This file is taken from: https://github.com/toshas/torch-fidelity/blob/master/torch_fidelity/interpolate_compat_tensorflow.py Module Contents --------------- .. py:function:: interpolate_bilinear_2d_like_tensorflow1x(input, size=None, scale_factor=None, align_corners=None, method='slow') Down/up samples the input to either the given :attr:`size` or the given :attr:`scale_factor` Epsilon-exact bilinear interpolation as it is implemented in TensorFlow 1.x: https://github.com/tensorflow/tensorflow/blob/f66daa493e7383052b2b44def2933f61faf196e0/tensorflow/core/kernels/image_resizer_state.h#L41 https://github.com/tensorflow/tensorflow/blob/6795a8c3a3678fb805b6a8ba806af77ddfe61628/tensorflow/core/kernels/resize_bilinear_op.cc#L85 as per proposal: https://github.com/pytorch/pytorch/issues/10604#issuecomment-465783319 Related materials: https://hackernoon.com/how-tensorflows-tf-image-resize-stole-60-days-of-my-life-aba5eb093f35 https://jricheimer.github.io/tensorflow/2019/02/11/resize-confusion/ https://machinethink.net/blog/coreml-upsampling/ Currently only 2D spatial sampling is supported, i.e. expected inputs are 4-D in shape. The input dimensions are interpreted in the form: `mini-batch x channels x height x width`. :param input: the input tensor :type input: Tensor :param size: output spatial size. :type size: Tuple[int, int] :param scale_factor: multiplier for spatial size. Has to match input size if it is a tuple. :type scale_factor: float or Tuple[float] :param align_corners: Same meaning as in TensorFlow 1.x. :type align_corners: bool, optional :param method: 'slow' (1e-4 L_inf error on GPU, bit-exact on CPU, with checkerboard 32x32->299x299), or 'fast' (1e-3 L_inf error on GPU and CPU, with checkerboard 32x32->299x299) :type method: str, optional