Commit 3269387e authored by Robert Kimball's avatar Robert Kimball Committed by Scott Cyphers

Fix autodiff uninitialized data error (#329)

* fix autodiff on non-NGVM backends. NGVM initializes all tensors to zero on allocation while the other backends do not. Had to initialize vector before use.

* change autodiff tests to use INTERPRETER
parent 04985466
......@@ -90,9 +90,9 @@ foreach(BACKEND_NAME ${BACKEND_NAMES})
endforeach()
# <special case>
# This is a special case as NGVM is the only backend that can run these tests
set(BACKEND_NAME "NGVM")
configure_file(autodiff.in.cpp autodiff_NGVM.cpp)
set(SRC ${SRC} ${CMAKE_CURRENT_BINARY_DIR}/autodiff_NGVM.cpp)
set(BACKEND_NAME "INTERPRETER")
configure_file(autodiff.in.cpp autodiff_${BACKEND_NAME}.cpp)
set(SRC ${SRC} ${CMAKE_CURRENT_BINARY_DIR}/autodiff_${BACKEND_NAME}.cpp)
# </special cast>
include_directories(".")
......
......@@ -100,6 +100,7 @@ namespace ngraph
bprops_tv.insert(bprops_tv.begin(), bprops.begin(), bprops.end());
auto c_vec = c_arg->template get_vector<T>();
fill(c_vec.begin(), c_vec.end(), 0);
for (size_t i = 0; i < c_vec.size(); i++)
{
c_vec[i] = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment