Skip to content

Commit 0e7a6ca

Browse files
committed
comments
1 parent d669bfb commit 0e7a6ca

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

R/LearningRateSchedule.R

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#' Define a custom `LearningRateSchedule` class
22
#'
33
#' @description
4-
#' Subclass the keras learning rate schedule base class.
4+
#' Subclass the Keras `LearningRateSchedule` base class.
55
#'
66
#' You can use a learning rate schedule to modulate how the learning rate
77
#' of your optimizer changes over time.
@@ -35,19 +35,17 @@
3535
#' ```{r}
3636
#' my_custom_learning_rate_schedule <- LearningRateSchedule(
3737
#' classname = "MyLRSchedule",
38-
#' initialize = function( initial_learning_rate) {
3938
#'
39+
#' initialize = function(initial_learning_rate) {
4040
#' self$initial_learning_rate <- initial_learning_rate
4141
#' },
4242
#'
43-
#'
4443
#' call = function(step) {
4544
#' # note that `step` is a tensor
4645
#' # and call() will be traced via tf_function() or similar.
4746
#'
4847
#' str(step) # <KerasVariable shape=(), dtype=int64, path=SGD/iteration>
4948
#'
50-
#'
5149
#' # print 'step' every 1000 steps
5250
#' op_cond((step %% 1000) == 0,
5351
#' \() {tensorflow::tf$print(step); NULL},
@@ -116,5 +114,3 @@ LearningRateSchedule <- function(classname,
116114
)
117115

118116
}
119-
120-
# TODO: should all optimizer accept a plain R function to `learning_rate`?

R/applications.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3961,8 +3961,7 @@ set_preprocessing_attributes <- function(object, module) {
39613961
x = function(x) {
39623962
if (!is_py_object(x))
39633963
x <- np_array(x)
3964-
if (inherits(x, "numpy.ndarray") &&
3965-
!py_bool(x$flags$writeable))
3964+
if (inherits(x, "numpy.ndarray") && !py_bool(x$flags$writeable))
39663965
x <- x$copy()
39673966
x
39683967
}

R/layer-r-helpers.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ compose_layer <- function(object, layer, ...) {
7070

7171
# TODO: use formals(x) in py_to_r_wrapper.Layer() to construct a better wrapper fn
7272
# (( though, all layer.__call__ signatures are generally (...), unless user
73-
# implemented __call__() directly insteald of call() ))
73+
# implemented __call__() directly instead of call() ))
7474

7575
# This is used for:
7676
# - ALL layer instances (custom and builtin) and

0 commit comments

Comments
 (0)