TypeTensor - v0.1.0
    Preparing search index...

    Type Alias TransposeOp<Input>

    TransposeOp: Input["__shape"]["length"] extends 0
    | 1
        ? StorageTransformation<"transpose", Input, readonly [Input]>
        : Input["__shape"] extends readonly [
            ...(infer BatchDims),
            infer SecondLast,
            infer Last,
        ]
            ? SecondLast extends number
                ? Last extends number
                    ? BatchDims extends Shape
                        ? StorageTransformation<
                            "transpose",
                            TensorStorage<
                                Input["__dtype"],
                                readonly [...BatchDims, Last, SecondLast],
                                ComputeTransposedStrides<
                                    Input["__strides"],
                                    Input["__shape"]["length"],
                                >,
                                TransposeLayout<Input["__layout"]>,
                            >,
                            readonly [Input],
                        >
                        : never
                    : never
                : never
            : never

    Transpose operation storage transformation

    Default behavior: swaps the last two dimensions (matrix transpose) For <2D tensors: returns the tensor unchanged

    Type Parameters

    type A = TensorStorage<Float32, [2, 3, 4]>; // Shape: [2, 3, 4]
    type B = TransposeOp<A>; // Shape: [2, 4, 3]

    type C = TensorStorage<Float32, [5]>; // 1D tensor
    type D = TransposeOp<C>; // Shape: [5] (unchanged)