2020-03-19 16:48:09 +08:00
|
|
|
//===--------- FrontendDialectTransformer.hpp - MLIR Operations -----------===//
|
2019-11-02 05:09:48 +08:00
|
|
|
//
|
|
|
|
// Copyright 2019 The IBM Research Authors.
|
|
|
|
//
|
|
|
|
// =============================================================================
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <fstream>
|
|
|
|
#include <functional>
|
|
|
|
#include <map>
|
|
|
|
#include <memory>
|
|
|
|
#include <sstream>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "onnx/onnx_pb.h"
|
|
|
|
|
2020-03-19 16:48:09 +08:00
|
|
|
#include "src/Builder/FrontendDialectHelper.hpp"
|
2020-03-11 02:46:35 +08:00
|
|
|
|
2019-11-02 05:09:48 +08:00
|
|
|
namespace mlir {
|
|
|
|
class MLIRContext;
|
|
|
|
class OwningModuleRef;
|
2019-12-22 13:25:02 +08:00
|
|
|
} // namespace mlir
|
2019-11-02 05:09:48 +08:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
2020-03-17 21:16:33 +08:00
|
|
|
// Import a model into the ONNX MLIR dialect.
|
2019-11-02 05:09:48 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2020-03-17 21:16:33 +08:00
|
|
|
namespace onnx_mlir {
|
2019-11-02 05:09:48 +08:00
|
|
|
/*!
|
2020-03-17 21:16:33 +08:00
|
|
|
* Import an ONNX model file into the ONNX Dialect.
|
2019-11-02 05:09:48 +08:00
|
|
|
* @param model_fname file name pointing to the onnx model protobuf.
|
|
|
|
* @return MLIR::module generated for the ONNX model.
|
|
|
|
*/
|
2019-11-08 00:42:40 +08:00
|
|
|
void ImportFrontendModelFile(std::string model_fname,
|
2020-05-13 22:37:51 +08:00
|
|
|
mlir::MLIRContext &context, mlir::OwningModuleRef &module);
|
2019-11-02 05:09:48 +08:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* TODO: Import models into other extension dialects that cover the
|
|
|
|
* operations specific to other frameworks such as Tensorflow or Pytorch.
|
|
|
|
*/
|
2020-05-13 22:37:51 +08:00
|
|
|
} // namespace onnx_mlir
|