import tensorflow as tf


	def data_map(self, img_path):
		n_bits = config.model.data.n_bits
		n_bins = 2**n_bits
		rgb = tf.image.decode_png(tf.read_file(img_path), channels=3, dtype=tf.uint8)

		h = config.model.data.dimensions.h
		w = config.model.data.dimensions.w
		c = config.model.data.dimensions.c
		# rgb.set_shape([h,w,c]) # don't set because going to crop anyway

		# crop for lsun 96, see realnvp and glow for specifics
		rgb = tf.image.random_crop(rgb,size=[h,w,c])

		# crop for patch training
		crop_h = h//self.crop_factor
		crop_w = w//self.crop_factor
		rgb = tf.image.random_crop(rgb,size=[crop_h,crop_w,c])

		# random left-right flops
		rgb = tf.image.random_flip_left_right(rgb)

		# cast, bit conversion, compress domain, center
		rgb = tf.cast(rgb, tf.float32)
