diff --git a/DESCRIPTION b/DESCRIPTION index 23dc30827..b37c83ff8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: keras3 Type: Package Title: R Interface to 'Keras' -Version: 0.2.0.9000 +Version: 1.0.0 Authors@R: c( person("Tomasz", "Kalinowski", role = c("aut", "cph", "cre"), email = "tomasz@posit.co"), diff --git a/NEWS.md b/NEWS.md index b3f23133d..f069c2d83 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,10 +1,23 @@ -# keras3 (development version) +# keras3 1.0.0 - Chains of `layer_*` calls with `|>` now instantiate layers in the same order as `%>%` pipe chains: left-hand-side first (#1440). - `iterate()`, `iter_next()` and `as_iterator()` are now reexported from reticulate. + +User facing changes with upstream Keras v3.3.3: + +- new functions: `op_slogdet()`, `op_psnr()` + +- `clone_model()` gains new args: `call_function`, `recursive` + Updated example usage. + +- `op_ctc_decode()` strategy argument has new default: `"greedy"`. + Updated docs. + +- `loss_ctc()` default name fixed, changed to `"ctc"` + User facing changes with upstream Keras v3.3.2: - new function: `op_ctc_decode()` diff --git a/R/applications.R b/R/applications.R index 92694a481..50b95e60c 100644 --- a/R/applications.R +++ b/R/applications.R @@ -2642,7 +2642,7 @@ function (input_shape = NULL, alpha = 1, include_top = TRUE, #' #' # Reference #' - [Searching for MobileNetV3]( -#' https://arxiv.org/pdf/1905.02244.pdf) (ICCV 2019) +#' https://arxiv.org/pdf/1905.02244) (ICCV 2019) #' #' The following table describes the performance of MobileNets v3: #' ------------------------------------------------------------------------ @@ -2788,7 +2788,7 @@ function (input_shape = NULL, alpha = 1, minimalistic = FALSE, #' #' # Reference #' - [Searching for MobileNetV3]( -#' https://arxiv.org/pdf/1905.02244.pdf) (ICCV 2019) +#' https://arxiv.org/pdf/1905.02244) (ICCV 2019) #' #' The following table describes the performance of MobileNets v3: #' ------------------------------------------------------------------------ diff --git a/R/losses.R b/R/losses.R index 9435444a6..4981aca12 100644 --- a/R/losses.R +++ b/R/losses.R @@ -131,7 +131,7 @@ function (y_true, y_pred, from_logits = FALSE, label_smoothing = 0, #' Computes focal cross-entropy loss between true labels and predictions. #' #' @description -#' According to [Lin et al., 2018](https://arxiv.org/pdf/1708.02002.pdf), it +#' According to [Lin et al., 2018](https://arxiv.org/pdf/1708.02002), it #' helps to apply a focal factor to down-weight easy examples and focus more on #' hard examples. By default, the focal tensor is computed as follows: #' @@ -157,7 +157,7 @@ function (y_true, y_pred, from_logits = FALSE, label_smoothing = 0, #' when `from_logits=TRUE`) or a probability (i.e, value in `[0., 1.]` when #' `from_logits=FALSE`). #' -#' According to [Lin et al., 2018](https://arxiv.org/pdf/1708.02002.pdf), it +#' According to [Lin et al., 2018](https://arxiv.org/pdf/1708.02002), it #' helps to apply a "focal factor" to down-weight easy examples and focus more #' on hard examples. By default, the focal tensor is computed as follows: #' @@ -274,13 +274,13 @@ function (y_true, y_pred, from_logits = FALSE, label_smoothing = 0, #' @param alpha #' A weight balancing factor for class 1, default is `0.25` as #' mentioned in reference [Lin et al., 2018]( -#' https://arxiv.org/pdf/1708.02002.pdf). The weight for class 0 is +#' https://arxiv.org/pdf/1708.02002). The weight for class 0 is #' `1.0 - alpha`. #' #' @param gamma #' A focusing parameter used to compute the focal factor, default is #' `2.0` as mentioned in the reference -#' [Lin et al., 2018](https://arxiv.org/pdf/1708.02002.pdf). +#' [Lin et al., 2018](https://arxiv.org/pdf/1708.02002). #' #' @param from_logits #' Whether to interpret `y_pred` as a tensor of @@ -450,7 +450,7 @@ function (y_true, y_pred, from_logits = FALSE, label_smoothing = 0, #' `class_weights`. We expect labels to be provided in a `one_hot` #' representation. #' -#' According to [Lin et al., 2018](https://arxiv.org/pdf/1708.02002.pdf), it +#' According to [Lin et al., 2018](https://arxiv.org/pdf/1708.02002), it #' helps to apply a focal factor to down-weight easy examples and focus more on #' hard examples. The general formula for the focal loss (FL) #' is as follows: diff --git a/R/metrics.R b/R/metrics.R index ddcd5d861..2308f4a3c 100644 --- a/R/metrics.R +++ b/R/metrics.R @@ -3,7 +3,7 @@ #' Computes the binary focal crossentropy loss. #' #' @description -#' According to [Lin et al., 2018](https://arxiv.org/pdf/1708.02002.pdf), it +#' According to [Lin et al., 2018](https://arxiv.org/pdf/1708.02002), it #' helps to apply a focal factor to down-weight easy examples and focus more on #' hard examples. By default, the focal tensor is computed as follows: #' diff --git a/R/model-training.R b/R/model-training.R index a1d3fdb1c..c71537b8f 100644 --- a/R/model-training.R +++ b/R/model-training.R @@ -269,17 +269,20 @@ function (object, x = NULL, y = NULL, ..., batch_size = NULL, verbose = as_model_verbose_arg), ignore = "object", force = "verbose") - args[["return_dict"]] <- FALSE + + ## return_dict=TRUE because object$metrics_names returns wrong value + ## (e.g., "compile_metrics" instead of "mae") + args[["return_dict"]] <- TRUE if(inherits(args$x, "tensorflow.python.data.ops.dataset_ops.DatasetV2") && !is.null(args$batch_size)) stop("batch_size can not be specified with a TF Dataset") result <- do.call(object$evaluate, args) - if (length(result) > 1L) { - result <- as.list(result) - names(result) <- object$metrics_names - } + # if (length(result) > 1L) { ## if return_dict=FALSE + # result <- as.list(result) + # names(result) <- object$metrics_names + # } tfruns::write_run_metadata("evaluation", unlist(result)) @@ -761,11 +764,12 @@ function (object, x, y = NULL, sample_weight = NULL, ...) result <- object$test_on_batch(as_array(x), as_array(y), as_array(sample_weight), ..., - return_dict = FALSE) - if (length(result) > 1L) { - result <- as.list(result) - names(result) <- object$metrics_names - } else if (is_scalar(result)) { + return_dict = TRUE) + # if (length(result) > 1L) { + # result <- as.list(result) + # names(result) <- object$metrics_names + # } else + if (is_scalar(result)) { result <- result[[1L]] } result @@ -824,11 +828,12 @@ function (object, x, y = NULL, sample_weight = NULL, class_weight = NULL) as_array(y), as_array(sample_weight), class_weight = as_class_weight(class_weight), - return_dict = FALSE) - if (length(result) > 1L) { - result <- as.list(result) - names(result) <- object$metrics_names - } else if (is_scalar(result)) { + return_dict = TRUE) + # if (length(result) > 1L) { + # result <- as.list(result) + # names(result) <- object$metrics_names + # } else + if (is_scalar(result)) { result <- result[[1L]] } diff --git a/R/optimizers-schedules.R b/R/optimizers-schedules.R index 231897c25..5af2955fa 100644 --- a/R/optimizers-schedules.R +++ b/R/optimizers-schedules.R @@ -7,7 +7,7 @@ #' SGDR: Stochastic Gradient Descent with Warm Restarts. #' #' For the idea of a linear warmup of our learning rate, -#' see [Goyal et al.](https://arxiv.org/pdf/1706.02677.pdf). +#' see [Goyal et al.](https://arxiv.org/pdf/1706.02677). #' #' When we begin training a model, we often want an initial increase in our #' learning rate followed by a decay. If `warmup_target` is an int, this diff --git a/docs/404.html b/docs/404.html index e10bb8028..1c8c9e7f6 100644 --- a/docs/404.html +++ b/docs/404.html @@ -31,7 +31,7 @@ keras3 - 0.2.0.9000 + 1.0.0