Skip to content

Fixing last failed test for Release build #1187

@khuck

Description

@khuck

The release build has one last failing test:
http://omega.nic.uoregon.edu:8020/#/builders/2/builds/167/steps/16/logs/stdio

I tracked this down to temporaries output.tensor() and target.tensor() going out of scope in cat_cross_operation::cat_cross3d():

primitive_argument_type cat_cross_operation::cat_cross3d(
arg_type&& target, arg_type&& output, bool from_logits, int axis) const
{
assign_tensor<arg_type> output_(output);
assign_tensor<arg_type> target_(target);
if(from_logits)
{
output_ = softmax3d_axis2(output.tensor());
}
else
{
if(axis == 0) {
auto norm = sum3d(output.tensor(),axis);
for(std::size_t j = 0; j < output.tensor().pages(); ++j) {
auto slice = blaze::pageslice(output.tensor(),j);
slice = blaze::map(slice, norm,[](double s_,double n_){
return s_/n_;
});
}
} else if(axis == 1) {
auto norm = sum3d(output.tensor(),axis);
for(std::size_t j = 0; j < output.tensor().rows(); ++j) {
auto slice = blaze::rowslice(output.tensor(),j);
slice = blaze::map(slice, norm,[](double s_,double n_){
return s_/n_;
});
}
} else {
auto norm = sum3d(output.tensor(),axis);
for(std::size_t j = 0; j < output.tensor().columns(); ++j) {
auto slice = blaze::columnslice(output.tensor(),j);
slice = blaze::map(slice, norm,[](double s_,double n_){
return s_/n_;
});
}
}
}
target_ = blaze::map(
target.tensor(), output.tensor(), [](double t_, double o_) {
return -t_ *
std::log((std::min)(clip_high, (std::max)(clip_low, o_)));
});
matrix_type ans = sum3d(target.tensor(), axis);
if(axis == 1)
ans = blaze::trans(ans);
primitive_argument_type part1(std::move(ans)), part2(std::move(output));
primitive_arguments_type both{part1, part2};
phylanx::ir::range tup(both);
return primitive_argument_type{ std::move(tup) };
}

I'll submit a pull request for that issue (see #1188).

However, after fixing that crash, the python code fails assertions:

AssertionError: [[ 0.96681002  2.18922338  3.41163674  4.6340501 ]
 [ 5.85646346  7.07887682  8.30129018  9.52370354]
 [10.7461169  11.96853026 13.19094362 14.41335698]]
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> /var/lib/buildbot/slaves/phylanx/x86_64-gcc7-release/build/tests/unit/python/execution_tree/categorical_crossentropy.py(79)<module>()
-> assert np.all(np.abs(v1 - v2) < 1.0e-13), v1 - v2
(Pdb) p v1
array([[ 3.,  7., 11., 15.],
       [19., 23., 27., 31.],
       [35., 39., 43., 47.]])
(Pdb) p v2
array([[ 2.03318998,  4.81077662,  7.58836326, 10.3659499 ],
       [13.14353654, 15.92112318, 18.69870982, 21.47629646],
       [24.2538831 , 27.03146974, 29.80905638, 32.58664302]])
(Pdb) list
 74  	    o = 3 * np.ones(10)
 75  	    o[4] = 2
 76  	
 77  	    v1 = cc(t, o, flag, -1)
 78  	    v2 = cat_cross(t, o, flag)
 79  ->	    assert np.all(np.abs(v1 - v2) < 1.0e-13), v1 - v2
 80  	
 81  	    t = np.linspace(1.0e-9, 10e-9, 10)
 82  	    t[2] = 10
 83  	    o = 3 * np.ones(10)
 84  	    o[4] = 2
(Pdb) 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions