import torch


def CE_criterion(x, y):
	"""
	Cross-Entropy loss function.
	
	Args:
		x: output of autoencoder
		y: input data
	"""
	x = torch.clamp(x, 1e-8, 1-1e-8)
	return -torch.mean(y * torch.log(x) + (1.-y) * torch.log(1.-x))