Save the date! Google I/O returns May 18-20 Register now


Computes the matting loss function based on the matting Laplacian.

Computes the matting loss function based on the laplacian generated by the build_matrices function which implements the approach proposed by Levin et al. in "A Closed Form Solution to Natural Image Matting".

matte A tensor of shape [B, H, W, 1].
laplacian A tensor of shape [B, H - pad, W - pad, size^2, size^2] containing the Laplacian matrices computed by the build_matrices function, where pad is equal to size - 1 and size is the patch size used to compute this tensor.
name A name for this op. Defaults to "matting_loss".

A tensor containing a scalar value defining the matting loss.

ValueError If the last dimension of matte is not 1. If matte is not of rank 4. If the last two dimensions of laplacian are not of the same size. If laplacian is not of rank 5. If B is different between matte and laplacian.