def create_cost_spacing(self, c, length, normalized = True):
c_shape = c.get_shape().as_list();
c1 = tf.slice(c, [1,0], [-1,-1]);
c2 = tf.slice(c, [0,0], [c_shape[0]-1,-1]);
d = tf.sqrt(tf.reduce_sum(tf.squared_difference(c1,c2), reduction_indices = 1));
if normalized:
return tf.reduce_mean(tf.squared_difference(d, tf.constant(length / (c_shape[0]-1), "float32")));
else:
return tf.reduce_mean(tf.squared_difference(d, tf.constant(length, "float32")));
test_boundary_optimization.py 文件源码
python
阅读 28
收藏 0
点赞 0
评论 0
评论列表
文章目录