TF Python producing malformed JSON for numpy style arrays.

オープン
#444 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
22/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
java, python, tensorflow
領域
api, backend

調査の方向性

まず、issue に示されている TF Python のシリアライズを再現し、TF Java NdArray のデータがどのように GSON のパース処理に到達するかを追跡します。提案されている配列表現を OpenJData 形式と比較し、期待される互換性の動作を定義します。形式とシリアライズ/デシリアライズの責任範囲について合意され、形式不正な JSON が生成されなくなれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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?

主要言語
Java
スター
928
フォーク
227
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

tensorflow/java のほかの issue

tensorflow/java の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。