diff --git a/ethosu/regor/compiler/high_level_command_stream_generator.cpp b/ethosu/regor/compiler/high_level_command_stream_generator.cpp index 21d81c0a8e24703996e52a9b7207920e57998269..6974e4b7e0df45430cbfa07ad75f7810d2ab15e6 100644 --- a/ethosu/regor/compiler/high_level_command_stream_generator.cpp +++ b/ethosu/regor/compiler/high_level_command_stream_generator.cpp @@ -419,17 +419,13 @@ static std::shared_ptr MakeOperation(SchedulerOperation *schedOp, op->parameters.resize.scaleX = resize->scaleX; op->parameters.resize.offsetY = resize->offset.y; op->parameters.resize.offsetX = resize->offset.x; - if ( ifmShape.Width() == 1 && ifmShape.Height() == 1 ) - { - // 1x1 IFMs can be handled with replicate - op->parameters.resize.mode = ArchResizeMode::Replicate; - } - else if ( resize->mode == tosa::ResizeMode::NEAREST ) + if ( resize->mode == tosa::ResizeMode::NEAREST ) { op->parameters.resize.mode = ArchResizeMode::Nearest; } else { + assert(resize->mode == tosa::ResizeMode::BILINEAR); op->parameters.resize.mode = ArchResizeMode::Bilinear; } } diff --git a/ethosu/regor/compiler/tflite_graph_optimiser.cpp b/ethosu/regor/compiler/tflite_graph_optimiser.cpp index d47651bfb0752706e7e7652beff280607338b7d8..ec8c6a547008496c75eaa34fd38b10c0c1f62b6a 100644 --- a/ethosu/regor/compiler/tflite_graph_optimiser.cpp +++ b/ethosu/regor/compiler/tflite_graph_optimiser.cpp @@ -1241,16 +1241,20 @@ Operation *TFLiteGraphOptimiser::ConvertResize(Graph *const graph, Operation *co attr->scaleY = {height_n, height_d}; attr->offset = {widthOffset, heightOffset}; attr->border = {0, 0}; - attr->mode = (opType == OpType::ResizeBilinear) ? tosa::ResizeMode::BILINEAR : tosa::ResizeMode::NEAREST; int shift = 0; if ( opType == OpType::ResizeBilinear && (ifmConn->shape.Width() > 1 || ifmConn->shape.Height() > 1) ) { + attr->mode = tosa::ResizeMode::BILINEAR; // ResizeBilinear is post-scaled with // 1 / (height_n * width_n) // as the scale-factor is a power of two, we can use shift shift = IntLog2(width_n * height_n); } + else + { + attr->mode = tosa::ResizeMode::NEAREST; + } // Set explicit scaling Quantization ofmQuant = ofmConn->quantization;