import os
import subprocess
import tensorflow as tf


def psnr(y_true, y_pred):
    return tf.image.psnr(y_pred, y_true, max_val=255.0)

def closest_number(n, m):
    q = int(n / m)
    n1 = m * q
    if (n * m) > 0:
        n2 = (m * (q + 1))
    else:
        n2 = (m * (q - 1))
    if abs(n - n1) < abs(n - n2):
        return n1
    return n2

import os
import subprocess
import tensorflow as tf


def psnr(y_true, y_pred):
    return tf.image.psnr(y_pred, y_true, max_val=255.0)

def closest_number(n, m):
    q = int(n / m)
    n1 = m * q
    if (n * m) > 0:
        n2 = (m * (q + 1))
    else:
        n2 = (m * (q - 1))
    if abs(n - n1) < abs(n - n2):
        return n1
    return n2
