Skip to content

Commit

Permalink
KMeansClient: Work around over agressive optimisation
Browse files Browse the repository at this point in the history
  • Loading branch information
weefuzzy committed Jun 14, 2022
1 parent 7fb1bf6 commit 1e668d5
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions include/clients/nrt/KMeansClient.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,18 +320,30 @@ class KMeansQuery : public FluidBaseClient, ControlIn, ControlOut
// report error?
return;
}
if (!kmeansPtr->initialized()) return;
if (!kmeansPtr->initialized())
{
//report error?
return;
}
index dims = kmeansPtr->dims();
InOutBuffersCheck bufCheck(dims);
if (!bufCheck.checkInputs(get<kInputBuffer>().get(),
get<kOutputBuffer>().get()))
{
//report error?
return;
}
auto outBuf = BufferAdaptor::Access(get<kOutputBuffer>().get());
if (outBuf.samps(0).size() < 1) return;
auto outSamps = outBuf.samps(0);
if (outSamps.size() < 1)
{
//report error?
return;
}
RealVector point(dims);
point <<= BufferAdaptor::ReadAccess(get<kInputBuffer>().get())
.samps(0, dims, 0);
outBuf.samps(0)[0] = kmeansPtr->algorithm().vq(point);
outSamps[0] = kmeansPtr->algorithm().vq(point);
}
}

Expand Down

0 comments on commit 1e668d5

Please sign in to comment.