Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

set_random_seed

Set random seed for TensorFlow


Description

Sets all random seeds needed to make TensorFlow code reproducible.

Usage

set_random_seed(seed, disable_gpu = TRUE)

Arguments

seed

A single value, interpreted as an integer

disable_gpu

TRUE to disable GPU execution (see Parallelism below).

Details

This function should be used instead of use_session_with_seed() if you are using TensorFlow >= 2.0, as the concept of session doesn't really make sense anymore.

This functions sets:

It also optionally disables the GPU execution as this is a potential source of non-reproducibility.


tensorflow

R Interface to 'TensorFlow'

v2.4.0
Apache License 2.0
Authors
Daniel Falbel [ctb, cph, cre], JJ Allaire [aut, cph], RStudio [cph, fnd], Yuan Tang [aut, cph] (<https://orcid.org/0000-0001-5243-233X>), Dirk Eddelbuettel [ctb, cph], Nick Golding [ctb, cph], Tomasz Kalinowski [ctb, cph], Google Inc. [ctb, cph] (Examples and Tutorials)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.