Skip to content

Commit

Permalink
Fix lce_ops_options_test.cc
Browse files Browse the repository at this point in the history
  • Loading branch information
Tombana committed Jun 16, 2024
1 parent 9b3ac0c commit 9dd6fa0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion larq_compute_engine/mlir/ir/lce_ops.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#ifndef LARQ_COMPUTE_ENGINE_MLIR_IR_LCE_OPS_H_
#define LARQ_COMPUTE_ENGINE_MLIR_IR_LCE_OPS_H_

#include "mlir/Bytecode/BytecodeOpInterface.h"
#include "mlir/Dialect/Quant/QuantTypes.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"
#include "mlir/Bytecode/BytecodeOpInterface.h"

// clang-format off
#include "larq_compute_engine/mlir/ir/lce_dialect.h.inc"
Expand Down
24 changes: 12 additions & 12 deletions larq_compute_engine/mlir/tests/lce_ops_options_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ IntegerAttr getIntegerAttr(Builder builder, int value) {
TEST(LCEOpsSerializationTest, QuantizeTest) {
MLIRContext context;
context.getOrLoadDialect<lq::LarqDialect>();
auto* op = Operation::create(
UnknownLoc::get(&context), OperationName("lq.Quantize", &context),
llvm::None, llvm::None, llvm::None, llvm::None, 0);
OperationState state(UnknownLoc::get(&context),
OperationName("lq.Quantize", &context));
mlir::Operation* op = Operation::create(state);

ASSERT_EQ(cast<lq::QuantizeOp>(op).buildCustomOptions().size(), 0);
}

TEST(LCEOpsSerializationTest, DequantizeTest) {
MLIRContext context;
context.getOrLoadDialect<lq::LarqDialect>();
auto* op = Operation::create(
UnknownLoc::get(&context), OperationName("lq.Dequantize", &context),
llvm::None, llvm::None, llvm::None, llvm::None, 0);
OperationState state(UnknownLoc::get(&context),
OperationName("lq.Dequantize", &context));
mlir::Operation* op = Operation::create(state);

ASSERT_EQ(cast<lq::DequantizeOp>(op).buildCustomOptions().size(), 0);
}
Expand All @@ -37,9 +37,9 @@ TEST(LCEOpsSerializationTest, BConv2dTest) {
MLIRContext context;
context.getOrLoadDialect<lq::LarqDialect>();
Builder builder(&context);
auto op = Operation::create(UnknownLoc::get(&context),
OperationName("lq.Bconv2d", &context), llvm::None,
llvm::None, llvm::None, llvm::None, 0);
OperationState state(UnknownLoc::get(&context),
OperationName("lq.Bconv2d", &context));
mlir::Operation* op = Operation::create(state);

op->setAttr("channels_in", getIntegerAttr(builder, 64));
op->setAttr("dilation_height_factor", getIntegerAttr(builder, 3));
Expand Down Expand Up @@ -69,9 +69,9 @@ TEST(LCEOpsSerializationTest, BMaxPool2dTest) {
MLIRContext context;
context.getOrLoadDialect<lq::LarqDialect>();
Builder builder(&context);
auto op = Operation::create(
UnknownLoc::get(&context), OperationName("lq.BMaxPool2d", &context),
llvm::None, llvm::None, llvm::None, llvm::None, 0);
OperationState state(UnknownLoc::get(&context),
OperationName("lq.BMaxPool2d", &context));
mlir::Operation* op = Operation::create(state);

op->setAttr("padding", builder.getStringAttr("SAME"));
op->setAttr("stride_width", getIntegerAttr(builder, 2));
Expand Down

0 comments on commit 9dd6fa0

Please sign in to comment.