R-Gold
R-Gold

Reputation: 21

Problem on layer_rescaling() on tensorflow/keras

The keras package in R layer_rescaling() just returns back this error:

"Error in require_tf_version("2.6", "layer_rescaling()") : Tensorflow version >=2.6 required to use layer_rescaling()"

But, my keras package is already updated (2.9.0). I found the source code of keras as this:

layer_rescaling <-
function(object, scale, offset = 0, ...)
{
  require_tf_version("2.6", "layer_rescaling()")
  args <- capture_args(match.call(), ignore = "object")
  create_layer(keras$layers$Rescaling, object, args)
}

Btw, we use layer_rescaling() when creating a (convolutional) neural network for images. Specifically, the layer_rescaling() will rescale image inputs e.g. whose values are originally in the [0, 255] range to the [0, 1] range.

I think there is a problem with that source code, and I believe creating my own function for rescaling tensors will solve this problem. Or could there be a better way to solve this?

Upvotes: 2

Views: 240

Answers (1)

t-kalinowski
t-kalinowski

Reputation: 1515

There are two version numbers to be aware of here: the R package version, packageVersion("keras"), and the Python module R is loading, tensorflow::tf_config().

That error message says you need to update the Python module. You can update it by calling keras::install_keras().

Upvotes: 1

Related Questions