-
Notifications
You must be signed in to change notification settings - Fork 74k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Go TensorFlow 1.4.0: DataType 21 is not supported #14806
Comments
@mrry could you please take a look. |
I think
I'm not sure why it's not supported in the Go API, but there is a TODO here: tensorflow/tensorflow/go/tensor.go Line 237 in ab0fcac
Since I believe @keveman is busy with other things ;), I'm reassigning this to @asimshankar who owns the Go API. |
As @mrry mentioned, Note that the package main
import (
"fmt"
tf "github.com/tensorflow/tensorflow/tensorflow/go"
"github.com/tensorflow/tensorflow/tensorflow/go/op"
)
func main() {
s := op.NewScope()
dataset := op.TextLineDataset(s,
op.Const(s.SubScope("filename"), "dataset.txt"),
op.Const(s.SubScope("compression_type"), ""),
op.Const(s.SubScope("buffer_size"), int64(1)),
)
outputTypes := []tf.DataType{tf.String}
outputShapes := []tf.Shape{tf.ScalarShape()}
iterator := op.Iterator(s, "", "", outputTypes, outputShapes)
next := op.IteratorGetNext(s, iterator, outputTypes, outputShapes)
initIterator := op.MakeIterator(s, dataset, iterator)
graph, err := s.Finalize()
if err != nil {
panic(err)
}
sess, err := tf.NewSession(graph, nil)
if err != nil {
panic(err)
}
if _, err = sess.Run(nil, nil, []*tf.Operation{initIterator}); err != nil {
panic(err)
}
results, err := sess.Run(nil, next, []*tf.Operation{})
if err != nil {
panic(err)
}
v := results[0].Value()
fmt.Printf("%T: %v\n", v, v)
} I agree the error message can be improved, will try to write up a change for that. |
I didn't have any expectations regarding what dataset.Value() returns, I was just playing with the OP to see what it did and was surprised by the error. Now that you have shown me the usage of op.Iterator(), I know how to use datasets correctly, and don't need dataset.Value() to return anything in particular. Just a clearer error message would be nice. Does there currently exist documentation / tutorials for the Go bindings beyond the GoDocs? I'm writing some Go TensorFlow tutorials and would be happy to contribute. |
Unfortunately, no, there isn't any additional documentation beyond the godoc. We look forward to your tutorials and more community support/contributions. Thanks! |
Closes tensorflow#14806 PiperOrigin-RevId: 177263469
System information
Describe the problem
Calling the Value() method on the evaluated output tensor of dataset related operations from the go package fails with the error
DataType 21 is not supported
. It looks likeop.TextLineDataset()
produces a tensor of typetf.Half
can't be converted to a go type?I may be using the datasets wrong. If so, the error and/or documentation should be improved.
Source code / logs
Produces:
The text was updated successfully, but these errors were encountered: