E3047

E3047 — A reshape call the compiler cannot check: the new shape has a different number of elements than the tensor (without PadMode::Pad or PadMode::Trim), a size is not known while compiling, or the arguments are not a shape such as [4, 4] and an optional PadMode.

What the compiler reports

E3047{{.*}}reshape cannot change the number of elements: Tensor<f32, [128, 128]> has 16384, the new shape has 256
transpose permutation map must not contain duplicates
Type mismatch in argument 1 for function 'requires_specific_layout'.

The fragments the test suite holds the compiler to. An ellipsis marks text the test does not constrain; the emitted message also carries a source location.

A program that triggers it

//
// Part of the Vx Project, under the Apache License v2.0 with LLVM Exceptions.
// See LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//

fn requires_specific_layout(t : Tensor<f32, [ 128, 256 ]>) -> i32 {
  return 0;
}

fn main() -> i32 {
  // 1. Invalid tensor init
  let t_host : Tensor<f32, [?, ?]> = true;

  // 2. Generic missing
  let a = Tensor([10]);

  // 3. Generic not scalar
  let b = Tensor<Tensor<f32, [?, ?]>>([10]);

  // 4. Invalid reshape
  let c : Tensor<f32, [ 128, 128 ]> = 1.0;
  let d = c.reshape([256]);

  // 5. Invalid transpose
  let e = c.transpose([ 0, 0 ]);

  // 6. Layout mismatch
  requires_specific_layout(c);

  return 0;
}

From tests/frontend/fail/tensor_errors.vx, which asserts this diagnostic on every commit.

Related