R0b1n
R0b1n

Reputation: 603

AttributeError: module 'tensorflow' has no attribute 'resize_nearest_neighbor'

I got this error in TS 2.0.

AttributeError: module 'tensorflow' has no attribute 'resize_nearest_neighbor'

 tf.resize_nearest_neighbor(conv3, (tf.shape(conv2)[1], tf.shape(conv2)[2]))

Is there an alternative that I can use?

Upvotes: 0

Views: 1279

Answers (1)

Lescurel
Lescurel

Reputation: 11651

You can specify the interpolation method in tf.image.resize:

The method argument expects an item from the image.ResizeMethod enum, or the string equivalent. The options are:

  • nearest: Nearest neighbor interpolation. antialias has no effect when used with nearest neighbor interpolation. tering),

So the equivalent would be

tf.image.resize(conv3, (tf.shape(conv2)[1], tf.shape(conv2)[2]), method='nearest')

Note that it can work only if conv3 is a 4-D Tensor of shape [batch, height, width, channels] or a 3-D Tensor of shape [height, width, channels].

Upvotes: 2

Related Questions