R/utils.R

Defines functions tf_version is_windows

is_windows <- function() {
  identical(.Platform$OS.type, "windows")
}

# we cant use tensorflow::tf_version() to not create a
# dependency
tf_version <- function(tf) {

  if (reticulate::py_has_attr(tf, "version"))
    version_raw <- tf$version$VERSION
  else version_raw <- tf$VERSION

  tfv <- strsplit(version_raw, ".", fixed = TRUE)[[1]]
  version <- package_version(paste(tfv[[1]], tfv[[2]],
                                   sep = "."))

  version
}

Try the tfruns package in your browser

Any scripts or data that you put into this service are public.

tfruns documentation built on May 29, 2024, 7:31 a.m.