Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
6b858c6
Prepare CRAN release v0.0.5
dfalbel Apr 22, 2026
c5424a6
Remove manual py_install step from pkgdown workflow
dfalbel Apr 22, 2026
cb023d9
Use py_require instead of manual py_install in CI
dfalbel Apr 22, 2026
cfc5a30
Also py_require tensorflow and tensorboard in test helper
dfalbel Apr 22, 2026
0794f50
Add py_require for tensorflow/tensorboard in hparams article
dfalbel Apr 22, 2026
f66b0be
Add reticulate Python bin dir to PATH for tensorboard CLI
dfalbel Apr 22, 2026
76e75bb
Launch tensorboard using full path from Python env
dfalbel Apr 22, 2026
3091620
Set CHROMOTE_CHROME env var for webshot2 in pkgdown workflow
dfalbel Apr 22, 2026
e881585
Add tensorboard() function to tfevents
dfalbel Apr 22, 2026
b6ea4fd
Pin tensorflow<=2.18 in articles and add tensorboard to pkgdown index
dfalbel Apr 23, 2026
5db8ae8
Use tensorflow::tensorboard() in articles with pinned tf version
dfalbel Apr 23, 2026
9f106cd
Pin tensorflow to 2.15.0 in articles
dfalbel Apr 23, 2026
e8bec0b
Require Python <=3.11 for tensorflow 2.15.0 compatibility
dfalbel Apr 23, 2026
5d9db43
Pin tensorflow to 2.14.0 in articles
dfalbel Apr 23, 2026
3399608
Pin numpy<2 for tensorflow 2.14 compatibility
dfalbel Apr 23, 2026
a1caa00
Revert articles to original, restore py_install with pinned tf 2.14
dfalbel Apr 23, 2026
c1cb963
Use python_version 3.11 in py_install for TF 2.14 compatibility
dfalbel Apr 23, 2026
2ef4474
Try tensorflow 2.13 in pkgdown workflow
dfalbel Apr 23, 2026
aa277d6
Try tensorflow 2.10 in pkgdown workflow
dfalbel Apr 23, 2026
b75790a
Use Python 3.9 for tensorflow 2.10 compatibility
dfalbel Apr 23, 2026
704e731
Use Python 3.10 for tensorflow 2.10 compatibility
dfalbel Apr 23, 2026
eaa8858
Pin setuptools<70 to restore pkg_resources for tensorboard CLI
dfalbel Apr 23, 2026
bb6d3c1
Remove pragma diagnostic directives from generated protobuf headers
dfalbel Apr 24, 2026
e77d55a
Keep both pragma suppression approaches in configure
dfalbel Apr 24, 2026
81c7790
Suppress deprecated/nodiscard warnings from generated protobuf code
dfalbel Apr 24, 2026
e44ec3e
Only py_require tbparse in test helper, not tensorflow
dfalbel Apr 27, 2026
8735bf9
Remove py_require from test helper to avoid side effects on CRAN
dfalbel Apr 27, 2026
2544ee5
Skip tensorflow-dependent test when not available, restore tbparse CI…
dfalbel Apr 27, 2026
8bf0e53
Also install tensorflow in check and test-coverage CI
dfalbel Apr 27, 2026
fedc7a4
Add skip_if_no_tensorflow helper that also skips on CRAN
dfalbel Apr 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@
^cran-comments\.md$
^CRAN-SUBMISSION$
^configure\.log$
^\.claude$
2 changes: 1 addition & 1 deletion .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: Install Python libraries used for testing
continue-on-error: true
run: |
reticulate::py_install(c("tbparse", "tensorflow"), pip = TRUE)
reticulate::py_install(c('tbparse', 'tensorflow'), pip = TRUE)
shell: Rscript {0}

- uses: r-lib/actions/check-r-package@v2
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
CHROMOTE_CHROME: google-chrome-stable
permissions:
contents: write
steps:
Expand All @@ -41,7 +42,7 @@ jobs:

- name: Install Python deps
run: |
reticulate::py_install('tensorflow', pip = TRUE)
reticulate::py_install(c('tensorflow==2.10', 'numpy<2', 'setuptools<70'), pip = TRUE, python_version = '3.10')
shell: Rscript {0}

- name: Build site
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

- name: Install Python libraries used for testing
run: |
reticulate::py_install(c("tbparse", "tensorflow"), pip = TRUE)
reticulate::py_install(c('tbparse', 'tensorflow'), pip = TRUE)
shell: Rscript {0}

