TF Python producing malformed JSON for numpy style arrays.
Nessuno ha ancora preso questa issue.
- Lingua principale
- Java
- Stelle
- 928
- Fork
- 227
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
TF Python serializes numpy style arrays (e.g. Java NdArray) in the format 'normalizer': array([[0.2, 0.2], [0.1, 0.3]], dtype=float32)'.
This is not standard JSON, and tools, like GSON, throw a MalformedJsonException when trying to parse this.
The issue is how to best handle this in TF Java.
I have looked at GSON using customized TypeAdapter and Serilaizers/Deserializers, but I cannot get past the low level parsing throwing the MalformedJsonException. Right now I think my only alternative is to write a pre-parser to convert the array() format string to a wellformed JSON string.
For example, for the above example:
{
'normalizer': {
" '_ArraySize_' = [1,2],
" '_ArrayData_' = [[0.2, 0.2], [0.1, 0.3]],
" '_ArrayType_' = 'float32'
}
}
_ArraySize_ is the array's shape and _ArrayType_ is the datatype for the NdArray.
This format is taken from OpenJData
Also, once we settle on a way to do this, should the NdArray package be modified to include serialize/deserialize methods.
What about compatibility with TF Python?
Any suggestions?
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia riproducendo la serializzazione TF Python mostrata nell’issue e tracciando come i dati TF Java NdArray arrivano al parsing di GSON. Confronta la rappresentazione dell’array proposta con il formato OpenJData e definisci il comportamento di compatibilità previsto; il lavoro sarà considerato completato quando saranno concordati il formato e la responsabilità della serializzazione/deserializzazione e non verrà più prodotto JSON malformato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java, python, tensorflow
- Ambito
- api, backend
- Tipo di issue
- Bug
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 22/100