Exemple #1
0
 def construct(self, x, y):
     shp = P.Shape()(self.yy)
     y = P.Reshape()(y, shp)
     u, _ = self.unq(y)
     u_shp = P.DynamicShape()(u)
     z = self.gather(x, u, 0)
     return z, u_shp
Exemple #2
0
def rowtensor_deduplicate_indices_slices(grad):
    """Unique the indices and sums the 'values' corresponding to the duplicate indices."""
    indices = grad.indices
    values = grad.values

    unique_indices, index_position = P.Unique()(indices)
    summed_values = P.UnsortedSegmentSum()(values, index_position, P.DynamicShape()(unique_indices)[0])

    return RowTensor(unique_indices, summed_values, grad.dense_shape)
Exemple #3
0
 def construct(self, x):
     u, _ = self.unq(x)
     shp = P.DynamicShape()(u)
     z = self.sum(x, self.segment_ids, shp[0])
     return z, shp[0]
 def __init__(self):
     super(DynamicShapeNet, self).__init__()
     self.convert_to_dynamic_shape_op = inner.GpuConvertToDynamicShape()
     self.dynamic_shape_op = P.DynamicShape()