Skip to content

Commit 232e4ee

Browse files
committed
Update TensorboardLogger
Use hasproperty instead of isdefined on prototypes bump version to 0.1.13 bump ProtoBuf required version to 0.10 fix project
1 parent 407eb3d commit 232e4ee

File tree

13 files changed

+35
-30
lines changed

13 files changed

+35
-30
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ docs/build
55
test/test_logs
66

77
gen/proto
8-
gen/protojl
8+
gen/protojl

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "TensorBoardLogger"
22
uuid = "899adc3e-224a-11e9-021f-63837185c80f"
33
authors = ["Filippo Vicentini <filippovicentini@gmail.com>"]
4-
version = "0.1.12"
4+
version = "0.1.13"
55

66
[deps]
77
CRC32c = "8bf52ea8-c179-5cab-976a-9e18b702a9bc"
@@ -18,7 +18,7 @@ ColorTypes = "0.7, 0.8, 0.9, 0.10"
1818
FileIO = "1"
1919
FixedPointNumbers = "0.6, 0.7, 0.8"
2020
ImageCore = "0.7, 0.8"
21-
ProtoBuf = "0.9.1"
21+
ProtoBuf = "0.10"
2222
Requires = "0.5, 1"
2323
StatsBase = "0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33"
2424
julia = "0.7, 1"

compat/Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "TensorBoardLogger"
22
uuid = "899adc3e-224a-11e9-021f-63837185c80f"
33
authors = ["Filippo Vicentini <filippovicentini@gmail.com>"]
4-
version = "0.1.12"
4+
version = "0.1.13"
55

66
[deps]
77
CRC32c = "8bf52ea8-c179-5cab-976a-9e18b702a9bc"
@@ -18,7 +18,7 @@ ColorTypes = "0.7, 0.8, 0.9, 0.10"
1818
FileIO = "1"
1919
FixedPointNumbers = "0.6, 0.7, 0.8"
2020
ImageCore = "0.7, 0.8"
21-
ProtoBuf = "0.7, 0.8"
21+
ProtoBuf = "0.10"
2222
Requires = "0.5, 1"
2323
StatsBase = "0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33"
2424
julia = "0.7, 1"

src/Deserialization/deserialization.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ end
9494
Returns the type of a summary
9595
"""
9696
function summary_type(summary)
97-
if isdefined(summary, :histo)
97+
if hasproperty(summary, :histo)
9898
return :histo
99-
elseif isdefined(summary, :image)
99+
elseif hasproperty(summary, :image)
100100
return :image
101-
elseif isdefined(summary, :audio)
101+
elseif hasproperty(summary, :audio)
102102
return :audio
103-
elseif isdefined(summary, :tensor)
103+
elseif hasproperty(summary, :tensor)
104104
return :tensor
105-
#elseif isdefined(summary, :simple_value)
105+
#elseif hasproperty(summary, :simple_value)
106106
end
107107
# always defined
108108
return :simple_value
@@ -212,7 +212,7 @@ function map_summaries(fun::Function, logdir; purge=true, tags=nothing, steps=no
212212
for event in event_file
213213
# if event.summary is not defined, don't bother processing this event,
214214
# as it's probably a "start file" event or a graph event.
215-
!isdefined(event, :summary) && continue
215+
!hasproperty(event, :summary) && continue
216216

217217
step = event.step
218218
steps !== nothing && step steps && continue
@@ -239,7 +239,7 @@ When the keyword argument `purge==true`, if the i+1-th file begins with a purge
239239
at step `s`, the i-th file is read only up to step `s`.
240240
241241
Also metadata events, without any real data attached are mapped.
242-
You can detect those by `isdefined(event, :summary) == false`
242+
You can detect those by `hasproperty(event, :summary) == false`
243243
244244
Optional kwargs `steps` takes as input a collection of integers, and will
245245
only iterate across events with step within that collection.

src/Deserialization/histograms.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function deserialize_histogram_summary(summary)
22
# custom deserialization
3-
if isdefined(summary, :metadata)
3+
if hasproperty(summary, :metadata)
44
if summary.metadata.plugin_data.plugin_name == TB_PLUGIN_JLARRAY_NAME
55
val = reshape(summary.histo.bucket,
66
reinterpret(Int,

src/Deserialization/tensor.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using .tensorboard: TextPluginData
2+
13
function deserialize_tensor_summary(summary)
24
metadata = summary.metadata
35
plugin_data = metadata.plugin_data

src/Loggers/LogAudio.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using .tensorboard: Summary_Audio
2+
13
"""
24
log_audios(logger::TBLogger, name::AbstractString, samples::AbstractArray, samplerate::Real; step=step(logger))
35

src/Loggers/LogHistograms.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using .tensorboard: HistogramProto
2+
13
"""
24
log_histogram(logger, name, (bins,weights); step=step(logger))
35

src/Loggers/LogImage.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using .tensorboard: Summary_Image
2+
13
function image_summary(name::AbstractString, img::PngImage)
24

35
attr = img.attr

src/Loggers/LogText.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using .tensorboard: TextPluginData
2+
13
"""
24
log_text(logger::TBLogger, name::String, text::Any; step=step(logger))
35

0 commit comments

Comments
 (0)