You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cSTIR_computeObjectiveFunctionGradient(void* ptr_f, void* ptr_i, int subset, void* ptr_g)
ObjectiveFunction gradient incorrect when passed the same object for input argument and out
Fails when used with CIL: obj_fun.gradient(x, out=x)
suggestion for fix:
extern "C"
void*
cSTIR_computeObjectiveFunctionGradient(void* ptr_f, void* ptr_i, int subset, void* ptr_g)
{
try {
xSTIR_ObjFun3DF& fun = objectFromHandle<xSTIR_ObjFun3DF>(ptr_f);
STIRImageData& id = objectFromHandle<STIRImageData>(ptr_i);
STIRImageData& gd = objectFromHandle<STIRImageData>(ptr_g);
if (&gd == &id)
{
// unsafe to call fun.compute_gradient() with the same object for input and output, so make a copy
stir::shared_ptr<STIRImageData> id_clone(id.clone());
auto new_hdl = newObjectHandle(id_clone);
return cSTIR_computeObjectiveFunctionGradient(ptr_f, new_hdl, subset, ptr_g);
}
fun.compute_gradient(id, subset, gd);
return (void*) new DataHandle;
}
CATCH;
}
The text was updated successfully, but these errors were encountered:
SIRF/src/xSTIR/cSTIR/cstir.cpp
Line 1212 in b205384
ObjectiveFunction gradient incorrect when passed the same object for input argument and out
Fails when used with CIL:
obj_fun.gradient(x, out=x)
suggestion for fix:
The text was updated successfully, but these errors were encountered: