Error: TensorArray dtype is float32 but tensor has dtype undefined
See original GitHub issueTo get help from the community, check out our Google group.
TensorFlow.js version
tensorflowjs 0.5.6
Dependency versions:
keras 2.1.6
tensorflow 1.9.0
Browser version
Mac + Chrome 68.0.3440.84 64bit (Latest version)
Describe the problem or feature request
With the latest version of tfjs, I can succssfully converte
ssd_mobilenet_v1_coco_2018_01_28 to web model and load it.
(This is the Object Detection model)
But when I try to run model.executeAsync(),
the error as below happened.
tf-converter.esm.js?:formatted:6254 Uncaught (in promise) Error: TensorArray dtype is float32 but tensor has dtype undefined
at e.scatter (tf-converter.esm.js?:formatted:6254)
at eval (tf-converter.esm.js?:formatted:6388)
at eval (tf-converter.esm.js?:formatted:144)
at Object.eval [as next] (tf-converter.esm.js?:formatted:157)
at eval (tf-converter.esm.js?:formatted:64)
at new Promise (<anonymous>)
at __awaiter (tf-converter.esm.js?:formatted:43)
at executeOp$2 (tf-converter.esm.js?:formatted:6295)
at executeOp$15 (tf-converter.esm.js?:formatted:6772)
at eval (tf-converter.esm.js?:formatted:7070)
Code to reproduce the bug / link to feature request
The reproduce procedure is simple.
1. converte ssd_mobilenet_v1_coco_2018_01_28
2. load and run executeAsync()
My code is as below, it's written by React JSX:
componentDidMount = async () => {
this.model = new Model()
await this.model.load()
const tensor = tf.fromPixels(this.image).toFloat().expandDims(0)
this.model.model.executeAsync({
image_tensor: tensor,
}).then((result) => {
// TODO
})
}
I tried to read the sourcecode and find the error may happened in
tfjs-converter/src/executor/tensor_array.ts
scatter(indices: number[], tensor: Tensor) {
if (tensor.dtype !== this.dtype) {
throw new Error(`TensorArray dtype is ${
this.dtype} but tensor has dtype ${tensor.dtype}`);
}
// something else......
}
I set the breakpoint here and find the input parameter 'tensor' is not ts.Tensor but the Array.
So tensor.dtype is undefined.
Is this caused by my misuse or bugs?
Please help, thanks.
Issue Analytics
- State:
- Created 5 years ago
- Comments:18 (4 by maintainers)
Top Results From Across the Web
TensorArray dtype is double but Op is trying to write dtype float ...
The problem is that lang_model returns float32 s and map_fn says it returns float64 s. One way to fix the problem is to...
Read more >tf.TensorArray | TensorFlow v2.11.0
If the TensorArray is not dynamic, max_value=size() . value, (N+1)-D. Tensor of type dtype . The Tensor to unpack. name ...
Read more >Advent of Code 2021 in pure TensorFlow - day 3
TensorArray . Moreover, we'll find some limitations (bug?) of the TensorArray data type and we'll write some interesting utility that's not ...
Read more >tensorflow.python.ops.tensor_array_ops 源代码
Args: dtype: (required) data type of the TensorArray. size: (optional) int32 scalar `Tensor`: the ... TypeError: if handle is provided but is not...
Read more >Getting Started with tfautograph
Tensor(25.0, shape=(), dtype=float32) square_if_positive(y) #> tf. ... Undefined objects throw an informative error if you attempt to access them.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @Naikno, the fix is in and we are going to release TF.js
0.15.3
, which will happen by end of week (most likely Friday). At the same time, we will release new coco-ssd that depends on the 0.15.3. In the mean time, you have two options: use older version (0.14.1), or use the latest alpha release1.0.0-alpha3
Thanks, we’ll take a look ASAP. For now can you use 0.14.1?
cc @dsmilkov