Python tensorflow.python.framework.ops.RegisterShape() Examples

The following are 9 code examples of tensorflow.python.framework.ops.RegisterShape(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module tensorflow.python.framework.ops , or try the search function .
Example #1
Source File: gradients_test.py    From deep_image_model with Apache License 2.0 6 votes vote down vote up
def testNoGradientForStringOutputs(self):
    with ops.Graph().as_default() as g:
      @ops.RegisterGradient("TestOp")
      def _TestOpGrad(op, float_grad, string_grad):
        """Gradient function for TestOp."""
        self.assertEquals(float_grad.dtype, dtypes.float32)
        self.assertFalse(string_grad)
        return float_grad
      ops.RegisterShape("TestOp")(None)

      c = constant(1.0)
      x, y = g.create_op("TestOp", [c], [dtypes.float32, dtypes.string]).outputs
      z = x * 2.0
      w = z * 3.0
      grads = gradients.gradients(z, [c])
      self.assertTrue(isinstance(grads[0], ops.Tensor)) 
Example #2
Source File: tf_approxmatch.py    From pointnet-registration-framework with MIT License 5 votes vote down vote up
def match_cost(xyz1,xyz2,match):
	'''
input:
	xyz1 : batch_size * #dataset_points * 3
	xyz2 : batch_size * #query_points * 3
	match : batch_size * #query_points * #dataset_points
returns:
	cost : batch_size
	'''
	return approxmatch_module.match_cost(xyz1,xyz2,match)
#@tf.RegisterShape('MatchCost') 
Example #3
Source File: tf_nndistance.py    From Pixel2MeshPlusPlus with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def nn_distance(xyz1, xyz2):
	'''
	Computes the distance of nearest neighbors for a pair of point clouds
	input: xyz1: (batch_size,#points_1,3)  the first point cloud
	input: xyz2: (batch_size,#points_2,3)  the second point cloud
	output: dist1: (batch_size,#point_1)   distance from first to second
	output: idx1:  (batch_size,#point_1)   nearest neighbor from first to second
	output: dist2: (batch_size,#point_2)   distance from second to first
	output: idx2:  (batch_size,#point_2)   nearest neighbor from second to first
	'''
	xyz1 = tf.expand_dims(xyz1, 0)
	xyz2 = tf.expand_dims(xyz2, 0)
	return nn_distance_module.nn_distance(xyz1,xyz2)

#@tf.RegisterShape('NnDistance') 
Example #4
Source File: tf_approxmatch.py    From Pixel2MeshPlusPlus with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def match_cost(xyz1,xyz2,match):
	'''
input:
	xyz1 : batch_size * #dataset_points * 3
	xyz2 : batch_size * #query_points * 3
	match : batch_size * #query_points * #dataset_points
returns:
	cost : batch_size
	'''
	xyz1 = tf.expand_dims(xyz1, 0)
	xyz2 = tf.expand_dims(xyz2, 0)
	return approxmatch_module.match_cost(xyz1,xyz2,match)
#@tf.RegisterShape('MatchCost') 
Example #5
Source File: tf_approxmatch.py    From Silhouette-Guided-3D with MIT License 5 votes vote down vote up
def match_cost(xyz1,xyz2,match):
	'''
input:
	xyz1 : batch_size * #dataset_points * 3
	xyz2 : batch_size * #query_points * 3
	match : batch_size * #query_points * #dataset_points
returns:
	cost : batch_size
	'''
	return approxmatch_module.match_cost(xyz1,xyz2,match)
#@tf.RegisterShape('MatchCost') 
Example #6
Source File: tf_approxmatch.py    From pcn with MIT License 5 votes vote down vote up
def match_cost(xyz1,xyz2,match):
	'''
input:
	xyz1 : batch_size * #dataset_points * 3
	xyz2 : batch_size * #query_points * 3
	match : batch_size * #query_points * #dataset_points
returns:
	cost : batch_size
	'''
	return approxmatch_module.match_cost(xyz1,xyz2,match)
#@tf.RegisterShape('MatchCost') 
Example #7
Source File: tf_approxmatch.py    From pcrnet with MIT License 5 votes vote down vote up
def match_cost(xyz1,xyz2,match):
	'''
input:
	xyz1 : batch_size * #dataset_points * 3
	xyz2 : batch_size * #query_points * 3
	match : batch_size * #query_points * #dataset_points
returns:
	cost : batch_size
	'''
	return approxmatch_module.match_cost(xyz1,xyz2,match)
#@tf.RegisterShape('MatchCost') 
Example #8
Source File: tf_nndistance.py    From Pixel2Mesh with Apache License 2.0 5 votes vote down vote up
def nn_distance(xyz1, xyz2):
	'''
	Computes the distance of nearest neighbors for a pair of point clouds
	input: xyz1: (batch_size,#points_1,3)  the first point cloud
	input: xyz2: (batch_size,#points_2,3)  the second point cloud
	output: dist1: (batch_size,#point_1)   distance from first to second
	output: idx1:  (batch_size,#point_1)   nearest neighbor from first to second
	output: dist2: (batch_size,#point_2)   distance from second to first
	output: idx2:  (batch_size,#point_2)   nearest neighbor from second to first
	'''
	xyz1 = tf.expand_dims(xyz1, 0)
	xyz2 = tf.expand_dims(xyz2, 0)
	return nn_distance_module.nn_distance(xyz1,xyz2)

#@tf.RegisterShape('NnDistance') 
Example #9
Source File: tf_approxmatch.py    From Pixel2Mesh with Apache License 2.0 5 votes vote down vote up
def match_cost(xyz1,xyz2,match):
	'''
input:
	xyz1 : batch_size * #dataset_points * 3
	xyz2 : batch_size * #query_points * 3
	match : batch_size * #query_points * #dataset_points
returns:
	cost : batch_size
	'''
	xyz1 = tf.expand_dims(xyz1, 0)
	xyz2 = tf.expand_dims(xyz2, 0)
	return approxmatch_module.match_cost(xyz1,xyz2,match)
#@tf.RegisterShape('MatchCost')