(self, points)
return tf.reduce_sum(weights[:, :, None] * parameter_vector, axis=1)
Evaluate using tensorflow.
Evaluate using tensorflow.
Evaluate using tensorflow .
def build_evaluation(self, points):
        """Evaluate using tensorflow."""
        # Get the appropriate hyperplane
        origins, hyperplanes, simplices = self._get_hyperplanes(points)

        # Project points onto the grid of triangles.
        if self.project:
            clip_min = self.tri.limits[:, 0]
            clip_max = self.tri.limits[:, 1]

            # Broadcasting in tf.clip_by_value not available in
            # TensorFlow >= 1.6.0
            points = tf.minimum(tf.maximum(points, clip_min), clip_max)

        # Compute weights (barycentric coordinates)
        offset = points - origins
        w1 = tf.reduce_sum(offset[:, :, None] * hyperplanes, axis=1)
        w0 = 1 - tf.reduce_sum(w1, axis=1, keepdims=True)
        weights = tf.concat((w0, w1), axis=1)

        # Collect the value on the vertices
        parameter_vector = tf.gather(self.parameters[0],
                                     indices=simplices,
                                     validate_indices=False)

        # Compute the values
        return tf.reduce_sum(weights[:, :, None] * parameter_vector, axis=1)
def build_evaluation ( self , points ) : # Get the appropriate hyperplane origins , hyperplanes , simplices = self . _get_hyperplanes ( points ) # Project points onto the grid of triangles. if self . project : clip_min = self . tri . limits [ : , 0 ] clip_max = self . tri . limits [ : , 1 ] # Broadcasting in tf.clip_by_value not available in # TensorFlow >= 1.6.0 points = tf . minimum ( tf . maximum ( points , clip_min ) , clip_max ) # Compute weights (barycentric coordinates) offset = points - origins w1 = tf . reduce_sum ( offset [ : , : , None ] * hyperplanes , axis = 1 ) w0 = 1 - tf . reduce_sum ( w1 , axis = 1 , keepdims = True ) weights = tf . concat ( ( w0 , w1 ) , axis = 1 ) # Collect the value on the vertices parameter_vector = tf . gather ( self . parameters [ 0 ] , indices = simplices , validate_indices = False ) # Compute the values return tf . reduce_sum ( weights [ : , : , None ] * parameter_vector , axis = 1 )