Expected tryLoadCommonOperator()

in include/glow/Importer/CommonOperatorLoader.h [1490:1677]


  Expected<bool> tryLoadCommonOperator(llvm::StringRef typeName,
                                       const OpType &op,
                                       ArgumentDictionaryTy &dict) {
    if (typeName == "Relu") {
      RETURN_IF_ERR(loadRelu(op, dict));
      return true;
    }
    if (typeName == "Sigmoid") {
      RETURN_IF_ERR(loadSigmoid(op, dict));
      return true;
    }
    if (typeName == "Tanh") {
      RETURN_IF_ERR(loadTanh(op, dict));
      return true;
    }
    if (typeName == "Exp") {
      RETURN_IF_ERR(loadExp(op, dict));
      return true;
    }
    if (typeName == "Log") {
      RETURN_IF_ERR(loadLog(op, dict));
      return true;
    }
    if (typeName == "Neg") {
      RETURN_IF_ERR(loadNeg(op, dict));
      return true;
    }
    if (typeName == "Abs") {
      RETURN_IF_ERR(loadAbs(op, dict));
      return true;
    }
    if (typeName == "Ceil") {
      RETURN_IF_ERR(loadCeil(op, dict));
      return true;
    }
    if (typeName == "Floor") {
      RETURN_IF_ERR(loadFloor(op, dict));
      return true;
    }
    if (typeName == "Shape") {
      RETURN_IF_ERR(loadShape(op, dict));
      return true;
    }
    if (typeName == "Sqrt") {
      RETURN_IF_ERR(loadSqrt(op, dict));
      return true;
    }
    if (typeName == "Sqr") {
      RETURN_IF_ERR(loadSqr(op, dict));
      return true;
    }
    if (typeName == "Reciprocal") {
      RETURN_IF_ERR(loadReciprocal(op, dict));
      return true;
    }
    if (typeName == "Sum") {
      RETURN_IF_ERR(loadSum(op, dict));
      return true;
    }
    if (typeName == "LRN") {
      RETURN_IF_ERR(loadLRN(op, dict));
      return true;
    }
    if (typeName == "Min" || typeName == "Max") {
      RETURN_IF_ERR(loadMinMax(typeName, op, dict));
      return true;
    }
    if (typeName == "Mul" || typeName == "Add" || typeName == "Sub" ||
        typeName == "Div" || typeName == "Pow") {
      RETURN_IF_ERR(loadArithmetic(typeName, op, dict));
      return true;
    }
    if (typeName == "Split") {
      RETURN_IF_ERR(loadSplit(op, dict));
      return true;
    }
    if (typeName == "Reshape") {
      RETURN_IF_ERR(loadReshape(op, dict));
      return true;
    }
    if (typeName == "Flatten") {
      RETURN_IF_ERR(loadFlatten(op, dict));
      return true;
    }
    if (typeName == "Dropout") {
      // Save the identity operation. Note the second output (mask) for Dropout
      // in Caffe2 and ONNX is unused during inference, and our Dropout does not
      // currently implement it, thus we do not call addNodeAsOutput() here.
      RETURN_IF_ERR(loadIdentity(op, dict));
      return true;
    }
    if (typeName == "Identity" || typeName == "Alias") {
      RETURN_IF_ERR(loadIdentity(op, dict));
      return true;
    }
    if (typeName == "ReduceMean" || typeName == "ReduceSum" ||
        typeName == "ReduceMin" || typeName == "ReduceMax" ||
        typeName == "ReduceProd") {
      RETURN_IF_ERR(loadReduceOp(typeName, op, dict));
      return true;
    }
    if (typeName == "BatchMatMul") {
      RETURN_IF_ERR(loadBatchMatMul(op, dict));
      return true;
    }
    if (typeName == "BatchOneHot") {
      RETURN_IF_ERR(loadBatchOneHot(op));
      return true;
    }
    if (typeName == "SparseLengthsSum") {
      RETURN_IF_ERR(loadSparseLengthsSum(op, dict));
      return true;
    }
    if (typeName == "SparseLengthsWeightedSum") {
      RETURN_IF_ERR(loadSparseLengthsWeightedSum(op, dict));
      return true;
    }
    if (typeName == "EmbeddingBag") {
      RETURN_IF_ERR(loadEmbeddingBag(op, dict));
      return true;
    }
    if (typeName == "Embedding") {
      RETURN_IF_ERR(loadEmbedding(op, dict));
      return true;
    }
    if (typeName == "LengthsToRanges") {
      RETURN_IF_ERR(loadLengthsToRanges(op));
      return true;
    }
    if (typeName == "BatchBoxCox") {
      RETURN_IF_ERR(loadBatchBoxCox(op));
      return true;
    }
    if (typeName == "DotProduct") {
      RETURN_IF_ERR(loadDotProduct(op));
      return true;
    }
    if (typeName == "ReplaceNaN") {
      RETURN_IF_ERR(loadReplaceNaN(op, dict));
      return true;
    }
    if (typeName == "LengthsSum") {
      RETURN_IF_ERR(loadLengthsSum(op));
      return true;
    }
    if (typeName == "ExpandDims") {
      RETURN_IF_ERR(loadExpandDims(op, dict));
      return true;
    }
    if (typeName == "SparseToDense") {
      RETURN_IF_ERR(loadSparseToDense(op, dict));
      return true;
    }
    if (typeName == "SparseToDenseMask") {
      RETURN_IF_ERR(loadSparseToDenseMask(op, dict));
      return true;
    }
    if (typeName == "Gather" || typeName == "BatchGather") {
      RETURN_IF_ERR(loadGatherOps(typeName.str(), op, dict));
      return true;
    }
    if (typeName == "GatherND") {
      RETURN_IF_ERR(loadGatherND(typeName.str(), op, dict));
      return true;
    }
    if (typeName == "GatherRanges") {
      RETURN_IF_ERR(loadGatherRanges(typeName.str(), op, dict));
      return true;
    }
    if (typeName == "Less") {
      RETURN_IF_ERR(loadLess(op, dict));
      return true;
    }
    if (typeName == "And" || typeName == "Or" || typeName == "Xor") {
      RETURN_IF_ERR(loadLogicalOps(typeName, op));
      return true;
    }
    if (typeName == "Not") {
      RETURN_IF_ERR(loadNotOp(typeName, op));
      return true;
    }
    if (typeName == "Pow") {
      RETURN_IF_ERR(loadPow(op, dict));
      return true;
    }

    return false;
  }