- name: Test coverage
Expand Down
7 changes: 4 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
Package: tfevents
Title: Write Events for 'TensorBoard'
Version: 0.0.4.9000
Version: 0.0.5
Authors@R: c(
person("Daniel", "Falbel", email = "daniel@posit.co", role = c("aut", "cre", "cph")),
person("Daniel", "Falbel", email = "daniel@posit.co", role = c("aut", "cph")),
person("Tomasz", "Kalinowski", email = "tomasz@posit.co", role = c("cre")),
person(family = "Posit, PBC", role = c("cph")),
person(family = "The tl::optional authors", role = c("cph"), comment = "For the vendored tl::optional code."),
person("Mark", "Adler", role = c("cph"), comment = "For the included crc32c code.")
Expand All @@ -13,7 +14,7 @@ Description: Provides a convenient way to log scalars, images, audio, and histog
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.3
LinkingTo:
Rcpp
Imports:
Expand Down
4 changes: 4 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ S3method(as_event,character)
S3method(as_event,list)
S3method(as_event,numeric)
S3method(as_event,tfevents_summary_values)
S3method(as_tensor_proto,array)
S3method(as_tensor_proto,blob)
S3method(as_tensor_proto,character)
S3method(as_tensor_proto,list)
S3method(format,tfevents_event)
S3method(format,tfevents_summary)
S3method(format,tfevents_summary_values)
Expand Down
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# tfevents (development version)
# tfevents 0.0.5

* Changed maintainer to Tomasz Kalinowski.

# tfevents 0.0.4

Expand Down
2 changes: 1 addition & 1 deletion R/audio.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#' @param sample_rate The sample rate in Hz associated to the audio values.
#' @returns An audio summary that can be logged with [log_event()].
#' @family summary
#' @examples
#' @examplesIf rlang::is_installed("wav")
#' tmp <- tempfile()
#' with_logdir(tmp, {
#' summary_audio(array(runif(100), dim = c(1,100, 1)))
Expand Down
4 changes: 4 additions & 0 deletions R/tensor.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,23 @@ as_tensor_proto <- function(x, dtype = NA, ...) {
UseMethod("as_tensor_proto")
}

#' @exportS3Method
as_tensor_proto.blob <- function(x, dtype = NA, ...) {
if (is.na(dtype)) dtype <- "string"
if (!dtype %in% c("string"))
cli::cli_abort("dtype should be string when converting a blob to tensor proto.")
tensor_proto(list(x), shape = new_tensor_shape(dim = length(x)), dtype = dtype)
}

#' @exportS3Method
as_tensor_proto.character <- function(x, dtype = NA, ...) {
if (is.na(dtype)) dtype <- "string"
if (!dtype %in% c("string"))
cli::cli_abort("dtype should be string when converting a character to tensor proto.")
tensor_proto(list(x), shape = new_tensor_shape(dim = length(x)), dtype = dtype)
}

#' @exportS3Method
as_tensor_proto.array <- function(x, dtype = NA, ...) {
dims <- dim(x)
# proto store tensor data in C ordering, thus we need to reshape values
Expand All @@ -37,6 +40,7 @@ as_tensor_proto.array <- function(x, dtype = NA, ...) {
tensor_proto(x, shape = new_tensor_shape(dim = list(dims)), dtype = dtype)
}

#' @exportS3Method
as_tensor_proto.list <- function(x, dtype, ...) {
c(x, dtype) %<-% vec_recycle_common(x, dtype)
results <- lapply(seq_along(x), function(i) {
Expand Down
13 changes: 10 additions & 3 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,17 @@ if [ ! -d "generated" ]; then
'protoc -I "proto" --cpp_out="generated" {}' \;
fi

# copied from protolite:
# Suppress wanrings about pragmas in the autogenerated protobuf headers.
# Uwe + BDR have said this is OK and there is nothing we can do about this.
# Remove pragma diagnostic directives from autogenerated protobuf headers
# to avoid CRAN NOTEs about pragmas suppressing diagnostics.
find ./ -type f -name "*.pb.h" -exec sed -i.bak "s@ #pragma@/*nowarn*/#pragma@g" {} \;
find ./ -type f -name "*.pb.h" -exec sed -i.bak '/#pragma GCC diagnostic/d' {} \;

# Strip [[deprecated]] and [[nodiscard]] attributes from generated protobuf
# code to avoid compilation warnings on CRAN.
find ./ -type f \( -name "*.pb.h" -o -name "*.pb.cc" \) -exec sed -i.bak \
-e 's/\[\[deprecated\]\]//g' \
-e 's/\[\[nodiscard\]\]//g' \
-e 's/enum \(.*\) : int/enum \1 : int/' {} \;

PB_SRC=$(echo $(find generated -type f -name "*.pb.cc" -print))
CPP_SRC=$(echo $(find *.cpp -print))
Expand Down
2 changes: 2 additions & 0 deletions man/summary_audio.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ tensorboard::Event EventFileIterator::get_next () {
file.read(&buffer[0], length);

tensorboard::Event event;
event.ParseFromString(std::string(buffer.begin(), buffer.end()));
(void)event.ParseFromString(std::string(buffer.begin(), buffer.end()));

file.read(reinterpret_cast<char*>(&crc), sizeof(std::uint32_t));

Expand Down
6 changes: 6 additions & 0 deletions tests/testthat/helper-tbparse.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ skip_if_tbparse_not_available <- function() {
skip_if(inherits(try(reticulate::import("tbparse"), silent = TRUE), "try-error"))
}

skip_if_no_tensorflow <- function() {
skip_on_cran()
skip_if_not_installed("tensorflow")
skip_if(inherits(try(reticulate::import("tensorflow"), silent = TRUE), "try-error"))
}

if (inherits(try(reticulate::import("tbparse"), silent = TRUE), "try-error")) {
tbparse <- NULL
} else {
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-audio.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
test_that("can write an audio file", {
skip_if_not_installed("wav")
f <- wav::read_wav(test_path("resources/test-audio.wav"))
audio <- array(t(f), dim = c(1, rev(dim(f))))

Expand All @@ -21,6 +22,7 @@ test_that("can write an audio file", {
})

test_that("can write multiple audio files from a array", {
skip_if_not_installed("wav")
f <- wav::read_wav(test_path("resources/test-audio.wav"))
f_t <- t(f)
audio <- array(0, dim = c(10, rev(dim(f))))
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-image.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ test_that("write image", {


skip_if_tbparse_not_available()
skip_if_no_tensorflow()
reader <- tbparse$SummaryReader(temp)
buf <- reader$tensors$value[[1]][[3]]
# TODO: in theory we don't need tensorflow for this, but couldnt find a way to
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-read.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ test_that("can iterate over events", {
})

test_that("can extract value", {
skip_if_not_installed("wav")

temp <- tempfile()

Expand Down
Loading