use of org.nd4j.linalg.api.ops.impl.meta.PostulateMetaOp in project nd4j by deeplearning4j.
the class CudaGridExecutioner method processAsGridOp.
protected void processAsGridOp(Op op, int... dimension) {
/*
We have multiple options here:
1) Op has no relation to lastOp
2) Op has SOME relation to lastOp
3) Op is supposed to blocking
So we either should append this op to future GridOp, form MetaOp, or immediately execute everything
But we don't expect this method called for blocking ops ever, so it's either
*/
// CudaContext context = AtomicAllocator.getInstance().getFlowController().prepareAction(op.z(), op.x(), op.y());
OpDescriptor last = lastOp.get();
if (last != null) {
MetaType type = getMetaOpType(op, dimension);
lastOp.remove();
switch(type) {
case NOT_APPLICABLE:
{
/*
If we can't form MetaOp with new Op here, we should move lastOp to GridOp queue, and update lastOp with current Op
*/
dequeueOp(last);
pushToGrid(last, false);
// || op instanceof ScalarOp
if ((op instanceof TransformOp && op.y() != null) && onCurrentDeviceXYZ(op)) {
enqueueOp(new OpDescriptor(op, dimension));
} else {
pushToGrid(new OpDescriptor(op, dimension), false);
}
}
break;
case PREDICATE:
{
MetaOp metaOp = new PredicateMetaOp(last, new OpDescriptor(op, dimension));
pushToGrid(new OpDescriptor(metaOp), false);
}
break;
case INVERTED_PREDICATE:
{
OpDescriptor currentOp = new OpDescriptor(op, dimension);
// logger.info("Calling for Meta: {}+{}", last.getOp().getClass().getSimpleName(), currentOp.getOp().getClass().getSimpleName());
dequeueOp(last);
dequeueOp(currentOp);
MetaOp metaOp = new InvertedPredicateMetaOp(last, currentOp);
pushToGrid(new OpDescriptor(metaOp), false);
}
break;
case POSTULATE:
{
MetaOp metaOp = new PostulateMetaOp(last, new OpDescriptor(op, dimension));
pushToGrid(new OpDescriptor(metaOp), false);
}
break;
default:
throw new UnsupportedOperationException("Not supported MetaType: [" + type + "]");
}
} else {
// && Nd4j.dataType() != DataBuffer.Type.HALF
if ((op instanceof TransformOp && op.y() != null && onCurrentDeviceXYZ(op))) {
enqueueOp(new OpDescriptor(op, dimension));
} else {
pushToGrid(new OpDescriptor(op, dimension), false);
}
}
// AtomicAllocator.getInstance().getFlowController().registerAction(context, op.z(), op.x(), op.y());
// return op;
}
Aggregations