scripts/lib/remove-event-stream-ops.js
function removeEventStreamOperations(model) {
    var modifiedModel = false;
    // loop over all operations
    var operations = model.operations;
    var operationNames = Object.keys(operations);
    for (var i = 0; i < operationNames.length; i++) {
        var operationName = operationNames[i];
        var operation = operations[operationName];
        // check input and output shapes
        var inputShapeName = operation.input && operation.input.shape;
        var outputShapeName = operation.output && operation.output.shape;

        var requiresEventStream = false;
        if (inputShapeName && hasEventStream(model.shapes[inputShapeName], model)) {
            requiresEventStream = true;
        }

        if (requiresEventStream) {
            modifiedModel = true;
            // remove the operation from the model
            console.log('Removing ' + operationName + ' because it depends on event streams on input.');
            delete model.operations[operationName];
        }
    }
    return modifiedModel;
}
function removeEventStreamOperations(model) {
    var modifiedModel = false;
    // loop over all operations
    var operations = model.operations;
    var operationNames = Object.keys(operations);
    for (var i = 0; i < operationNames.length; i++) {
        var operationName = operationNames[i];
        var operation = operations[operationName];
        // check input and output shapes
        var inputShapeName = operation.input && operation.input.shape;
        var outputShapeName = operation.output && operation.output.shape;

        var requiresEventStream = false;
        if (inputShapeName && hasEventStream(model.shapes[inputShapeName], model)) {
            requiresEventStream = true;
        }

        if (requiresEventStream) {
            modifiedModel = true;
            // remove the operation from the model
            console.log('Removing ' + operationName + ' because it depends on event streams on input.');
            delete model.operations[operationName];
        }
    }
    return modifiedModel;
}
function removeEventStreamOperations ( model ) { var modifiedModel = false ; // loop over all operations var operations = model . operations ; var operationNames = Object . keys ( operations ) ; for ( var i = 0 ; i < operationNames . length ; i ++ ) { var operationName = operationNames [ i ] ; var operation = operations [ operationName ] ; // check input and output shapes var inputShapeName = operation . input && operation . input . shape ; var outputShapeName = operation . output && operation . output . shape ; var requiresEventStream = false ; if ( inputShapeName && hasEventStream ( model . shapes [ inputShapeName ] , model ) ) { requiresEventStream = true ; } if ( requiresEventStream ) { modifiedModel = true ; // remove the operation from the model console . log ( 'Removing ' + operationName + ' because it depends on event streams on input.' ) ; delete model . operations [ operationName ] ; } } return modifiedModel ; }
Removes operations from the model if they require event streams.
Specifically looks at input and output shapes.
@param {Object} model - JSON parsed API model (*.normal.json)
Removes operations from the model if they require event streams . Specifically looks at input and output shapes .