Skip to content

Unpacking/Preprocess-ing of Dictionaries #47

@PhilipVinc

Description

@PhilipVinc

Following #46 I realised that Optimums stores optimisation metadata in Dictionaries.

Right now, if a dictionary is logged to TBLogger (or if it's found while unpacking other structs) it is treated like any other struct, and it's internal fields are recursively logged:

Julia> using TensorBoardLogger
julia> data = TensorBoardLogger.preprocess("dict", Dict(:a=>1, :b=>2), [])
8-element Array{Any,1}:
    "dict/slots" => UInt8[0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
     "dict/keys" => Symbol[:a, :b, #undef, #undef, #undef, #undef, #undef, #undef, #undef, #undef, #undef, #undef, #undef, #undef, #undef, #undef]
     "dict/vals" => [1, 2, 32, 1, 11, 2, 4628399872, 108, 24, 4628399872, 4628400112, 4628402464, 4628400112, 4628398656, 4628400112, 4426404768]
     "dict/ndel" => 0
    "dict/count" => 2
      "dict/age" => 0x0000000000000002
 "dict/idxfloor" => 1
 "dict/maxprobe" => 0

I think we should treat dictionaries with String and Symbol keys as we treat structures, and further preprocess key-value pairs.

Although, people often don't specialise the key type and use Dict{Any,Any} (Optim does that).
In this case, we could check if a string representation of every key exists, otherwise log them both as text?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions