question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: dot support for x of rank 4 is not yet implemented

See original GitHub issue

TensorFlow.js version

0.12.5

Browser version

Node v8.9.1

Describe the problem or feature request

I am using Tensorflow.js to predict on a model I trained in Keras. However, when I feed in my 4-dimensional tensor I get the following error:

UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: dot support for x of rank 4 is not yet implemented: x shape = 32,1,1,100

I assume this means the functionality is not available yet to do tf.dot with a 4d vector. However, I am calling tf.model.predict so I guess tf.dot is called internally? Does this mean it is impossible to run predictions on 4d vectors at this point? It just seems strange that I haven’t been able to find anything about this on the web or in the docs…

Code to reproduce the bug / link to feature request

If you want to reproduce the bug, here is a simple github project with my model and relevant code.

Otherwise, here is the relevant code:

noise_tensor.print(true)
 generated_images = model.predict(noise_tensor) //error occours here

…and this is the print output of noise_tensor:

Tensor
  dtype: float32
  rank: 4
  shape: [64,1,1,100]
  values:
    [ [ [[0.3799773 , -0.0252707, 0.0118336 , ..., 0.1703698 , -0.0649208, 0.2152225 ],]],


      [ [[0.219656  , 0.2850143 , -0.1078744, ..., 0.1627689 , -0.0838831, -0.1112608],]],


      [ [[-0.1295149, -0.08308  , 0.1872116 , ..., -0.2033772, -0.4184959, -0.3357461],]],


     ...
      [ [[0.0029674 , 0.0422036 , 0.067896  , ..., 0.1368463 , 0.1122015 , -0.0395375],]],


      [ [[0.043546  , -0.0281712, 0.0898769 , ..., 0.205565  , 0.1444133 , 0.0067788 ],]],


      [ [[-0.1089588, -0.0161969, -0.0724337, ..., 0.1427118 , -0.2577117, 0.0013836 ],]]]

In my repository, I put the python code I used to train (and predict) my model with Keras. I’m not sure if it’s relevant, but if you want to take a look, it’s here.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
bileschicommented, Sep 4, 2018

This should be fixed at the next minor release.

1reaction
bileschicommented, Aug 23, 2018

I’m able to reproduce the problem, working on adding the missing nd mat feature

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Error in dot: inputs must all be rank 1 or 2, but got ranks 2 ...
The error is caused by: weights = weights - ((xs.transpose().reshape([1,20])).dot(deltas_scaled.reshape([20,1]))).mul(learning_rate); baises = baises ...
Read more >
Does tfjs currently support RGB images? - Google Groups
... following error: "Error: dot support for x of rank 4 is not yet implemented: x ... This means that it's not possible...
Read more >
[Patch, Fortran] assumed-rank some bound intrinsics support, fix ...
* There was a proper check missing that assumed-rank arrays may not have a codimension. (There are now checks in array.c, decl.c and...
Read more >
82269 - Implement startOffsetTime support in media tags
I got someone in Opera interested in looking at it. Mozilla have sniffed it lately, but still they want to wait for some...
Read more >
Package 'data.table' - R Project
Support for non-equi join was recently implemented, which allows for other ... X = data.table(x=c("c","b"), v=8:7, foo=c(4,2)). X.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found