""" Util functions implementing the camera @@batch_orth_proj_idrot """ import tensorflow as tf def batch_orth_proj_idrot(X, camera, name=None): """ X is N x num_points x 3 camera is N x 3 same as applying orth_proj_idrot to each N """ with tf.variable_scope(name, "batch_orth_proj_idrot", [X, camera]): # TODO check X dim size. # tf.Assert(X.shape[2] == 3, [X]) camera = tf.reshape(camera, [-1, 1, 3], name="cam_adj_shape") X_trans = X[:, :, :2] + camera[:, :, 1:] shape = tf.shape(X_trans) return tf.reshape( camera[:, :, 0] * tf.reshape(X_trans, [shape[0], -1]), shape)