Skip to content

Instantly share code, notes, and snippets.

@ghorn
Created July 5, 2017 22:24
Show Gist options
  • Save ghorn/b4a94b16c803480c6a14da21a1aae17c to your computer and use it in GitHub Desktop.
Save ghorn/b4a94b16c803480c6a14da21a1aae17c to your computer and use it in GitHub Desktop.
switch dimension mismatch
from casadi import *
x = MX.sym('x')
c = MX.sym('c')
z0 = conditional(c, [0, 1], 3)
#z0 = conditional(c, [x, x], 3) # works
f = z0 + x
#f = z0 # works
#f = x # works
print gradient(f, x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment