def binomial_draw_vec(p_vec, dtype='float32'):
shape = tf.shape(p_vec)
return tf.select(tf.less(tf.random_uniform(shape=shape, minval=0, maxval=1, dtype='float32'), p_vec), tf.ones(shape, dtype=dtype), tf.zeros(shape, dtype=dtype))
评论列表
文章目录