greta should respect the RNG seed specified in R (greta explicitly passes the latest RNG state into TF, and increments the RNG state in R), and it does, but apparently only after TF has been initialised.
In the below reprex, the values af a, b, and c should all be the same, but the value for a (seed set before fir greta array created and initialisation of python) is different than the other two.
library(greta)
#>
#> Attaching package: 'greta'
#> The following objects are masked from 'package:stats':
#>
#> binomial, cov2cor, poisson
#> The following objects are masked from 'package:base':
#>
#> %*%, apply, backsolve, beta, chol2inv, colMeans, colSums, diag,
#> eigen, forwardsolve, gamma, identity, rowMeans, rowSums, sweep,
#> tapply
set.seed(1)
x <- normal(0, 1)
#> ℹ Initialising python and checking dependencies
#> ✓ Initialising python and checking dependencies ... done
#>
a <- calculate(x, nsim = 1)
set.seed(1)
y <- normal(0, 1)
b <- calculate(y, nsim = 1)
set.seed(1)
z <- normal(0, 1)
c <- calculate(z, nsim = 1)
a
#> $x
#> , , 1
#>
#> [,1]
#> [1,] 1.304048
b
#> $y
#> , , 1
#>
#> [,1]
#> [1,] 0.4455042
c
#> $z
#> , , 1
#>
#> [,1]
#> [1,] 0.4455042
greta should respect the RNG seed specified in R (greta explicitly passes the latest RNG state into TF, and increments the RNG state in R), and it does, but apparently only after TF has been initialised.
In the below reprex, the values af a, b, and c should all be the same, but the value for a (seed set before fir greta array created and initialisation of python) is different than the other two.
Created on 2021-06-09 by the reprex package (v2.0.0)