#NEWLINE# @ Distribution #NEWLINE# def UniformInt( name = None ) : #NEWLINE# #INDENT# X = tf . placeholder ( config . int_dtype , name = name ) #NEWLINE# Distribution . logp = tf . fill ( tf . shape ( X ) , config . dtype ( 0 ) ) #NEWLINE# def integral( lower , upper ) : #NEWLINE# #INDENT# val = tf . cond ( tf . logical_or ( tf . is_inf ( tf . ceil ( tf . cast ( lower , config . dtype ) ) ) , tf . is_inf ( tf . floor ( tf . cast ( upper , config . dtype ) ) ) ) , ( lambda : tf . constant ( 1 , dtype = config . dtype ) ) , ( lambda : ( tf . cast ( upper , config . dtype ) - tf . cast ( lower , config . dtype ) ) ) ) #NEWLINE# return val #NEWLINE# #UNINDENT# Distribution . integral = name #NEWLINE# return X