Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_ATTRIBUTES_H_
#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_ATTRIBUTES_H_
#include "llvm/ADT/StringRef.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/MLIRContext.h"
namespace mlir {
namespace TF {
namespace detail {
struct ShapeAttrStorage;
struct FuncAttrStorage;
}
class ShapeAttr : public Attribute::AttrBase<ShapeAttr, Attribute,
detail::ShapeAttrStorage>
{
public:
using Base::Base;
static ShapeAttr get(mlir::MLIRContext* context,
llvm::Optional<ArrayRef<int64_t> > shape);
static ShapeAttr get(mlir::MLIRContext* context, ShapedType shaped_type);
llvm::Optional<ArrayRef<int64_t> > getValue() const;
bool hasRank() const;
int64_t getRank() const;
ArrayRef<int64_t> getShape() const;
bool hasStaticShape() const;
};
class FuncAttr
: public Attribute::AttrBase<FuncAttr, Attribute, detail::FuncAttrStorage>
{
public:
using Base::Base;
static FuncAttr get(mlir::MLIRContext* context, llvm::StringRef name,
DictionaryAttr attr);
static FuncAttr get(mlir::MLIRContext* context, SymbolRefAttr symbol,
DictionaryAttr attr);
SymbolRefAttr GetName() const;
DictionaryAttr GetAttrs() const;
};
}
}
#endif