File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
cvxpy/reductions/solvers/nlp_solvers/diff_engine Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -263,6 +263,16 @@ def _convert_special_index(expr, children):
263263
264264 return _diffengine .make_index (children [0 ], d1 , d2 , idxs )
265265
266+ def _convert_prod (expr , children ):
267+ axis = expr .axis
268+ if axis is None :
269+ return _diffengine .make_prod (children [0 ])
270+ elif axis == 0 :
271+ return _diffengine .make_prod_axis_zero (children [0 ])
272+ elif axis == 1 :
273+ raise NotImplementedError ("Prod along axis=1 not yet supported" )
274+ #return _diffengine.make_prod_axis_one(children[0])
275+
266276# Mapping from CVXPY atom names to C diff engine functions
267277# Converters receive (expr, children) where expr is the CVXPY expression
268278ATOM_CONVERTERS = {
@@ -304,7 +314,7 @@ def _convert_special_index(expr, children):
304314 "reshape" : _convert_reshape ,
305315 "broadcast_to" : _convert_broadcast ,
306316 # Reductions returning scalar
307- "Prod" : lambda _expr , children : _diffengine . make_prod ( children [ 0 ]) ,
317+ "Prod" : _convert_prod ,
308318}
309319
310320
You can’t perform that action at this time.
0 commit comments