# What's the nearest neighbor algorithm used for upsampling?

Additionally, by default, the UpSampling2D layer will use a nearest neighbor algorithm to fill in the new rows and columns. This has the effect of simply doubling rows and columns, as described and is specified by the ‘interpolation‘ argument set to ‘nearest‘. Alternately, a bilinear interpolation method can be used which draws upon multiple surrounding points. This can be specified via setting the ‘interpolation‘ argument to ‘bilinear‘.

How exactly does the nearest neighbor algorithm mentioned above work? Also, what does interpolation mean in this context (nearest and bilinear)?

• Interpolation typically means that you compute the value for a position/unit $x$ based on its "surrounding" positions/units. I would need to read that article to give a formal answer. – nbro Aug 21 at 11:20