R/seed.R

Defines functions tensorflow_on_use_session tensorflow_on_before_use_session

tensorflow_on_before_use_session <- function(quiet) {
  if (is_backend("tensorflow")) {
    keras$backend$clear_session()
    TRUE
  } else {
    FALSE
  }
}

tensorflow_on_use_session <- function(sess, quiet) {
  if (is_backend("tensorflow")) {
    if (tensorflow::tf_version() < "2.0")
      keras$backend$set_session(sess)
  }
}

Try the keras package in your browser

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

keras documentation built on Aug. 21, 2021, 9:07 a.m.