How to use TfRecordDataset DatasetToTfRecord tf.io.tfRecordReader
Open
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 928
- Forks
- 227
- PR merge metrics
- No merged PRs in 30d
Description
tensorflow-java 0.4
spark 3.1
java 11
Hi :
Now I use tensorflow-java to read tfrecord file ,but can not get the data, and our not have example for it ,the TfRecordDataset DatasetToTfRecord tf.io.tfRecordReader java class have not same api like python ,could we give some example for how to use them. thank
import org.tensorflow.{Operand, Session,EagerSession}
import org.tensorflow.op.Ops
import org.tensorflow.op.data.TfRecordDataset
import org.tensorflow.op.data.{DatasetToTfRecord, TfRecordDataset}
val session = EagerSession.create
val tf = Ops.create(session)
val scope = tf.scope()
// val fileName =tf.constant( "/Users/zhanghaining/Downloads/tfrecord-kk2-test/")
val fileName = tf.constant("/Users/zhanghaining/Downloads/BigDL/spark/dl/src/test/resources/tf/mnist_train.tfrecord")
val compress = tf.constant("")
val bufferSize = tf.constant(0l)
val recordDataSet = TfRecordDataset.create(scope,fileName,compress,bufferSize)
val record = DatasetToTfRecord.create(scope, recordDataSet,fileName,compress)
val reader = tf.io.tfRecordReader()
println(record.op().name() )
println(record.op().`type`())
println(recordDataSet.op().numOutputs() )
println(recordDataSet.asOutput().dataType())
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the TfRecordDataset, DatasetToTfRecord, and tf.io.tfRecordReader entry points shown in the issue, and compare their Java APIs with the requested Python usage. Done means providing a working tensorflow-java example that reads TFRecord data and explains how these APIs are used.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, tensorflow
- Domain
- data, machine-learning
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100