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.

`ValueError: setting an array element with a sequence.` while using grad

See original GitHub issue

Hello all, I am using grad for calculating the derivative of my fitness function. However I am getting a value error as following:

ValueError: setting an array element with a sequence.

I printed the type and value of the final output and find that the value contains the text also. Can anyone suggest me what should I do ?

Print of Type and Value:

Type of Output  <class 'autograd.numpy.numpy_boxes.ArrayBox'>
Value of Output=  Autograd ArrayBox with value Autograd ArrayBox with value Autograd ArrayBox with value Autograd ArrayBox with value -32.248885305979115

I suppose, because of that text the function creating problem while return the value. Looking forward for your help. Thank You

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:3
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

12reactions
duvenaudcommented, Oct 8, 2020

I suspect you can fix these problems by changing import numpy as np to import autograd.numpy as np

0reactions
josh-bonecommented, Oct 7, 2020

Sorry, I’ve edited it to be reproducible. I forgot I was loading the data from file at first.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ValueError: setting an array element with a sequence.
Python Autograd Not working "ValueError: setting an array element with a ... I am trying to compute the Jacobian of this function but...
Read more >
How to Fix: ValueError: setting an array element with a ...
Easiest way to fix this problem is to use the data-type which support all type of data-type. · Second way to fix this...
Read more >
ValueError setting an array element with a sequence - Edureka
I am getting this error: File "mypath\mypythonscript.py", line 3484, in secondfunction RRDuringArray = ... explain to me how to fix this ...
Read more >
ValueError: setting an array element with a sequence
However, it's almost never a good idea to use for loop to assign elements to a tensor. In your case, you should try...
Read more >
Using sklearn in cost function - PennyLane Help
I am trying to use sklearn regression within my cost function, but that seems to ... ValueError: setting an array element with a...
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