Skip to content

Commit 1e668d5

Browse files
committed
KMeansClient: Work around over agressive optimisation
1 parent 7fb1bf6 commit 1e668d5

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

include/clients/nrt/KMeansClient.hpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,18 +320,30 @@ class KMeansQuery : public FluidBaseClient, ControlIn, ControlOut
320320
// report error?
321321
return;
322322
}
323-
if (!kmeansPtr->initialized()) return;
323+
if (!kmeansPtr->initialized())
324+
{
325+
//report error?
326+
return;
327+
}
324328
index dims = kmeansPtr->dims();
325329
InOutBuffersCheck bufCheck(dims);
326330
if (!bufCheck.checkInputs(get<kInputBuffer>().get(),
327331
get<kOutputBuffer>().get()))
332+
{
333+
//report error?
328334
return;
335+
}
329336
auto outBuf = BufferAdaptor::Access(get<kOutputBuffer>().get());
330-
if (outBuf.samps(0).size() < 1) return;
337+
auto outSamps = outBuf.samps(0);
338+
if (outSamps.size() < 1)
339+
{
340+
//report error?
341+
return;
342+
}
331343
RealVector point(dims);
332344
point <<= BufferAdaptor::ReadAccess(get<kInputBuffer>().get())
333345
.samps(0, dims, 0);
334-
outBuf.samps(0)[0] = kmeansPtr->algorithm().vq(point);
346+
outSamps[0] = kmeansPtr->algorithm().vq(point);
335347
}
336348
}
337349

0 commit comments

Comments
 (0)