How to convert DenseNDArray to NDArray ?
Open
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 928
- Forks
- 227
- PR merge metrics
- No merged PRs in 30d
Description
HI , when I read TfRecordDataset from tfrecord file , I get the data type is DenseNDArray ,actual is DenseTString, I want to convert it to TString data.
my code -scala version
val path = "/Volumes/Pink4T/transfer/code/github/stanford-tensorflow-tutorials/2017/data/friday.tfrecord"
val dataset = Dataset.tfRecordDataset(tf,path,"",0l).batch(10) // readData(path) //
// DenseNdArray
var count =0
for (outputs <- dataset) {
try {
val batch1 = outputs.get(count).asTensor.asInstanceOf[TString]
try {
val byteNdArray:NdArray[Array[Byte]]= batch1.asBytes().asInstanceOf[NdArray[Array[Byte]]] //ByteNdArray]
val bda = byteNdArray.asInstanceOf[DenseNdArray[TString]] // here !!! how to get SparseNdArray?
println(s"bda shape ${bda.shape()} ${kk.shape()}")
count = count + 1
} finally {
if (batch1 != null) batch1.close()
}
}
}
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
The report centers on Dataset.tfRecordDataset and the DenseNDArray, NDArray, and TString types in the Scala example. Start by tracing those APIs and the TensorFlow Java tensor-conversion documentation. Done means identifying and documenting a supported conversion path, or clearly recording that the requested conversion is unavailable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, scala, tensorflow
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100