Skip to content
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

model.Exec: panic: Cannot parse tensor from proto: dtype: DT_VARIANT #47

Open
9nut opened this issue Mar 26, 2021 · 1 comment
Open

Comments

@9nut
Copy link

9nut commented Mar 26, 2021

Here's the example I'm trying:
https://gist.github.com/9nut/f95bb4cbe9c223e9f73a9e06429f71ac

I get a panic, an error message similar to this tensorflow issue that @galeone also commented on:
tensorflow/tensorflow#44428

Here's the output from my attempt:

2021-03-26 14:00:39.257859: I tensorflow/cc/saved_model/reader.cc:32] Reading SavedModel from: ./centernet_hourglass_512x512_kpts_1
2021-03-26 14:00:39.657372: I tensorflow/cc/saved_model/reader.cc:55] Reading meta graph with tags { serve }
2021-03-26 14:00:39.657419: I tensorflow/cc/saved_model/reader.cc:93] Reading SavedModel debug info (if present) from: ./centernet_hourglass_512x512_kpts_1
2021-03-26 14:00:39.657502: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: SSE4.2 AVX AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-03-26 14:00:41.293101: I tensorflow/cc/saved_model/loader.cc:206] Restoring SavedModel bundle.
2021-03-26 14:00:46.853281: I tensorflow/cc/saved_model/loader.cc:190] Running initialization op on SavedModel bundle at path: ./centernet_hourglass_512x512_kpts_1
2021-03-26 14:00:48.256126: I tensorflow/cc/saved_model/loader.cc:277] SavedModel load for tags { serve }; Status: success: OK. Took 8998267 microseconds.
2021-03-26 14:00:53.231174: W tensorflow/core/grappler/optimizers/loop_optimizer.cc:906] Skipping loop optimization for Merge node with control input: StatefulPartitionedCall/StatefulPartitionedCall/cond/then/_1776/cond/Assert_3/AssertGuard/branch_executed/_1989
2021-03-26 14:00:54.407937: E tensorflow/core/framework/tensor.cc:555] Could not decode variant with type_name: "tensorflow::TensorList". Perhaps you forgot to register a decoder via REGISTER_UNARY_VARIANT_DECODE_FUNCTION?
2021-03-26 14:00:54.407991: W tensorflow/core/framework/op_kernel.cc:1740] OP_REQUIRES failed at constant_op.cc:79 : Invalid argument: Cannot parse tensor from tensor_proto.
2021-03-26 14:00:54.442763: E tensorflow/core/framework/tensor.cc:555] Could not decode variant with type_name: "tensorflow::TensorList". Perhaps you forgot to register a decoder via REGISTER_UNARY_VARIANT_DECODE_FUNCTION?
2021-03-26 14:00:54.443281: W tensorflow/core/framework/op_kernel.cc:1740] OP_REQUIRES failed at constant_op.cc:79 : Invalid argument: Cannot parse tensor from proto: dtype: DT_VARIANT
tensor_shape {
}
variant_val {
type_name: "tensorflow::TensorList"
metadata: "\000\001\377\377\377\377\377\377\377\377\377\001\022\002\010\004"
tensors {
dtype: DT_FLOAT
tensor_shape {
dim {
size: 4
}
}
float_val: 0
float_val: 0
float_val: 1
float_val: 1
}
}

panic: Cannot parse tensor from proto: dtype: DT_VARIANT
tensor_shape {
}
variant_val {
type_name: "tensorflow::TensorList"
metadata: "\000\001\377\377\377\377\377\377\377\377\377\001\022\002\010\004"
tensors {
dtype: DT_FLOAT
tensor_shape {
dim {
size: 4
}
}
float_val: 0
float_val: 0
float_val: 1
float_val: 1
}
}

     [[{{node StatefulPartitionedCall/StatefulPartitionedCall/map/TensorArrayUnstack_1/TensorListFromTensor/_0__cf__1}}]]

goroutine 1 [running]:
github.com/galeone/tfgo.(*Model).Exec(0xc00012c030, 0xc003f2fe20, 0x1, 0x1, 0xc003f2fe68, 0x0, 0xc013463ea8, 0x1)
$GOPATH/GoPkgs/pkg/mod/github.com/galeone/[email protected]/model.go:73 +0xd7
main.inferCenterNet()
$HOME/src/savedmodelsrv/runinfer.go:80 +0x4c5
main.main()
$HOME/src/savedmodelsrv/main.go:60 +0x25
$

@galeone
Copy link
Owner

galeone commented Mar 27, 2021

Sadly, this is a well-known problem in the TensorFlow C library (not related to Go or the Go bindings).

Your only option is to compile tensorflow by yourself, after applying this patch that, for some reason, is not yet merged in the latest tensorflow release.

It was November 2020 (!) when I reported this on my blog too (see https://pgaleone.eu/tensorflow/go/2020/11/27/deploy-train-tesorflow-models-in-go-human-activity-recognition/#conclusion -> disclaimer).

It seems the tensorflow team is not interested in putting into production RNNs - that's crazy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants