#include "Attribute.h" #include "AttributeImpl.h" #include "llvm/Support/Casting.h" #include "memory.h" // #include "mlir/Dialect/StandardOps/Ops.h" // #include "mlir/IR/Attributes.h" // #include "mlir/IR/Operation.h" // #include "mlir/IR/StandardTypes.h" // #include "mlir/IR/Types.h" // #include "mlir/IR/Value.h" namespace builder { inline bool PrimitiveType::operator==(const PrimitiveType& pt) { return impl_ == pt.impl_; } PrimitiveType::PrimitiveType(std::shared_ptr impl) : impl_(impl) {} PrimitiveType PrimitiveType::PRED() { PrimitiveType p( std::make_shared(PrimitiveType::Impl::pType::PRED)); return p; } PrimitiveType PrimitiveType::S8() { PrimitiveType p( std::make_shared(PrimitiveType::Impl::pType::S8)); return p; } PrimitiveType PrimitiveType::S16() { PrimitiveType p( std::make_shared(PrimitiveType::Impl::pType::S16)); return p; } PrimitiveType PrimitiveType::F32() { PrimitiveType p( std::make_shared(PrimitiveType::Impl::pType::F32)); return p; } PrimitiveType PrimitiveType::S32() { PrimitiveType p( std::make_shared(PrimitiveType::Impl::pType::S32)); return p; } PrimitiveType PrimitiveType::S64() { PrimitiveType p( std::make_shared(PrimitiveType::Impl::pType::S64)); return p; } Shape::Shape(std::vector dims) : impl_(std::make_shared(dims)) {} std::vector Shape::GetDims() { return impl_->GetDims(); } Type::Type(Shape& shape, PrimitiveType& primitiveType) : impl_(std::make_shared(shape, primitiveType)) {} Integer::Integer(int value) : impl_(std::make_shared(value)) {} Integer::Integer(int64_t value) : impl_(std::make_shared(value)) {} Float::Float(float value) : impl_(std::make_shared(value)) {} Float::Float(double value) : impl_(std::make_shared(value)) {} int64_t Array::GetSize() { return impl_->GetSize(); } PrimitiveType Array::GetType() { return impl_->GetType(); } Array::Array(std::vector value) : impl_(std::make_shared(value)) {} Array::Array(std::vector value) : impl_(std::make_shared(value)) {} Array::Array(std::vector value) : impl_(std::make_shared(value)) {} // Tensor::Tensor(Shape& shape, PrimitiveType& primitiveType, const void* value) // : impl_(std::make_shared(shape, primitiveType, value)) {} Shape Tensor::GetShape() { return impl_->GetShape(); } // PrimitiveType Tensor::GetType() { return impl_->GetType(); } Tensor::Tensor(Shape& shape, std::vector value) : impl_(std::make_shared(shape, value)) {} Tensor::Tensor(Shape& shape, std::vector value) : impl_(std::make_shared(shape, value)) {} Tensor::Tensor(Shape& shape, std::vector value) : impl_(std::make_shared(shape, value)) {} TensorInt::TensorInt(Shape& shape, PrimitiveType& primitiveType) : impl_(std::make_shared(shape, primitiveType)) {} Shape TensorInt::GetShape() { return impl_->GetShape(); } PrimitiveType TensorInt::GetType() { return impl_->GetType(); } ChannelHandle::ChannelHandle() : impl_(std::make_shared()) {} ConvDimensionNumbers::ConvDimensionNumbers() : impl_(std::make_shared()) {} DotDimensionNumbers::DotDimensionNumbers() : impl_(std::make_shared()) {} GatherDimensionNumbers::GatherDimensionNumbers() : impl_(std::make_shared()) {} ScatterDimensionNumbers::ScatterDimensionNumbers() : impl_(std::make_shared()) {} } // namespace builder