Skip to content

Commit 0e3f96d

Browse files
committed
fix k_set_epsilon() and k_set_floatx() for tf
1 parent 9ebc193 commit 0e3f96d

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

R/backend.R

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -867,9 +867,7 @@ k_epsilon <- function() {
867867
#' @rdname k_epsilon
868868
#' @export
869869
k_set_epsilon <- function(e) {
870-
keras$backend$set_epsilon(
871-
e = e
872-
)
870+
keras$backend$set_epsilon(e)
873871
}
874872

875873

@@ -994,9 +992,7 @@ k_floatx <- function() {
994992
#' @rdname k_floatx
995993
#' @export
996994
k_set_floatx <- function(floatx) {
997-
keras$backend$set_floatx(
998-
floatx = floatx
999-
)
995+
keras$backend$set_floatx(floatx)
1000996
}
1001997

1002998

tests/testthat/test-backend.R

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,16 @@ test_backend("k_concatenate", {
115115
k_concatenate(list(x, y), 1)
116116
})
117117

118+
test_backend("k_set_floatx", {
119+
skip_if_cntk()
120+
skip_if_theano()
121+
k_set_floatx("float16")
122+
expect_identical(k_floatx(), "float16")
123+
})
124+
125+
test_backend("k_set_epsilon", {
126+
skip_if_cntk()
127+
skip_if_theano()
128+
k_set_epsilon(1e-4)
129+
expect_equal(k_epsilon(), 1e-4)
130+
})

0 commit comments

Comments
 (0)