diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 000000000..5008ddfcf Binary files /dev/null and b/.DS_Store differ diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index c1fc2cfd6..2cbaddbe3 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -9,5 +9,5 @@ jobs: - uses: actions/checkout@v3 - uses: software-mansion/setup-scarb@v1 with: - scarb-version: "2.5.3" + scarb-version: "2.6.4" - run: scarb test --workspace && scarb fmt --workspace \ No newline at end of file diff --git a/.tool-versions b/.tool-versions index ebe254233..e1290964b 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -scarb 2.5.3 +scarb 2.6.4 diff --git a/Scarb.toml b/Scarb.toml index f05fa6649..091b7de0e 100644 --- a/Scarb.toml +++ b/Scarb.toml @@ -1,6 +1,6 @@ [package] name = "orion" -version = "0.2.4" +version = "0.2.5" cairo-version = "2.5.3" edition = "2023_10" description = "ONNX Runtime in Cairo for verifiable ML inference using STARK" diff --git a/docgen/src/main.rs b/docgen/src/main.rs index 8d1f90f4b..fb7dba8f1 100644 --- a/docgen/src/main.rs +++ b/docgen/src/main.rs @@ -59,6 +59,14 @@ fn main() { doc_trait(trait_path, doc_path, label); doc_functions(trait_path, doc_path, trait_name, label); + // TREE ENSEMBLE DOC + let trait_path = "src/operators/ml/tree_ensemble/tree_ensemble.cairo"; + let doc_path = "docs/framework/operators/machine-learning/tree-ensemble"; + let label = "tree_ensemble"; + let trait_name: &str = "TreeEnsembleTrait"; + doc_trait(trait_path, doc_path, label); + doc_functions(trait_path, doc_path, trait_name, label); + // LINEAR REGRESSOR DOC let trait_path = "src/operators/ml/linear/linear_regressor.cairo"; let doc_path = "docs/framework/operators/machine-learning/linear-regressor"; diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index e68a8ad34..8039dfcad 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -113,6 +113,7 @@ * [tensor.qlinear\_matmul](framework/operators/tensor/tensor.qlinear\_matmul.md) * [tensor.qlinear\_concat](framework/operators/tensor/tensor.qlinear\_concat.md) * [tensor.qlinear\_leakyrelu](framework/operators/tensor/tensor.qlinear\_leakyrelu.md) + * [tensor.qlinear\_conv](framework/operators/tensor/tensor.qlinear\_conv.md) * [tensor.nonzero](framework/operators/tensor/tensor.nonzero.md) * [tensor.squeeze](framework/operators/tensor/tensor.squeeze.md) * [tensor.unsqueeze](framework/operators/tensor/tensor.unsqueeze.md) @@ -174,11 +175,13 @@ * [nn.gemm](framework/operators/neural-network/nn.gemm.md) * [nn.grid\_sample](framework/operators/neural-network/nn.grid\_sample.md) * [nn.col2im](framework/operators/neural-network/nn.col2im.md) - * [nn.conv_transpose](framework/operators/neural-network/nn.conv\_transpose.md) + * [nn.conv\_transpose](framework/operators/neural-network/nn.conv\_transpose.md) * [nn.conv](framework/operators/neural-network/nn.conv.md) * [nn.conv_integer](framework/operators/neural-network/nn.conv\_integer.md) * [nn.depth_to_space](framework/operators/neural-network/nn.depth_to_space.md) * [nn.space_to_depth](framework/operators/neural-network/nn.space_to_depth.md) + * [nn.max\_pool](framework/operators/neural-network/nn.max\_pool.md) + * [nn.deform\_conv](framework/operators/neural-network/nn.deform\_conv_.md) * [Machine Learning](framework/operators/machine-learning/README.md) * [Tree Ensemble Classifier](framework/operators/machine-learning/tree-ensemble-classifier/README.md) * [tree\_ensemble\_classifier.predict](framework/operators/machine-learning/tree-ensemble-classifier/tree\_ensemble\_classifier.predict.md) diff --git a/docs/framework/compatibility.md b/docs/framework/compatibility.md index e18c7f36c..856c42bb1 100644 --- a/docs/framework/compatibility.md +++ b/docs/framework/compatibility.md @@ -48,6 +48,8 @@ You can see below the list of current supported ONNX Operators: | [ConvTranspose](operators/neural-network/nn.conv\_transpose_.md) | :white\_check\_mark: | | [Conv](operators/neural-network/nn.conv.md) | :white\_check\_mark: | | [ConvInteger](operators/neural-network/nn.conv\_integer_.md) | :white\_check\_mark: | +| [MaxPool](operators/neural-network/nn.max\_pool.md) | :white\_check\_mark: | +| [DeformConv](operators/neural-network/nn.deform\_conv_.md) | :white\_check\_mark: | | [Sinh](operators/tensor/tensor.sinh.md) | :white\_check\_mark: | | [Asinh](operators/tensor/tensor.asinh.md) | :white\_check\_mark: | | [Atanh](operators/tensor/tensor.atanh.md) | :white\_check\_mark: | @@ -67,6 +69,7 @@ You can see below the list of current supported ONNX Operators: | [QlinearAdd](operators/tensor/tensor.qlinear\_add.md) | :white\_check\_mark: | | [QlinearMul](operators/tensor/tensor.qlinear\_mul.md) | :white\_check\_mark: | | [QLinearLeakyRelu](operators/tensor/tensor.qlinear\_leakyrelu.md) | :white\_check\_mark: | +| [QLinearConv](operators/tensor/tensor.qlinear\_conv_.md) | :white\_check\_mark: | | [Nonzero](operators/tensor/tensor.nonzero.md) | :white\_check\_mark: | | [Squeeze](operators/tensor/tensor.squeeze.md) | :white\_check\_mark: | | [Unsqueeze](operators/tensor/tensor.unsqueeze.md) | :white\_check\_mark: | diff --git a/docs/framework/operators/machine-learning/tree-ensemble/README.md b/docs/framework/operators/machine-learning/tree-ensemble/README.md new file mode 100644 index 000000000..26fcfb205 --- /dev/null +++ b/docs/framework/operators/machine-learning/tree-ensemble/README.md @@ -0,0 +1,22 @@ +# Tree Ensemble + +`TreeEnsembleTrait` provides a trait definition for tree ensemble problem. + +```rust +use orion::operators::ml::TreeEnsembleTrait; +``` + +### Data types + +Orion supports currently only fixed point data types for `TreeEnsembleTrait`. + +| Data type | dtype | +| -------------------- | ------------------------------------------------------------- | +| Fixed point (signed) | `TreeEnsembleTrait` | + + +*** + +| function | description | +| --- | --- | +| [`tree_ensemble.predict`](tree_ensemble.predict.md) | Returns the regressed values for each input in a batch. | \ No newline at end of file diff --git a/docs/framework/operators/machine-learning/tree-ensemble/tree_ensemble.predict.md b/docs/framework/operators/machine-learning/tree-ensemble/tree_ensemble.predict.md new file mode 100644 index 000000000..a7f97e96d --- /dev/null +++ b/docs/framework/operators/machine-learning/tree-ensemble/tree_ensemble.predict.md @@ -0,0 +1,139 @@ +# TreeEnsemble::predict + +```rust + fn predict(X: @Tensor, + nodes_splits: Tensor, + nodes_featureids: Span, + nodes_modes: Span, + nodes_truenodeids: Span, + nodes_falsenodeids: Span, + nodes_trueleafs: Span, + nodes_falseleafs: Span, + leaf_targetids: Span, + leaf_weights: Tensor, + tree_roots: Span, + post_transform: POST_TRANSFORM, + aggregate_function: AGGREGATE_FUNCTION, + nodes_hitrates: Option>, + nodes_missing_value_tracks_true: Option>, + membership_values: Option>, + n_targets: usize + ) -> MutMatrix::; +``` + +Tree Ensemble operator. Returns the regressed values for each input in a batch. Inputs have dimensions [N, F] where N is the input batch size and F is the number of input features. Outputs have dimensions [N, num_targets] where N is the batch size and num_targets is the number of targets, which is a configurable attribute. + +## Args + +* `X`: Input 2D tensor. +* `nodes_splits`: Thresholds to do the splitting on for each node with mode that is not 'BRANCH_MEMBER'. +* `nodes_featureids`: Feature id for each node. +* `nodes_modes`: The comparison operation performed by the node. This is encoded as an enumeration of 'NODE_MODE::LEQ', 'NODE_MODE::LT', 'NODE_MODE::GTE', 'NODE_MODE::GT', 'NODE_MODE::EQ', 'NODE_MODE::NEQ', and 'NODE_MODE::MEMBER' +* `nodes_truenodeids`: If `nodes_trueleafs` is 0 (false) at an entry, this represents the position of the true branch node. +* `nodes_falsenodeids`: If `nodes_falseleafs` is 0 (false) at an entry, this represents the position of the false branch node. +* `nodes_trueleafs`: 1 if true branch is leaf for each node and 0 an interior node. +* `nodes_falseleafs`: 1 if true branch is leaf for each node and 0 an interior node. +* `leaf_targetids`: The index of the target that this leaf contributes to (this must be in range `[0, n_targets)`). +* `leaf_weights`: The weight for each leaf. +* `tree_roots`: Index into `nodes_*` for the root of each tree. The tree structure is derived from the branching of each node. +* `post_transform`: Indicates the transform to apply to the score.One of 'POST_TRANSFORM::NONE', 'POST_TRANSFORM::SOFTMAX', 'POST_TRANSFORM::LOGISTIC', 'POST_TRANSFORM::SOFTMAX_ZERO' or 'POST_TRANSFORM::PROBIT' , +* `aggregate_function`: Defines how to aggregate leaf values within a target. One of 'AGGREGATE_FUNCTION::AVERAGE', 'AGGREGATE_FUNCTION::SUM', 'AGGREGATE_FUNCTION::MIN', 'AGGREGATE_FUNCTION::MAX` defaults to 'AGGREGATE_FUNCTION::SUM' +* `nodes_hitrates`: Popularity of each node, used for performance and may be omitted. +* `nodes_missing_value_tracks_true`: For each node, define whether to follow the true branch (if attribute value is 1) or false branch (if attribute value is 0) in the presence of a NaN input feature. This attribute may be left undefined and the default value is false (0) for all nodes. +* `membership_values`: Members to test membership of for each set membership node. List all of the members to test again in the order that the 'BRANCH_MEMBER' mode appears in `node_modes`, delimited by `NaN`s. Will have the same number of sets of values as nodes with mode 'BRANCH_MEMBER'. This may be omitted if the node doesn't contain any 'BRANCH_MEMBER' nodes. +* `n_targets`: The total number of targets. + + +## Returns + +* Output of shape [Batch Size, Number of targets] + +## Type Constraints + +`TreeEnsembleClassifier` and `X` must be fixed points + +## Examples + +```rust +use orion::numbers::FP16x16; +use orion::operators::tensor::{Tensor, TensorTrait, FP16x16Tensor, U32Tensor}; +use orion::operators::ml::{TreeEnsembleTrait,POST_TRANSFORM, AGGREGATE_FUNCTION, NODE_MODE}; +use orion::operators::matrix::{MutMatrix, MutMatrixImpl}; +use orion::numbers::NumberTrait; + +fn example_tree_ensemble_one_tree() -> MutMatrix:: { + let mut shape = ArrayTrait::::new(); + shape.append(3); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 78643, sign: false }); + data.append(FP16x16 { mag: 222822, sign: false }); + data.append(FP16x16 { mag: 7864, sign: true }); + data.append(FP16x16 { mag: 108789, sign: false }); + data.append(FP16x16 { mag: 271319, sign: false }); + data.append(FP16x16 { mag: 115998, sign: false }); + let mut X = TensorTrait::new(shape.span(), data.span()); + + let mut shape = ArrayTrait::::new(); + shape.append(4); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 342753, sign: false }); + data.append(FP16x16 { mag: 794296, sign: false }); + data.append(FP16x16 { mag: 801505, sign: true }); + data.append(FP16x16 { mag: 472514, sign: false }); + let leaf_weights = TensorTrait::new(shape.span(), data.span()); + + let mut shape = ArrayTrait::::new(); + shape.append(3); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 205783, sign: false }); + data.append(FP16x16 { mag: 78643, sign: false }); + data.append(FP16x16 { mag: 275251, sign: false }); + let nodes_splits = TensorTrait::new(shape.span(), data.span()); + + let membership_values = Option::None; + + let n_targets = 2; + let aggregate_function = AGGREGATE_FUNCTION::SUM; + let nodes_missing_value_tracks_true = Option::None; + let nodes_hitrates = Option::None; + let post_transform = POST_TRANSFORM::NONE; + + let tree_roots: Span = array![0].span(); + let nodes_modes: Span = array![MODE::LEQ, MODE::LEQ, MODE::LEQ].span(); + + let nodes_featureids: Span = array![0, 0, 0].span(); + let nodes_truenodeids: Span = array![1, 0, 1].span(); + let nodes_trueleafs: Span = array![0, 1, 1].span(); + let nodes_falsenodeids: Span = array![2, 2, 3].span(); + let nodes_falseleafs: Span = array![0, 1, 1].span(); + let leaf_targetids: Span = array![0, 1, 0, 1].span(); + + return TreeEnsembleTrait::predict( + @X, + nodes_splits, + nodes_featureids, + nodes_modes, + nodes_truenodeids, + nodes_falsenodeids, + nodes_trueleafs, + nodes_falseleafs, + leaf_targetids, + leaf_weights, + tree_roots, + post_transform, + aggregate_function, + nodes_hitrates, + nodes_missing_value_tracks_true, + membership_values, + n_targets + ); +} + +>>> [[ 5.23 0. ] + [ 5.23 0. ] + [ 0. 12.12]] +``` diff --git a/docs/framework/operators/neural-network/nn.deform_conv.md b/docs/framework/operators/neural-network/nn.deform_conv.md new file mode 100644 index 000000000..6a6718645 --- /dev/null +++ b/docs/framework/operators/neural-network/nn.deform_conv.md @@ -0,0 +1,152 @@ +# NNTrait::deform_conv + +```rust + fn deform_conv( + X: @Tensor, + W: @Tensor, + offset: @Tensor, + B: Option>, + mask: Option>, + dilations: Option>, + group: Option, + kernel_shape: Option>, + offset_group: Option, + pads: Option>, + strides: Option>, + ) -> Tensor +``` + +Performs deformable convolution as described in https://arxiv.org/abs/1703.06211 and https://arxiv.org/abs/1811.11168. This operator specification supports the 2-D case. + +## Args + + X: @Tensor, + W: @Tensor, + offset: @Tensor, + B: Option>, + mask: Option>, + dilations: Option>, + group: Option, + kernel_shape: Option>, + offset_group: Option, + pads: Option>, + strides: Option>, + +* `X`(`@Tensor`) - Input data tensor. For 2D image data, it has shape (N, C, H, W) where N is the batch size, C is the number of input channels, and H and W are the height and width. +* `W`(`@Tensor`) - Weight tensor that will be used in the convolutions. It has shape (oC, C/group, kH, kW), where oC is the number of output channels and kH and kW are the kernel height and width. +* `offset`(`@Tensor`) - Offset tensor denoting the offset for the sampling locations in the convolution kernel. It has shape (N, offset_group * kH * kW * 2, oH, oW) for 2D data +* `B`(`Option>`) - Default is a tensor of zeros, optional 1D bias of length oC to be added to the convolution. +* `mask`(`Option>`) - Default is a tensor of ones, the mask tensor to be applied to each position in the convolution kernel. It has shape (N, offset_group * kH * kW, oH, oW) for 2D data. +* `dilations`(`Option>`) - Default is 1 along each axis, dilation value along each spatial axis of the kernel. +* `group`(`usize`) - Default is 1, number of groups the input and output channels, C and oC, are divided into. +* `kernel_shape`(`Option>`) - Shape of the convolution kernel. If not present, it is inferred from the shape of input W. +* `offset_group`(`Option`) - Default is 1, number of groups of offset. C must be divisible by offset_group. +* `pads`(`Option>`) - Default is 0 along each axis, padding for the beginning and end along each spatial axis. The values represent the number of pixels added to the beginning and end of the corresponding axis and can take any nonnegative value. +* `strides`(`Option>`) - Default is 1 along each axis, stride along each spatial axis. + +## Returns + +A `Tensor` output tensor that contains the result of convolution. + +## Examples + +```rust +fn example_deform_conv() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(1); + shape.append(3); + shape.append(3); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 262144, sign: false }); + data.append(FP16x16 { mag: 327680, sign: false }); + data.append(FP16x16 { mag: 393216, sign: false }); + data.append(FP16x16 { mag: 458752, sign: false }); + data.append(FP16x16 { mag: 524288, sign: false }); + let mut X = TensorTrait::new(shape.span(), data.span()); + + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(1); + shape.append(2); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + let mut W = TensorTrait::new(shape.span(), data.span()); + + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(8); + shape.append(2); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 32768, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 6553, sign: true }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + let mut offset = TensorTrait::new(shape.span(), data.span()); + + + return NNTrait::deform_conv( + @X, + @W, + @offset, + Option::None, + Option::None, + Option::None, + Option::None, + Option::Some(array![2, 2].span()), + Option::None, + Option::Some(array![0, 0, 0, 0].span()), + Option::None, + ); +} + +>>> [ + [ + [ + [9.5, 11.9], + [20.0, 24.0], + ] + ] + ] + +```` \ No newline at end of file diff --git a/docs/framework/operators/neural-network/nn.max_pool.md b/docs/framework/operators/neural-network/nn.max_pool.md new file mode 100644 index 000000000..e3ad8d84e --- /dev/null +++ b/docs/framework/operators/neural-network/nn.max_pool.md @@ -0,0 +1,107 @@ + +# NNTrait::max_pool + +```rust + fn max_pool( + X: @Tensor, + auto_pad: Option, + ceil_mode: Option, + dilations: Option>, + kernel_shape: Span, + pads: Option>, + storage_order: Option, + strides: Option>, + output_len: usize, +) -> (Tensor, Option>); +``` + +MaxPool consumes an input tensor X and applies max pooling across the tensor according to kernel sizes, stride sizes, and pad lengths. max pooling consisting of computing the max on all values of a subset of the input tensor according to the kernel size and downsampling the data into the output tensor Y for further processing. The output spatial shape is calculated differently depending on whether explicit padding is used, where pads is employed, or auto padding is used, where auto_pad is utilized. + +## Args + +* `X`(`@Tensor`) - Input data tensor from the previous operator; dimensions for image case are (N x C x H x W), where N is the batch size, C is the number of channels, and H and W are the height and the width of the data. For non image case, the dimensions are in the form of (N x C x D1 x D2 ... Dn), where N is the batch size. +* `auto_pad`(`Option`) - Default is NOTSET, auto_pad must be either NOTSET, SAME_UPPER, SAME_LOWER or VALID. NOTSET means explicit padding is used. SAME_UPPER or SAME_LOWER mean pad the input so that `output_shape[i] = ceil(input_shape[i] / strides[i])` for each axis `i`. +* `ceil_mode`(`Option`) - Default is 1, Whether to use ceil or floor (default) to compute the output shape. +* `dilations`(`Option>`) - Dilation value along each spatial axis of the filter. If not present, the dilation defaults to 1 along each spatial axis. +* `kernel_shape`(`Span`) - The size of the kernel along each axis. +* `pads`(`Option>`) - Padding for the beginning and ending along each spatial axis, it can take any value greater than or equal to 0. The value represent the number of pixels added to the beginning and end part of the corresponding axis. `pads` format should be as follow [x1_begin, x2_begin...x1_end, x2_end,...], where xi_begin the number of pixels added at the beginning of axis `i` and xi_end, the number of pixels added at the end of axis `i`. This attribute cannot be used simultaneously with auto_pad attribute. If not present, the padding defaults to 0 along start and end of each spatial axis. +* `storage_order`(`Option`) - Default is 0, The storage order of the tensor. 0 is row major, and 1 is column major. +* `strides`(`Option>`) - Stride along each spatial axis. If not present, the stride defaults to 1 along each spatial axis. +* `output_len`(`Option`) - Default is 1, If set to 2, return the indices tensor. + +## Returns + +A `Tensor` that contains the result of the max pool. +A `Option>` with the indices tensor from max pooling across the input tensor. The dimensions of indices are the same as output tensor. +## Examples + +```rust +use orion::operators::nn::NNTrait; +use orion::numbers::FixedTrait; +use orion::operators::nn::FP16x16NN; +use orion::numbers::FP16x16; +use orion::operators::tensor::{Tensor, TensorTrait, FP16x16Tensor}; + + +fn example_max_pool() -> (Tensor, Option>) { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(1); + shape.append(5); + shape.append(5); + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 262144, sign: false }); + data.append(FP16x16 { mag: 327680, sign: false }); + data.append(FP16x16 { mag: 393216, sign: false }); + data.append(FP16x16 { mag: 458752, sign: false }); + data.append(FP16x16 { mag: 524288, sign: false }); + data.append(FP16x16 { mag: 589824, sign: false }); + data.append(FP16x16 { mag: 655360, sign: false }); + data.append(FP16x16 { mag: 720896, sign: false }); + data.append(FP16x16 { mag: 786432, sign: false }); + data.append(FP16x16 { mag: 851968, sign: false }); + data.append(FP16x16 { mag: 917504, sign: false }); + data.append(FP16x16 { mag: 983040, sign: false }); + data.append(FP16x16 { mag: 1048576, sign: false }); + data.append(FP16x16 { mag: 1114112, sign: false }); + data.append(FP16x16 { mag: 1179648, sign: false }); + data.append(FP16x16 { mag: 1245184, sign: false }); + data.append(FP16x16 { mag: 1310720, sign: false }); + data.append(FP16x16 { mag: 1376256, sign: false }); + data.append(FP16x16 { mag: 1441792, sign: false }); + data.append(FP16x16 { mag: 1507328, sign: false }); + data.append(FP16x16 { mag: 1572864, sign: false }); + data.append(FP16x16 { mag: 1638400, sign: false }); + let mut X = TensorTrait::new(shape.span(), data.span()); + return NNTrait::max_pool( + @X, + Option::None, + Option::None, + Option::None, + array![5, 5, 5].span(), + Option::Some(array![2, 2, 2, 2].span()), + Option::None, + Option::None, + 1 + ); + +} + +>>> ([ + [ + [ + [13, 14, 15, 15, 15], + [18, 19, 20, 20, 20], + [23, 24, 25, 25, 25], + [23, 24, 25, 25, 25], + [23, 24, 25, 25, 25], + ] + ] + ], + Option::None) + + +```` diff --git a/docs/framework/operators/neural-network/nn.softmax.md b/docs/framework/operators/neural-network/nn.softmax.md index 4fb83e0b3..23735312b 100644 --- a/docs/framework/operators/neural-network/nn.softmax.md +++ b/docs/framework/operators/neural-network/nn.softmax.md @@ -1,7 +1,7 @@ # NNTrait::softmax ```rust - fn softmax(tensor: @Tensor, axis: usize) -> Tensor; + fn softmax(tensor: @Tensor, axis: Option) -> Tensor; ``` Applies the Softmax function to an n-dimensional input Tensor rescaling them so that the elements of the n-dimensional output Tensor lie in the range \[0,1] and sum to 1. @@ -13,7 +13,7 @@ $$ ## Args * `tensor`(`@Tensor`) - The input tensor. -* `axis`(`usize`) - The axis along which to compute the softmax. +* `axis`(`Option`) - Describes the dimension Softmax will be performed on. Negative value means counting dimensions from the back. Accepted range is [-r, r-1] where r = rank(input). ## Returns @@ -44,7 +44,7 @@ fn softmax_example() -> Tensor { .span(), ); - return NNTrait::softmax(@tensor, 1); + return NNTrait::softmax(@tensor, Option::Some(1)); } >>> [[2255697,6132911],[2255697,6132911]] // The fixed point representation of diff --git a/docs/framework/operators/tensor/README.md b/docs/framework/operators/tensor/README.md index fe2995096..eba6bc647 100644 --- a/docs/framework/operators/tensor/README.md +++ b/docs/framework/operators/tensor/README.md @@ -86,6 +86,7 @@ use orion::operators::tensor::TensorTrait; | [`tensor.qlinear_matmul`](tensor.qlinear\_matmul.md) | Performs the product of two quantized i8 Tensors. | | [`tensor.qlinear_concat`](tensor.qlinear\_concat.md) | Concatenate a list of tensors after dequantizing them with their respective scales and zero_points and returns the quantized result. | | [`tensor.qlinear_leakyrelu`](tensor.qlinear\_leakyrelu.md) | Applies the Leaky Relu operator to a quantized Tensor | +| [`tensor.qlinear_conv`](tensor.qlinear\_conv.md) | Performs convolution on quantized Tensors | | [`tensor.gather`](tensor.gather.md) | Gather entries of the axis dimension of data. | | [`tensor.nonzero`](tensor.nonzero.md) | Produces indices of the elements that are non-zero (in row-major order - by dimension). | | [`tensor.squeeze`](tensor.squeeze.md) | Removes dimensions of size 1 from the shape of a tensor. | diff --git a/docs/framework/operators/tensor/tensor.argmax.md b/docs/framework/operators/tensor/tensor.argmax.md index cb3457a45..43b1e3721 100644 --- a/docs/framework/operators/tensor/tensor.argmax.md +++ b/docs/framework/operators/tensor/tensor.argmax.md @@ -1,7 +1,7 @@ # tensor.argmax ```rust - fn argmax(self: @Tensor, axis: usize, keepdims: Option, select_last_index: Option) -> Tensor; + fn argmax(self: @Tensor, axis: i32, keepdims: Option, select_last_index: Option) -> Tensor; ``` Returns the index of the maximum value along the specified axis. @@ -9,7 +9,7 @@ Returns the index of the maximum value along the specified axis. ## Args * `self`(`@Tensor`) - The input tensor. -* `axis`(`usize`) - The axis along which to compute the argmax. +* `axis`(`i32`) - The axis along which to compute the argmax. * `keepdims`(`Option`) - If true, retains reduced dimensions with length 1. Defaults to true. * `select_last_index`(`Option`) - If true, the index of the last occurrence of the maximum value is returned. Defaults to false. diff --git a/docs/framework/operators/tensor/tensor.center_crop_pad.md b/docs/framework/operators/tensor/tensor.center_crop_pad.md new file mode 100644 index 000000000..0c46caec6 --- /dev/null +++ b/docs/framework/operators/tensor/tensor.center_crop_pad.md @@ -0,0 +1,42 @@ +# tensor.center_crop_pad + +```rust +fn center_crop_pad( + self: @Tensor, shape: Tensor, axes: Option>, zero: T +) -> Tensor +``` + +Center crop or pad an input to given dimensions. + +## Args + +* `self`(`@Tensor`) - Input to extract the centered crop from. +* `shape`(Tensor) - 1-D tensor representing the cropping window dimensions. +* `axes`(Option) - If provided, it specifies a subset of axes that ‘shape’ refer to. + +## Panics + +* Panics if axes is a negative number, axis+rank (self) is less than 0. + +## Returns + +Output data of tensors after crop/pad. + +## Examples + +```rust +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor}; +use core::option::OptionTrait; +fn center_crop_pad_example() -> Tensor { + let tensor: Tensor = TensorTrait::::new( + shape: array![5,4,1].span(), + data: array![ + 1, 2, 3, 4, 5, 6, 7,8,9,10,11,12,13,14,15,16,17,18,19,20 + ].span(), + ); + // We can call `center_crop_pad` function as follows. + return tensor.center_crop_pad(TensorTrait::new(array![3].span(), array![5,2,1].span()), Option::None(())); +} +>>> [[2,3],[6,7],[10,11],[14,15],[18,19]] +``` diff --git a/docs/framework/operators/tensor/tensor.gather.md b/docs/framework/operators/tensor/tensor.gather.md index 218b01385..e94f9c6c1 100644 --- a/docs/framework/operators/tensor/tensor.gather.md +++ b/docs/framework/operators/tensor/tensor.gather.md @@ -1,7 +1,7 @@ # tensor.gather ```rust - fn gather(self: @Tensor, indices: Tensor, axis: Option) -> Tensor; + fn gather(self: @Tensor, indices: Tensor, axis: Option) -> Tensor; ``` Gather entries of the axis dimension of data. @@ -9,8 +9,8 @@ Gather entries of the axis dimension of data. ## Args * `self`(`@Tensor`) - The input tensor. -* `indices`(`Tensor`) - Tensor of indices. -* `axis`(`Option`) - Axis to gather on. Default: axis=0. +* `indices`(`Tensor`) - Tensor of indices. +* `axis`(`Option`) - Axis to gather on. Default: axis=0. ## Panics @@ -32,7 +32,7 @@ fn gather_example() -> Tensor { shape: array![2, 3].span(), data: array![[ 1, 2, 3],[4, 5, 6]].span(), ); - let indices = TensorTrait::::new( + let indices = TensorTrait::::new( shape: array![1, 1].span(), data: array![1, 0].span(), ); diff --git a/docs/framework/operators/tensor/tensor.gather_elements.md b/docs/framework/operators/tensor/tensor.gather_elements.md index 9bda94eb6..b490db030 100644 --- a/docs/framework/operators/tensor/tensor.gather_elements.md +++ b/docs/framework/operators/tensor/tensor.gather_elements.md @@ -1,7 +1,7 @@ # tensor.gather_elements ```rust - fn gather_elements(self: @Tensor, indices: Tensor, axis: Option) -> Tensor; + fn gather_elements(self: @Tensor, indices: Tensor, axis: Option) -> Tensor; ``` GatherElements is an indexing operation that produces its output by indexing into the input data tensor at index positions determined by elements of the indices tensor. @@ -9,8 +9,8 @@ GatherElements is an indexing operation that produces its output by indexing int ## Args * `self`(`@Tensor`) - The input tensor. -* `indices`(`Tensor`) - Tensor of indices. -* `axis`(`Option`) - Axis to gather_elements on. Default: axis=0. +* `indices`(`Tensor`) - Tensor of indices. +* `axis`(`Option`) - Axis to gather_elements on. Default: axis=0. ## Panics @@ -32,7 +32,7 @@ fn gather_elements_example() -> Tensor { shape: array![3, 3].span(), data: array![[ 1, 2, 3],[4, 5, 6], [7, 8, 9]].span(), ); - let indices = TensorTrait::::new( + let indices = TensorTrait::::new( shape: array![1, 2, 0].span(), data: array![2, 0, 0].span(), ); diff --git a/docs/framework/operators/tensor/tensor.less.md b/docs/framework/operators/tensor/tensor.less.md index d5d264d8a..4013e8d93 100644 --- a/docs/framework/operators/tensor/tensor.less.md +++ b/docs/framework/operators/tensor/tensor.less.md @@ -1,7 +1,7 @@ #tensor.less ```rust - fn less(self: @Tensor, other: @Tensor) -> Tensor; + fn less(self: @Tensor, other: @Tensor) -> Tensor; ``` Check if each element of the first tensor is less than the corresponding element of the second tensor. @@ -20,7 +20,7 @@ The input tensors must have either: ## Returns -A new `Tensor` of booleans (0 or 1) with the same shape as the broadcasted inputs. +A new `Tensor` of booleans with the same shape as the broadcasted inputs. ## Examples @@ -31,7 +31,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor}; -fn less_example() -> Tensor { +fn less_example() -> Tensor { let tensor_1 = TensorTrait::::new( shape: array![3, 3, 3].span(), data: array![0, 1, 2, 3, 4, 5, 6, 7, 8].span(), ); @@ -53,7 +53,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor}; -fn less_example() -> Tensor { +fn less_example() -> Tensor { let tensor_1 = TensorTrait::::new( shape: array![3, 3, 3].span(), data: array![0, 1, 2, 3, 4, 5, 6, 7, 8].span(), ); diff --git a/docs/framework/operators/tensor/tensor.less_equal.md b/docs/framework/operators/tensor/tensor.less_equal.md index c440b39c6..8e7943f91 100644 --- a/docs/framework/operators/tensor/tensor.less_equal.md +++ b/docs/framework/operators/tensor/tensor.less_equal.md @@ -1,7 +1,7 @@ #tensor.less_equal ```rust - fn less_equal(self: @Tensor, other: @Tensor) -> Tensor; + fn less_equal(self: @Tensor, other: @Tensor) -> Tensor; ``` Check if each element of the first tensor is less than or equal to the corresponding element of the second tensor. @@ -20,7 +20,7 @@ The input tensors must have either: ## Returns -A new `Tensor` of booleans (0 or 1) with the same shape as the broadcasted inputs. +A new `Tensor` of booleans (0 or 1) with the same shape as the broadcasted inputs. ## Examples @@ -31,7 +31,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor}; -fn less_equal_example() -> Tensor { +fn less_equal_example() -> Tensor { let tensor_1 = TensorTrait::::new( shape: array![3, 3, 3].span(), data: array![0, 1, 2, 3, 4, 5, 6, 7, 8].span(), ); @@ -53,7 +53,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor}; -fn less_equal_example() -> Tensor { +fn less_equal_example() -> Tensor { let tensor_1 = TensorTrait::::new( shape: array![3, 3, 3].span(), data: array![0, 1, 2, 3, 4, 5, 6, 7, 8].span(), ); diff --git a/docs/framework/operators/tensor/tensor.qlinear_conv.md b/docs/framework/operators/tensor/tensor.qlinear_conv.md new file mode 100644 index 000000000..b800674c7 --- /dev/null +++ b/docs/framework/operators/tensor/tensor.qlinear_conv.md @@ -0,0 +1,159 @@ +# tensor.qlinear_conv + +```rust + +qlinear_conv( + self: @Tensor, + X_scale: @Tensor, + X_zero_point: @Tensor, + W: @Tensor, + W_scale: @Tensor, + W_zero_point: @Tensor, + B: Option>, + auto_pad: Option, + dilations: Option>, + group: Option, + kernel_shape: Option>, + pads: Option>, + strides: Option>, + y_scale: @Tensor, + y_zero_point: @Tensor, +) -> Tensor +``` + +Performs convolution on quantized Tensors + +The convolution operator consumes a quantized input tensor, its scale and zero point, a quantized filter, its scale and zero point, +and output's scale and zero point, and computes the quantized output. Each scale and zero-point pair must have same shape. +It means they must be either scalars (per tensor) or 1-D tensors (per output channel). Each input or output and its related zero point must have same type. + +## Args + +* `X`(`@Tensor`) - Quantized input data tensor, has size (N x C x H x W), where N is the batch size, C is the number of channels, and H and W are the height and width. Note that this is for the 2D image. Otherwise the size is (N x C x D1 x D2 ... x Dn). +* `X_scale`(`@Tensor`) - Scale for input `X`. +* `X_zero_point`(`@Tensor`) - Zero point for input `X`. +* `W`(`@Tensor`) - Quantized weight tensor that will be used in the convolutions; has size (M x C/group x kH x kW), where C is the number of channels, and kH and kW are the height and width of the kernel, and M is the number of feature maps. For more than 2 dimensions, the kernel shape will be (M x C/group x k1 x k2 x ... x kn), where (k1 x k2 x ... kn) is the dimension of the kernel. +* `W_scale`(`@Tensor`) - Scale for input `W`. +* `W_zero_point`(`@Tensor`) - Zero point for input `W`. +* `B`(`Option<@Tensor>`) - Optional 1D bias to be added to the convolution, has size of M. Bias must be quantized using scale = x_scale * w_scale and zero_point = 0. +* `auto_pad`(`Option`) - Default is NOTSET, auto_pad must be either NOTSET, SAME_UPPER, SAME_LOWER or VALID. NOTSET means explicit padding is used. SAME_UPPER or SAME_LOWER mean pad the input so that `output_shape[i] = ceil(input_shape[i] / strides[i])` for each axis `i`. +* `dilations`(`Option>`) - Dilation value along each spatial axis of the filter. If not present, the dilation defaults to 1 along each spatial axis. +* `group`(`Option`) - Default is 1, number of groups input channels and output channels are divided into. +* `kernel_shape`(`Option>`) - The shape of the convolution kernel. If not present, should be inferred from input W. +* `pads`(`Option>`) - Padding for the beginning and ending along each spatial axis, it can take any value greater than or equal to 0. The value represent the number of pixels added to the beginning and end part of the corresponding axis. `pads` format should be as follow [x1_begin, x2_begin...x1_end, x2_end,...], where xi_begin the number of pixels added at the beginning of axis `i` and xi_end, the number of pixels added at the end of axis `i`. This attribute cannot be used simultaneously with auto_pad attribute. If not present, the padding defaults to 0 along start and end of each spatial axis. +* `strides`(`Option>`) - Stride along each spatial axis. If not present, the stride defaults to 1 along each spatial axis. +* `y_scale`(`@Tensor`) - Scale for output. +* `y_zero_point`(`@Tensor`) - Zero point for output. + +## Returns + +A new `Tensor`, containing the quantized result of the convolution of the dequantized inputs. + +## Type Constraints + +u32 tensor, not supported. +fp8x23wide tensor, not supported. +fp16x16wide tensor, not supported. + +## Example + +```rust + use orion::operators::tensor::{TensorTrait, Tensor}; + use orion::operators::tensor::I8TensorPartialEq; + use orion::utils::{assert_eq, assert_seq_eq}; + use orion::operators::tensor::{I8Tensor, I8TensorAdd}; + use orion::operators::tensor::FP16x16TensorPartialEq; + use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; + use core::array::{ArrayTrait, SpanTrait}; + use orion::operators::tensor::implementations::tensor_fp16x16::{TensorI8IntoTensorFP16x16, FP16x16TensorSub,FP16x16TensorDiv,FP16x16TensorMul}; + use orion::numbers::{FP16x16, I8IntoFP16x16}; + + fn qlinear_conv_example() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(1); + shape.append(3); + shape.append(3); + + let mut data = ArrayTrait::new(); + data.append(1); + data.append(2); + data.append(3); + data.append(4); + data.append(5); + data.append(6); + data.append(7); + data.append(8); + data.append(9); + let mut X = TensorTrait::new(shape.span(), data.span()); + + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(1); + shape.append(1); + shape.append(1); + + let mut data = ArrayTrait::new(); + data.append(0_i8); + let mut W = TensorTrait::new(shape.span(), data.span()); + + let mut shape = ArrayTrait::::new(); + shape.append(6); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 32768, sign: false }); + data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 26214, sign: false }); + data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 13107, sign: false }); + data.append(FP16x16 { mag: 262144, sign: false }); + let mut param = TensorTrait::new(shape.span(), data.span()); + + let X_scale = TensorTrait::new( + shape: array![1].span(), data: array![*param.data.at(0)].span(), + ); + let X_zero_point = TensorTrait::new( + shape: array![1].span(), data: array![*param.data.at(1)].span(), + ); + let W_scale = TensorTrait::new( + shape: array![1].span(), data: array![*param.data.at(2)].span(), + ); + let W_zero_point = TensorTrait::new( + shape: array![1].span(), data: array![*param.data.at(3)].span(), + ); + let y_scale = TensorTrait::new( + shape: array![1].span(), data: array![*param.data.at(4)].span(), + ); + let y_zero_point = TensorTrait::new( + shape: array![1].span(), data: array![*param.data.at(5)].span(), + ); + + return X + .qlinear_conv( + @X_scale, + @X_zero_point, + @W, + @W_scale, + @W_zero_point, + Option::None, + Option::None, + Option::None, + Option::None, + Option::None, + Option::None, + Option::None, + @y_scale, + @y_zero_point, + ); + } + +>>> [ + [ + [ + [ 7, 4, 1], + [ -2, -5, -8], + [-11, -14, -17], + ] + ] + ] +``` diff --git a/docs/framework/operators/tensor/tensor.reduce_sum.md b/docs/framework/operators/tensor/tensor.reduce_sum.md index 3aa77d2ce..be4ef4029 100644 --- a/docs/framework/operators/tensor/tensor.reduce_sum.md +++ b/docs/framework/operators/tensor/tensor.reduce_sum.md @@ -1,7 +1,7 @@ ## tensor.reduce_sum ```rust - fn reduce_sum(self: @Tensor, axis: usize, keepdims: bool) -> Tensor; + fn reduce_sum(self: @Tensor, axes: Option>, keepdims: Option, noop_with_empty_axes: Option) -> Tensor; ``` Reduces a tensor by summing its elements along a specified axis. @@ -9,16 +9,13 @@ Reduces a tensor by summing its elements along a specified axis. ## Args * `self`(`@Tensor`) - The input tensor. -* `axis`(`usize`) - The dimension to reduce. -* `keepdims`(`bool`) - If true, retains reduced dimensions with length 1. - -## Panics - -* Panics if axis is not in the range of the input tensor's dimensions. +* `axes`(`Option>`) - Optional input list of integers, along which to reduce. The default is to reduce over all the dimensions of the input tensor if 'noop_with_empty_axes' is false, else act as an Identity op when 'noop_with_empty_axes' is true. +* `keepdims`(`Option`) - Keep the reduced dimension or not, default 1 means keep reduced dimension. +* `noop_with_empty_axes`(`Option`) - Defines behavior if 'axes' is empty. Default behavior with 'false' is to reduce all axes. When axes is empty and this attribute is set to true, input tensor will not be reduced,and the output tensor would be equivalent to input tensor. ## Returns -A new `Tensor` instance with the specified axis reduced by summing its elements. +Reduced output tensor. ## Examples @@ -33,7 +30,7 @@ fn reduce_sum_example() -> Tensor { ); // We can call `reduce_sum` function as follows. - return tensor.reduce_sum(axis: 0, keepdims: false); + return tensor.reduce_sum(axes: Option::None, keepdims: false); } >>> [[4,6],[8,10]] ``` diff --git a/docs/framework/operators/tensor/tensor.reshape.md b/docs/framework/operators/tensor/tensor.reshape.md index b2c8f84eb..ed21f766e 100644 --- a/docs/framework/operators/tensor/tensor.reshape.md +++ b/docs/framework/operators/tensor/tensor.reshape.md @@ -1,15 +1,21 @@ # tensor.reshape ```rust - fn reshape(self: @Tensor, target_shape: Span) -> Tensor; + fn reshape(self: @Tensor, target_shape: Span, allowzero: bool) -> Tensor; ``` -Returns a new tensor with the specified target shape and the same data as the input tensor. +Reshape the input tensor similar to numpy.reshape. First input is the data tensor, second +input is a shape tensor which specifies the output shape. It outputs the reshaped tensor. +At most one dimension of the new shape can be -1. In this case, the value is inferred from +the size of the tensor and the remaining dimensions. A dimension could also be 0, in which case +the actual dimension value is unchanged (i.e. taken from the input tensor). If 'allowzero' is set, +and the new shape includes 0, the dimension will be set explicitly to zero (i.e. not taken from input tensor) ## Args * `self`(`@Tensor`) - The input tensor. -* `target_shape`(Span) - A span containing the target shape of the tensor. +* `target_shape`(Span) - A span containing the target shape of the tensor. +* `allowzero`(`bool`) - Indicates that if any value in the 'shape' input is set to zero, the zero value is honored, similar to NumPy. ## Panics @@ -32,7 +38,7 @@ fn reshape_tensor_example() -> Tensor { ); // We can call `reshape` function as follows. - return tensor.reshape(target_shape: array![2, 4].span()); + return tensor.reshape(target_shape: array![2, 4].span(), false); } >>> [[0,1,2,3], [4,5,6,7]] ``` diff --git a/nodegen/file_manager.py b/nodegen/file_manager.py index 203b6b333..babe26399 100644 --- a/nodegen/file_manager.py +++ b/nodegen/file_manager.py @@ -91,25 +91,36 @@ def base_template( This method generates a list of strings that form the template of a Cairo test function, including module imports, function definition, and assertions. """ - return [ + template = [ *[f"mod input_{i};" for i in range(arg_cnt)], *[f"mod output_{i};" for i in range(out_cnt)], - *[""], - *[""], + "", + "", *[f"use {ref};" for ref in refs], - *[""], - *["#[test]"], - *["#[available_gas(2000000000)]"], - *[f"fn test_{name}()" + " {"], + "", + "#[test]", + "#[available_gas(2000000000)]", + f"fn test_{name}()" + " {", *[f" let input_{i} = input_{i}::input_{i}();" for i in range(arg_cnt)], *[f" let z_{i} = output_{i}::output_{i}();" for i in range(out_cnt)], - *[""], - *[f" let ({', '.join(f'y_{i}' for i in range(out_cnt))}) = {func_sig};"], - *[""], - *[f" assert_eq(y_{i}, z_{i});" for i in range(out_cnt)], - *["}"], + "" ] + # Handling conditional function signature based on the number of outputs + if out_cnt > 1: + template.append(f" let ({', '.join(f'y_{i}' for i in range(out_cnt))}) = {func_sig};") + else: + template.append(f" let y_0 = {func_sig};") + + # Continue appending to the template + template.extend([ + "", + *[f" assert_eq(y_{i}, z_{i});" for i in range(out_cnt)], + "}" + ]) + + return template + @classmethod def sequence_template(cls, name: str, arg_cnt: int, refs: list[str], func_sig: str) -> list[str]: """ diff --git a/nodegen/node/argmax.py b/nodegen/node/argmax.py index c874b2eea..69132adfe 100644 --- a/nodegen/node/argmax.py +++ b/nodegen/node/argmax.py @@ -3,673 +3,134 @@ from ..helpers import make_test, to_fp, Tensor, Dtype, FixedImpl -def argmax_use_numpy(data: np.ndarray, axis: int = 0, keepdims: int = 1, dtype=np.int64) -> np.ndarray: +def argmax_use_numpy(data: np.ndarray, axis: int = 0, keepdims: int = 1) -> np.ndarray: result = np.argmax(data, axis=axis) if keepdims == 1: result = np.expand_dims(result, axis) - return result.astype(dtype) + return result.astype(np.int64) def argmax_use_numpy_select_last_index( - data: np.ndarray, axis: int = 0, keepdims: int = True, dtype=np.int64 + data: np.ndarray, axis: int = 0, keepdims: int = True ) -> np.ndarray: data = np.flip(data, axis) result = np.argmax(data, axis=axis) result = data.shape[axis] - result - 1 if keepdims: result = np.expand_dims(result, axis) - return result.astype(dtype) + return result.astype(np.int64) class Argmax(RunAll): @staticmethod - def argmax_u32(): - def argmax_1D(): - def default_params(): - x = np.random.randint(0, 255, (3)).astype(np.uint32) - y = argmax_use_numpy(x, dtype=np.uint32).reshape((1)) + def no_keepdims(): + data = np.array([[2, 1], [3, 10]], dtype=np.float32) + axis = 1 + keepdims = 0 + result = argmax_use_numpy(data, axis=axis, keepdims=keepdims) - x = Tensor(Dtype.U32, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) + x = Tensor(Dtype.FP16x16, data.shape, data.flatten()) + y = Tensor(Dtype.I32, result.shape, result.flatten()) - name = "argmax_u32_1D_default" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::None(()))", name) - - def keepdims_false(): - x = np.random.randint(0, 255, (3)).astype(np.uint32) - y = argmax_use_numpy( - x, keepdims=0, dtype=np.uint32).reshape((1)) - - x = Tensor(Dtype.U32, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_u32_1D_keepdims_false" - make_test( - [x], y, "input_0.argmax(0, Option::Some(false), Option::None(()))", name) - - def last_index(): - x = np.random.randint(0, 255, (3)).astype(np.uint32) - y = argmax_use_numpy_select_last_index( - x, dtype=np.uint32).reshape((1)) - - x = Tensor(Dtype.U32, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_u32_1D_last_index" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::Some(true))", name) - - default_params() - keepdims_false() - last_index() - argmax_1D() - - def argmax_2D(): - def default_params(): - x = np.random.randint(0, 255, (2, 2)).astype(np.uint32) - y = argmax_use_numpy(x, dtype=np.uint32) - - x = Tensor(Dtype.U32, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_u32_2D_default" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::None(()))", name) - - def keepdims_false(): - x = np.random.randint(0, 255, (2, 2)).astype(np.uint32) - y = argmax_use_numpy( - x, keepdims=0, dtype=np.uint32) - - x = Tensor(Dtype.U32, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_u32_2D_keepdims_false" - make_test( - [x], y, "input_0.argmax(0, Option::Some(false), Option::None(()))", name) - - def last_index(): - x = np.random.randint(0, 255, (2, 2)).astype(np.uint32) - y = argmax_use_numpy_select_last_index( - x, dtype=np.uint32) - - x = Tensor(Dtype.U32, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_u32_2D_last_index" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::Some(true))", name) - - default_params() - keepdims_false() - last_index() - argmax_2D() - - def argmax_3D(): - def default_params(): - x = np.random.randint(0, 255, (2, 2, 2)).astype(np.uint32) - y = argmax_use_numpy(x, dtype=np.uint32) - - x = Tensor(Dtype.U32, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_u32_3D_default" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::None(()))", name) - - def keepdims_false(): - x = np.random.randint(0, 255, (2, 2, 2)).astype(np.uint32) - y = argmax_use_numpy( - x, keepdims=0, dtype=np.uint32) - - x = Tensor(Dtype.U32, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_u32_3D_keepdims_false" - make_test( - [x], y, "input_0.argmax(0, Option::Some(false), Option::None(()))", name) - - def last_index(): - x = np.random.randint(0, 255, (2, 2, 2)).astype(np.uint32) - y = argmax_use_numpy_select_last_index( - x, dtype=np.uint32) - - x = Tensor(Dtype.U32, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_u32_3D_last_index" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::Some(true))", name) - - default_params() - keepdims_false() - last_index() - argmax_3D() + name = "argmax_no_keepdims" + make_test( + [x], y, "input_0.argmax(1, Option::Some(false), Option::None(()))", name) @staticmethod - def argmax_i32(): - def argmax_1D(): - def default_params(): - x = np.random.randint(-127, 127, (3)).astype(np.int32) - y = argmax_use_numpy(x, dtype=np.uint32).reshape((1)) - - x = Tensor(Dtype.I32, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_i32_1D_default" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::None(()))", name) - - def keepdims_false(): - x = np.random.randint(-127, 127, (3)).astype(np.int32) - y = argmax_use_numpy( - x, keepdims=0, dtype=np.uint32).reshape((1)) - - x = Tensor(Dtype.I32, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_i32_1D_keepdims_false" - make_test( - [x], y, "input_0.argmax(0, Option::Some(false), Option::None(()))", name) - - def last_index(): - x = np.random.randint(0, 255, (3)).astype(np.int32) - y = argmax_use_numpy_select_last_index( - x, dtype=np.uint32).reshape((1)) + def keepdims(): + data = np.array([[2, 1], [3, 10]], dtype=np.float32) + axis = 1 + keepdims = 1 + result = argmax_use_numpy(data, axis=axis, keepdims=keepdims) - x = Tensor(Dtype.I32, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) + x = Tensor(Dtype.FP16x16, data.shape, data.flatten()) + y = Tensor(Dtype.I32, result.shape, result.flatten()) - name = "argmax_i32_1D_last_index" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::Some(true))", name) - - default_params() - keepdims_false() - last_index() - argmax_1D() - - def argmax_2D(): - def default_params(): - x = np.random.randint(-127, 127, (2, 2)).astype(np.int32) - y = argmax_use_numpy(x, dtype=np.uint32) - - x = Tensor(Dtype.I32, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_i32_2D_default" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::None(()))", name) - - def keepdims_false(): - x = np.random.randint(-127, 127, (2, 2)).astype(np.int32) - y = argmax_use_numpy( - x, keepdims=0, dtype=np.uint32) - - x = Tensor(Dtype.I32, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_i32_2D_keepdims_false" - make_test( - [x], y, "input_0.argmax(0, Option::Some(false), Option::None(()))", name) - - def last_index(): - x = np.random.randint(-127, 127, (2, 2)).astype(np.int32) - y = argmax_use_numpy_select_last_index( - x, dtype=np.int32) - - x = Tensor(Dtype.I32, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_i32_2D_last_index" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::Some(true))", name) - - default_params() - keepdims_false() - last_index() - argmax_2D() - - def argmax_3D(): - def default_params(): - x = np.random.randint(-127, 127, (2, 2, 2)).astype(np.int32) - y = argmax_use_numpy(x, dtype=np.uint32) - - x = Tensor(Dtype.I32, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_i32_3D_default" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::None(()))", name) - - def keepdims_false(): - x = np.random.randint(-127, 127, (2, 2, 2)).astype(np.int32) - y = argmax_use_numpy( - x, keepdims=0, dtype=np.uint32) - - x = Tensor(Dtype.I32, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_i32_3D_keepdims_false" - make_test( - [x], y, "input_0.argmax(0, Option::Some(false), Option::None(()))", name) - - def last_index(): - x = np.random.randint(-127, 127, (2, 2, 2)).astype(np.int32) - y = argmax_use_numpy_select_last_index( - x, dtype=np.uint32) - - x = Tensor(Dtype.I32, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_i32_3D_last_index" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::Some(true))", name) - - default_params() - keepdims_false() - last_index() - argmax_3D() + name = "argmax_keepdims" + make_test( + [x], y, "input_0.argmax(1, Option::Some(true), Option::None(()))", name) @staticmethod - def argmax_i8(): - def argmax_1D(): - def default_params(): - x = np.random.randint(-127, 127, (3)).astype(np.int8) - y = argmax_use_numpy(x, dtype=np.uint32).reshape((1)) - - x = Tensor(Dtype.I8, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_i8_1D_default" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::None(()))", name) - - def keepdims_false(): - x = np.random.randint(-127, 127, (3)).astype(np.int8) - y = argmax_use_numpy( - x, keepdims=0, dtype=np.uint32).reshape((1)) - - x = Tensor(Dtype.I8, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_i8_1D_keepdims_false" - make_test( - [x], y, "input_0.argmax(0, Option::Some(false), Option::None(()))", name) - - def last_index(): - x = np.random.randint(0, 255, (3)).astype(np.int8) - y = argmax_use_numpy_select_last_index( - x, dtype=np.uint32).reshape((1)) - - x = Tensor(Dtype.I8, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_i8_1D_last_index" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::Some(true))", name) - - default_params() - keepdims_false() - last_index() - argmax_1D() - - def argmax_2D(): - def default_params(): - x = np.random.randint(-127, 127, (2, 2)).astype(np.int8) - y = argmax_use_numpy(x, dtype=np.uint32) - - x = Tensor(Dtype.I8, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_i8_2D_default" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::None(()))", name) + def default_axes_keepdims(): + data = np.array([[2, 1], [3, 10]], dtype=np.float32) + keepdims = 1 + result = argmax_use_numpy(data, keepdims=keepdims) - def keepdims_false(): - x = np.random.randint(-127, 127, (2, 2)).astype(np.int8) - y = argmax_use_numpy( - x, keepdims=0, dtype=np.uint32) + x = Tensor(Dtype.FP16x16, data.shape, data.flatten()) + y = Tensor(Dtype.I32, result.shape, result.flatten()) - x = Tensor(Dtype.I8, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_i8_2D_keepdims_false" - make_test( - [x], y, "input_0.argmax(0, Option::Some(false), Option::None(()))", name) - - def last_index(): - x = np.random.randint(-127, 127, (2, 2)).astype(np.int8) - y = argmax_use_numpy_select_last_index( - x, dtype=np.int8) - - x = Tensor(Dtype.I8, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_i8_2D_last_index" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::Some(true))", name) - - default_params() - keepdims_false() - last_index() - argmax_2D() - - def argmax_3D(): - def default_params(): - x = np.random.randint(-127, 127, (2, 2, 2)).astype(np.int8) - y = argmax_use_numpy(x, dtype=np.uint32) - - x = Tensor(Dtype.I8, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_i8_3D_default" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::None(()))", name) - - def keepdims_false(): - x = np.random.randint(-127, 127, (2, 2, 2)).astype(np.int8) - y = argmax_use_numpy( - x, keepdims=0, dtype=np.uint32) - - x = Tensor(Dtype.I8, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_i8_3D_keepdims_false" - make_test( - [x], y, "input_0.argmax(0, Option::Some(false), Option::None(()))", name) - - def last_index(): - x = np.random.randint(-127, 127, (2, 2, 2)).astype(np.int8) - y = argmax_use_numpy_select_last_index( - x, dtype=np.uint32) - - x = Tensor(Dtype.I8, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_i8_3D_last_index" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::Some(true))", name) - - default_params() - keepdims_false() - last_index() - argmax_3D() + name = "argmax_default_axes_keepdims" + make_test( + [x], y, "input_0.argmax(0, Option::Some(true), Option::None(()))", name) @staticmethod - def argmax_fp16x16(): - def argmax_1D(): - def default_params(): - x = to_fp(np.random.randint(-127, 127, (3) - ).astype(np.int8), FixedImpl.FP16x16) - y = argmax_use_numpy(x, dtype=np.uint32).reshape((1)) - - x = Tensor(Dtype.FP16x16, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_fp16x16_1D_default" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::None(()))", name) - - def keepdims_false(): - x = to_fp(np.random.randint(-127, 127, (3) - ).astype(np.int8), FixedImpl.FP16x16) - y = argmax_use_numpy( - x, keepdims=0, dtype=np.uint32).reshape((1)) - - x = Tensor(Dtype.FP16x16, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_fp16x16_1D_keepdims_false" - make_test( - [x], y, "input_0.argmax(0, Option::Some(false), Option::None(()))", name) - - def last_index(): - x = to_fp(np.random.randint(0, 255, (3)).astype( - np.int8), FixedImpl.FP16x16) - y = argmax_use_numpy_select_last_index( - x, dtype=np.uint32).reshape((1)) - - x = Tensor(Dtype.FP16x16, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_fp16x16_1D_last_index" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::Some(true))", name) - - default_params() - keepdims_false() - last_index() - argmax_1D() - - def argmax_2D(): - def default_params(): - x = to_fp(np.random.randint(-127, 127, (2, 2) - ).astype(np.int8), FixedImpl.FP16x16) - y = argmax_use_numpy(x, dtype=np.uint32) - - x = Tensor(Dtype.FP16x16, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_fp16x16_2D_default" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::None(()))", name) - - def keepdims_false(): - x = to_fp(np.random.randint(-127, 127, (2, 2) - ).astype(np.int8), FixedImpl.FP16x16) - y = argmax_use_numpy( - x, keepdims=0, dtype=np.uint32) - - x = Tensor(Dtype.FP16x16, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_fp16x16_2D_keepdims_false" - make_test( - [x], y, "input_0.argmax(0, Option::Some(false), Option::None(()))", name) - - def last_index(): - x = to_fp(np.random.randint(-127, 127, (2, 2) - ).astype(np.int8), FixedImpl.FP16x16) - y = argmax_use_numpy_select_last_index( - x, dtype=np.int8) - - x = Tensor(Dtype.FP16x16, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_fp16x16_2D_last_index" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::Some(true))", name) + def negative_axis_keepdims(): + data = np.array([[2, 1], [3, 10]], dtype=np.float32) + axis = -1 + keepdims = 1 + result = argmax_use_numpy(data, axis=axis, keepdims=keepdims) - default_params() - keepdims_false() - last_index() - argmax_2D() + x = Tensor(Dtype.FP16x16, data.shape, data.flatten()) + y = Tensor(Dtype.I32, result.shape, result.flatten()) - def argmax_3D(): - def default_params(): - x = to_fp(np.random.randint(-127, 127, (2, 2, 2) - ).astype(np.int8), FixedImpl.FP16x16) - y = argmax_use_numpy(x, dtype=np.uint32) - - x = Tensor(Dtype.FP16x16, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_fp16x16_3D_default" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::None(()))", name) - - def keepdims_false(): - x = to_fp(np.random.randint(-127, 127, (2, 2, 2) - ).astype(np.int8), FixedImpl.FP16x16) - y = argmax_use_numpy( - x, keepdims=0, dtype=np.uint32) - - x = Tensor(Dtype.FP16x16, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_fp16x16_3D_keepdims_false" - make_test( - [x], y, "input_0.argmax(0, Option::Some(false), Option::None(()))", name) - - def last_index(): - x = to_fp(np.random.randint(-127, 127, (2, 2, 2) - ).astype(np.int8), FixedImpl.FP16x16) - y = argmax_use_numpy_select_last_index( - x, dtype=np.uint32) - - x = Tensor(Dtype.FP16x16, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_fp16x16_3D_last_index" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::Some(true))", name) - - default_params() - keepdims_false() - last_index() - argmax_3D() + name = "argmax_negative_axis_keepdims" + make_test( + [x], y, "input_0.argmax(-1, Option::Some(true), Option::None(()))", name) @staticmethod - def argmax_fp8x23(): - def argmax_1D(): - def default_params(): - x = to_fp(np.random.randint(-127, 127, (3) - ).astype(np.int8), FixedImpl.FP8x23) - y = argmax_use_numpy(x, dtype=np.uint32).reshape((1)) - - x = Tensor(Dtype.FP8x23, x.shape, - x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_fp8x23_1D_default" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::None(()))", name) - - def keepdims_false(): - x = to_fp(np.random.randint(-127, 127, (3) - ).astype(np.int8), FixedImpl.FP8x23) - y = argmax_use_numpy( - x, keepdims=0, dtype=np.uint32).reshape((1)) - - x = Tensor(Dtype.FP8x23, x.shape, - x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_fp8x23_1D_keepdims_false" - make_test( - [x], y, "input_0.argmax(0, Option::Some(false), Option::None(()))", name) - - def last_index(): - x = to_fp(np.random.randint(0, 255, (3)).astype( - np.int8), FixedImpl.FP8x23) - y = argmax_use_numpy_select_last_index( - x, dtype=np.uint32).reshape((1)) - - x = Tensor(Dtype.FP8x23, x.shape, - x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) + def no_keepdims_select_last_index(): + data = np.array([[2, 2], [3, 10]], dtype=np.float32) + axis = 1 + keepdims = 0 + result = argmax_use_numpy_select_last_index( + data, axis=axis, keepdims=keepdims) - name = "argmax_fp8x23_1D_last_index" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::Some(true))", name) + x = Tensor(Dtype.FP16x16, data.shape, data.flatten()) + y = Tensor(Dtype.I32, result.shape, result.flatten()) - default_params() - keepdims_false() - last_index() - argmax_1D() + name = "argmax_no_keepdims_select_last_index" + make_test( + [x], y, "input_0.argmax(1, Option::Some(false), Option::Some(true))", name) - def argmax_2D(): - def default_params(): - x = to_fp(np.random.randint(-127, 127, (2, 2) - ).astype(np.int8), FixedImpl.FP8x23) - y = argmax_use_numpy(x, dtype=np.uint32) - - x = Tensor(Dtype.FP8x23, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_fp8x23_2D_default" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::None(()))", name) - - def keepdims_false(): - x = to_fp(np.random.randint(-127, 127, (2, 2) - ).astype(np.int8), FixedImpl.FP8x23) - y = argmax_use_numpy( - x, keepdims=0, dtype=np.uint32) - - x = Tensor(Dtype.FP8x23, x.shape, - x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_fp8x23_2D_keepdims_false" - make_test( - [x], y, "input_0.argmax(0, Option::Some(false), Option::None(()))", name) - - def last_index(): - x = to_fp(np.random.randint(-127, 127, (2, 2) - ).astype(np.int8), FixedImpl.FP8x23) - y = argmax_use_numpy_select_last_index( - x, dtype=np.int8) - - x = Tensor(Dtype.FP8x23, x.shape, - x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_fp8x23_2D_last_index" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::Some(true))", name) - - default_params() - keepdims_false() - last_index() - argmax_2D() - - def argmax_3D(): - def default_params(): - x = to_fp(np.random.randint(-127, 127, (2, 2, 2) - ).astype(np.int8), FixedImpl.FP8x23) - y = argmax_use_numpy(x, dtype=np.uint32) - - x = Tensor(Dtype.FP8x23, x.shape, - x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "argmax_fp8x23_3D_default" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::None(()))", name) - - def keepdims_false(): - x = to_fp(np.random.randint(-127, 127, (2, 2, 2) - ).astype(np.int8), FixedImpl.FP8x23) - y = argmax_use_numpy( - x, keepdims=0, dtype=np.uint32) + @staticmethod + def keepdims_select_last_index(): + data = np.array([[2, 2], [3, 10]], dtype=np.float32) + axis = 1 + keepdims = 1 + result = argmax_use_numpy_select_last_index( + data, axis=axis, keepdims=keepdims) - x = Tensor(Dtype.FP8x23, x.shape, - x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) + x = Tensor(Dtype.FP16x16, data.shape, data.flatten()) + y = Tensor(Dtype.I32, result.shape, result.flatten()) - name = "argmax_fp8x23_3D_keepdims_false" - make_test( - [x], y, "input_0.argmax(0, Option::Some(false), Option::None(()))", name) + name = "argmax_keepdims_select_last_index" + make_test( + [x], y, "input_0.argmax(1, Option::Some(true), Option::Some(true))", name) - def last_index(): - x = to_fp(np.random.randint(-127, 127, (2, 2, 2) - ).astype(np.int8), FixedImpl.FP8x23) - y = argmax_use_numpy_select_last_index( - x, dtype=np.uint32) + @staticmethod + def default_axes_keepdims_select_last_index(): + data = np.array([[2, 2], [3, 10]], dtype=np.float32) + keepdims = 1 + result = argmax_use_numpy_select_last_index(data, keepdims=keepdims) - x = Tensor(Dtype.FP8x23, x.shape, - x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) + x = Tensor(Dtype.FP16x16, data.shape, data.flatten()) + y = Tensor(Dtype.I32, result.shape, result.flatten()) - name = "argmax_fp8x23_3D_last_index" - make_test( - [x], y, "input_0.argmax(0, Option::None(()), Option::Some(true))", name) + name = "argmax_default_axes_keepdims_select_last_index" + make_test( + [x], y, "input_0.argmax(0, Option::Some(true), Option::Some(true))", name) - default_params() - keepdims_false() - last_index() - argmax_3D() + @staticmethod + def negative_axis_keepdims_select_last_index(): + data = np.array([[2, 2], [3, 10]], dtype=np.float32) + axis = -1 + keepdims = 1 + result = argmax_use_numpy_select_last_index(data, axis=axis, keepdims=keepdims) + + x = Tensor(Dtype.FP16x16, data.shape, data.flatten()) + y = Tensor(Dtype.I32, result.shape, result.flatten()) + + name = "argmax_negative_axis_keepdims_select_last_index" + make_test( + [x], y, "input_0.argmax(-1, Option::Some(true), Option::Some(true))", name) diff --git a/nodegen/node/center_crop_pad.py b/nodegen/node/center_crop_pad.py new file mode 100644 index 000000000..d8b0432c1 --- /dev/null +++ b/nodegen/node/center_crop_pad.py @@ -0,0 +1,69 @@ +import numpy as np +from nodegen.node import RunAll +from ..helpers import make_test, to_fp, Tensor, Dtype, FixedImpl + + +class Center_crop_pad(RunAll): + @staticmethod + def export_center_crop_pad_crop(): + x = np.array(range(600), dtype=np.complex64).reshape((20,10,3)) + _x = Tensor(Dtype.COMPLEX64, x.shape, x.flatten()) + y = x[5:15, 1:8, :] + _y = Tensor(Dtype.COMPLEX64, y.shape, y.flatten()) + + name = "export_center_crop_pad_crop" + make_test([_x], _y, "input_0.center_crop_pad(TensorTrait::new(array![3].span(), array![10,7,3].span())), Option::None(()))", name) + + @staticmethod + def export_center_crop_pad_pad(): + x = np.array(range(210), dtype=np.complex64).reshape((10,7,3)) + _x = Tensor(Dtype.COMPLEX64, x.shape, x.flatten()) + y = np.zeros([20,10,3], dtype=np.complex64) + y[5:15, 1:8, :] = x + _y = Tensor(Dtype.COMPLEX64, y.shape, y.flatten()) + + name = "export_center_crop_pad_pad" + make_test([_x], _y, "input_0.center_crop_pad(TensorTrait::new(array![3].span(), array![20,10,3].span()), Option::None(()))", name) + + @staticmethod + def export_center_crop_pad_crop_and_pad(): + # x = np.random.randn(20, 8, 3).astype(np.complex64) + x = np.array(np.random.randn(20,8,3), dtype=np.complex64) + _x = Tensor(Dtype.COMPLEX64, x.shape, x.flatten()) + y = np.zeros([10,10,3], dtype=np.complex64) + y[:, 1:9, :] = x[5:15, :, :] + _y = Tensor(Dtype.COMPLEX64, y.shape, y.flatten()) + + name = "export_center_crop_pad_crop_and_pad" + make_test([_x], _y, "input_0.center_crop_pad(TensorTrait::new(array![3].span(), array![10,10,3].span()), Option::None(()))", name) + + @staticmethod + def export_center_crop_pad_crop_axes_hwc(): + x = np.array(np.random.randn(20,8,3), dtype=np.complex64) + _x = Tensor(Dtype.COMPLEX64, x.shape, x.flatten()) + y = np.zeros([10,9,3], dtype=np.complex64) + y[:, :8, :] = x[5:15, :, :] + _y = Tensor(Dtype.COMPLEX64, y.shape, y.flatten()) + + name = "export_center_crop_pad_crop_axes_hwc" + make_test([_x], _y, "input_0.center_crop_pad(TensorTrait::new(array![2].span(), array![10,9].span()), Option::Some(array![0,1]))", name) + + @staticmethod + def export_center_crop_pad_crop_negative_axes_hwc(): + x = np.array(np.random.randn(20,8,3), dtype=np.complex64) + _x = Tensor(Dtype.COMPLEX64, x.shape, x.flatten()) + y = np.zeros([10,9,3], dtype=np.complex64) + y[:, :8, :] = x[5:15, :, :] + _y = Tensor(Dtype.COMPLEX64, y.shape, y.flatten()) + name = "export_center_crop_pad_crop_negative_axes_hwc" + make_test([_x], _y, "input_0.center_crop_pad(TensorTrait::new(array![2].span(), array![10,9].span()), Option::Some(array![-3,-2]))", name) + + @staticmethod + def export_center_crop_pad_crop_axes_chw(): + x = np.array(np.random.randn(3,20,8), dtype=np.complex64) + _x = Tensor(Dtype.COMPLEX64, x.shape, x.flatten()) + y = np.zeros([3,10,9], dtype=np.complex64) + y[:, :, :8] = x[:, 5:15, :] + _y = Tensor(Dtype.COMPLEX64, y.shape, y.flatten()) + name = "export_center_crop_pad_crop_axes_chw" + make_test([_x], _y, "input_0.center_crop_pad(TensorTrait::new(array![2].span(), array![10,9].span()), Option::Some(array![1,2]))", name) \ No newline at end of file diff --git a/nodegen/node/conv.py b/nodegen/node/conv.py index 7a650e083..d1d75430e 100644 --- a/nodegen/node/conv.py +++ b/nodegen/node/conv.py @@ -37,6 +37,7 @@ def conv( pads = [0 for s in X.shape[2:]] * 2 if strides is None: strides = [1 for s in X.shape[2:]] + if group is None: group=1 diff --git a/nodegen/node/deform_conv.py b/nodegen/node/deform_conv.py new file mode 100644 index 000000000..abb101dc7 --- /dev/null +++ b/nodegen/node/deform_conv.py @@ -0,0 +1,463 @@ +import numpy as np +from nodegen.node import RunAll +from ..helpers import make_test, to_fp, Tensor, Dtype, FixedImpl, Trait + +import numpy as np + +def deform_conv_implementation( # type: ignore + X, + W, + offset, + B=None, + mask=None, + dilations=None, + group=None, + kernel_shape=None, + offset_group=None, + pads=None, + strides=None, +): + if dilations is None: + dilations = [1 for s in X.shape[2:]] + if kernel_shape is None: + kernel_shape = W.shape[2:] + if pads is None: + pads = [0 for s in X.shape[2:]] * 2 + if strides is None: + strides = [1 for s in X.shape[2:]] + if group is None: + group = 1 + if offset_group is None: + offset_group = 1 + + n, ic = X.shape[:2] + oc = W.shape[0] + output_shape = offset.shape[2:] + + if ic != W.shape[1] * group or oc % group != 0: + raise ValueError( + f"Shape inconsistencies, X.shape={X.shape}, W.shape={W.shape}, group={group}." + ) + ics_per_group, ocs_per_group = W.shape[1], oc // group + + if ic % offset_group != 0: + raise ValueError("Number of input channels must be divisible by offset_group.") + ics_per_offset_group = ic // offset_group + + if offset_group * np.prod(kernel_shape) * len(kernel_shape) != offset.shape[1]: + raise ValueError( + f"Offset shape {offset.shape} is inconsistent with offset_group {offset_group} " + f"and kernel shape {kernel_shape}." + ) + offset = offset.reshape( + (n, offset_group, *kernel_shape, len(kernel_shape), *output_shape) + ) + + if mask is None: + mask = np.ones((n, offset_group * np.prod(kernel_shape), *output_shape)) + mask = mask.reshape((n, offset_group, *kernel_shape, *output_shape)) + + from onnx.reference.ops._op_list import GridSample + + if len(X.shape) == 4: + ih, iw = X.shape[2:] + oh, ow = offset.shape[-2:] + kh, kw = kernel_shape + sth, stw = strides + dh, dw = dilations + kh_new, kw_new = (kh - 1) * dh + 1, (kw - 1) * dw + 1 + + if oh != int(((ih - kh_new + pads[0] + pads[2]) / sth) + 1) or ow != int( + ((iw - kw_new + pads[1] + pads[3]) / stw) + 1 + ): + raise RuntimeError( + "Padding, dilation, stride, and kernel shape incompatible with output shape." + ) + + bh, bw = -pads[0], -pads[1] + + res = np.zeros((n, oc, oh, ow), dtype=X.dtype) + if B is not None: + res[:, :, :, :] = B.reshape((1, -1, 1, 1)) + + kernel_pos_w, kernel_pos_h = np.meshgrid( + np.arange(0, kw_new, dw), np.arange(0, kh_new, dh) + ) + + kernel_pos_wrt_first_elem = np.stack( + (kernel_pos_h, kernel_pos_w), axis=2 + ) + + for batch_idx in range(n): + for oc_idx in range(oc): + for ic_idx in range(ic): + # Group convolution logic + if ic_idx // ics_per_group != oc_idx // ocs_per_group: + # Input channel and output channel don't belong to same group + continue + + # Offset group logic + offset_group_idx = ic_idx // ics_per_offset_group + + for i in range(oh): + h_coord = bh + sth * i + for j in range(ow): + w_coord = bw + stw * j + + kernel = np.copy(kernel_pos_wrt_first_elem).astype(float) + kernel[:, :, 0] += ( + h_coord + + offset[batch_idx, offset_group_idx, :, :, 0, i, j] + ) + kernel[:, :, 1] += ( + w_coord + + offset[batch_idx, offset_group_idx, :, :, 1, i, j] + ) + + kernel[:, :, 0] = kernel[:, :, 0] / (ih - 1) * 2 - 1 + kernel[:, :, 1] = kernel[:, :, 1] / (iw - 1) * 2 - 1 + + kernel = np.expand_dims(kernel, 0) + + kernel = np.flip( + kernel, 3 + ) + + grid_sample_output = GridSample.eval( + X[batch_idx : batch_idx + 1, ic_idx : ic_idx + 1], + kernel, + align_corners=1, + ) + + conv_value = np.multiply( + grid_sample_output, + W[oc_idx, ic_idx % ics_per_group, :, :], + ) + conv_value = np.multiply( + conv_value, + mask[batch_idx, offset_group_idx, :, :, i, j], + ) + res[batch_idx, oc_idx, i, j] += np.sum(conv_value) + + return res + raise RuntimeError( + f"The convolution for X.shape={X.shape}, W.shape={W.shape}, " + f"kernel_shape={kernel_shape} is not implemented yet." + ) + + + +def deform_conv_implementation( # type: ignore + X, + W, + offset, + B=None, + mask=None, + dilations=None, + group=None, + kernel_shape=None, + offset_group=None, + pads=None, + strides=None, +): + if dilations is None: + dilations = [1 for s in X.shape[2:]] + if kernel_shape is None: + kernel_shape = W.shape[2:] + if pads is None: + pads = [0 for s in X.shape[2:]] * 2 + if strides is None: + strides = [1 for s in X.shape[2:]] + if group is None: + group = 1 + if offset_group is None: + offset_group = 1 + + n, ic = X.shape[:2] + oc = W.shape[0] + output_shape = offset.shape[2:] + + if ic != W.shape[1] * group or oc % group != 0: + raise ValueError( + f"Shape inconsistencies, X.shape={X.shape}, W.shape={W.shape}, group={group}." + ) + ics_per_group, ocs_per_group = W.shape[1], oc // group + + if ic % offset_group != 0: + raise ValueError("Number of input channels must be divisible by offset_group.") + ics_per_offset_group = ic // offset_group + + if offset_group * np.prod(kernel_shape) * len(kernel_shape) != offset.shape[1]: + raise ValueError( + f"Offset shape {offset.shape} is inconsistent with offset_group {offset_group} " + f"and kernel shape {kernel_shape}." + ) + offset = offset.reshape( + (n, offset_group, *kernel_shape, len(kernel_shape), *output_shape) + ) + + if mask is None: + mask = np.ones((n, offset_group * np.prod(kernel_shape), *output_shape)) + mask = mask.reshape((n, offset_group, *kernel_shape, *output_shape)) + + from onnx.reference.ops._op_list import GridSample + + if len(X.shape) == 4: + ih, iw = X.shape[2:] + oh, ow = offset.shape[-2:] + kh, kw = kernel_shape + sth, stw = strides + dh, dw = dilations + kh_new, kw_new = (kh - 1) * dh + 1, (kw - 1) * dw + 1 + + if oh != int(((ih - kh_new + pads[0] + pads[2]) / sth) + 1) or ow != int( + ((iw - kw_new + pads[1] + pads[3]) / stw) + 1 + ): + raise RuntimeError( + "Padding, dilation, stride, and kernel shape incompatible with output shape." + ) + + bh, bw = -pads[0], -pads[1] + + res = np.zeros((n, oc, oh, ow), dtype=X.dtype) + if B is not None: + res[:, :, :, :] = B.reshape((1, -1, 1, 1)) + + kernel_pos_w, kernel_pos_h = np.meshgrid( + np.arange(0, kw_new, dw), np.arange(0, kh_new, dh) + ) + + kernel_pos_wrt_first_elem = np.stack( + (kernel_pos_h, kernel_pos_w), axis=2 + ) + + for batch_idx in range(n): + for oc_idx in range(oc): + for ic_idx in range(ic): + # Group convolution logic + if ic_idx // ics_per_group != oc_idx // ocs_per_group: + # Input channel and output channel don't belong to same group + continue + + # Offset group logic + offset_group_idx = ic_idx // ics_per_offset_group + + for i in range(oh): + h_coord = bh + sth * i + for j in range(ow): + w_coord = bw + stw * j + + kernel = np.copy(kernel_pos_wrt_first_elem).astype(float) + kernel[:, :, 0] += ( + h_coord + + offset[batch_idx, offset_group_idx, :, :, 0, i, j] + ) + kernel[:, :, 1] += ( + w_coord + + offset[batch_idx, offset_group_idx, :, :, 1, i, j] + ) + + kernel[:, :, 0] = kernel[:, :, 0] / (ih - 1) * 2 - 1 + kernel[:, :, 1] = kernel[:, :, 1] / (iw - 1) * 2 - 1 + + kernel = np.expand_dims(kernel, 0) + + kernel = np.flip( + kernel, 3 + ) + + grid_sample_output = GridSample.eval( + X[batch_idx : batch_idx + 1, ic_idx : ic_idx + 1], + kernel, + align_corners=1, + ) + + conv_value = np.multiply( + grid_sample_output, + W[oc_idx, ic_idx % ics_per_group, :, :], + ) + conv_value = np.multiply( + conv_value, + mask[batch_idx, offset_group_idx, :, :, i, j], + ) + res[batch_idx, oc_idx, i, j] += np.sum(conv_value) + + return res + raise RuntimeError( + f"The convolution for X.shape={X.shape}, W.shape={W.shape}, " + f"kernel_shape={kernel_shape} is not implemented yet." + ) + + +class Deform_conv(RunAll): + + @staticmethod + def export_deform_conv_without_padding() -> None: + x = np.arange(9).astype(np.float32) + x.shape = (1, 1, 3, 3) + w = np.ones((1, 1, 2, 2), dtype=np.float32) + + # Convolution without padding + offset = np.zeros((1, 8, 2, 2), dtype=np.float32) + offset[ + 0, 0, 0, 0 + ] = 0.5 + offset[ + 0, 5, 0, 1 + ] = -0.1 + + + + y = deform_conv_implementation(x, w, offset, kernel_shape=[2, 2]) + + x = Tensor(Dtype.FP16x16, x.shape, to_fp(x.flatten(), FixedImpl.FP16x16)) + w = Tensor(Dtype.FP16x16, w.shape, to_fp(w.flatten(), FixedImpl.FP16x16)) + offset = Tensor(Dtype.FP16x16, offset.shape, to_fp(offset.flatten(), FixedImpl.FP16x16)) + y = Tensor(Dtype.FP16x16, y.shape, to_fp(y.flatten(), FixedImpl.FP16x16)) + + name = "deform_conv" + func_sig = "NNTrait::deform_conv(" + func_sig += "@input_0," + func_sig += "@input_1," + func_sig += "@input_2," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::Some(array![2, 2].span())," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::None)" + make_test( + [x, w, offset], y, func_sig, name, Trait.NN) + + @staticmethod + def export_deform_conv_with_padding() -> None: + x = np.arange(9).astype(np.float32) + x.shape = (1, 1, 3, 3) + w = np.ones((1, 1, 2, 2), dtype=np.float32) + + # Convolution with padding + offset = np.zeros((1, 8, 4, 4), dtype=np.float32) + offset[ + 0, 0, 0, 0 + ] = 0.5 + offset[ + 0, 5, 1, 2 + ] = -0.1 + + + + y = deform_conv_implementation(x, w, offset, kernel_shape=[2, 2], pads=[1, 1, 1, 1]) + + x = Tensor(Dtype.FP16x16, x.shape, to_fp(x.flatten(), FixedImpl.FP16x16)) + w = Tensor(Dtype.FP16x16, w.shape, to_fp(w.flatten(), FixedImpl.FP16x16)) + offset = Tensor(Dtype.FP16x16, offset.shape, to_fp(offset.flatten(), FixedImpl.FP16x16)) + y = Tensor(Dtype.FP16x16, y.shape, to_fp(y.flatten(), FixedImpl.FP16x16)) + + name = "deform_conv_with_padding" + func_sig = "NNTrait::deform_conv(" + func_sig += "@input_0," + func_sig += "@input_1," + func_sig += "@input_2," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::Some(array![2, 2].span())," + func_sig += "Option::None," + func_sig += "Option::Some(array![1, 1, 1, 1].span())," + func_sig += "Option::None)" + make_test( + [x, w, offset], y, func_sig, name, Trait.NN) + + @staticmethod + def export_deform_conv_with_mask_bias() -> None: + x = np.arange(9).astype(np.float32) + x.shape = (1, 1, 3, 3) + w = np.ones((1, 1, 2, 2), dtype=np.float32) + + b = np.ones((1,), dtype=np.float32) + + offset = np.zeros((1, 8, 2, 2), dtype=np.float32) + offset[ + 0, 0, 0, 0 + ] = 0.5 + offset[ + 0, 5, 0, 1 + ] = -0.1 + + mask = np.ones((1, 4, 2, 2), dtype=np.float32) + mask[0, 2, 1, 1] = 0.2 + + y = deform_conv_implementation(x, w, offset, mask=mask, B=b, kernel_shape=[2, 2]) + + x = Tensor(Dtype.FP16x16, x.shape, to_fp(x.flatten(), FixedImpl.FP16x16)) + w = Tensor(Dtype.FP16x16, w.shape, to_fp(w.flatten(), FixedImpl.FP16x16)) + offset = Tensor(Dtype.FP16x16, offset.shape, to_fp(offset.flatten(), FixedImpl.FP16x16)) + b = Tensor(Dtype.FP16x16, b.shape, to_fp(b.flatten(), FixedImpl.FP16x16)) + mask = Tensor(Dtype.FP16x16, mask.shape, to_fp(mask.flatten(), FixedImpl.FP16x16)) + y = Tensor(Dtype.FP16x16, y.shape, to_fp(y.flatten(), FixedImpl.FP16x16)) + + name = "deform_conv_with_mask_bias" + func_sig = "NNTrait::deform_conv(" + func_sig += "@input_0," + func_sig += "@input_1," + func_sig += "@input_2," + func_sig += "Option::Some(input_3.data)," + func_sig += "Option::Some(input_4)," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::Some(array![2, 2].span())," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::None)" + make_test( + [x, w, offset, b, mask], y, func_sig, name, Trait.NN) + + + @staticmethod + def export_deform_conv_with_multiple_offset_groups() -> None: + x = np.zeros((1, 2, 3, 3), dtype=np.float32) + x[0, 0] = np.reshape(np.arange(9).astype(np.float32), (3, 3)) + x[0, 1] = np.reshape(np.arange(8, -1, -1).astype(np.float32), (3, 3)) + x.shape = (1, 2, 3, 3) + w = np.ones((1, 2, 2, 2), dtype=np.float32) + + offset = np.zeros((1, 16, 2, 2), dtype=np.float32) + offset[ + 0, 0, 0, 0 + ] = 0.5 + offset[ + 0, 13, 0, 1 + ] = ( + -0.1 + ) + + + y = deform_conv_implementation(x, w, offset, offset_group=2, kernel_shape=[2, 2]) + + x = Tensor(Dtype.FP16x16, x.shape, to_fp(x.flatten(), FixedImpl.FP16x16)) + w = Tensor(Dtype.FP16x16, w.shape, to_fp(w.flatten(), FixedImpl.FP16x16)) + offset = Tensor(Dtype.FP16x16, offset.shape, to_fp(offset.flatten(), FixedImpl.FP16x16)) + y = Tensor(Dtype.FP16x16, y.shape, to_fp(y.flatten(), FixedImpl.FP16x16)) + + name = "deform_conv_with_multiple_offset_groups" + func_sig = "NNTrait::deform_conv(" + func_sig += "@input_0," + func_sig += "@input_1," + func_sig += "@input_2," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::Some(array![2, 2].span())," + func_sig += "Option::Some(2)," + func_sig += "Option::None," + func_sig += "Option::None)" + make_test( + [x, w, offset], y, func_sig, name, Trait.NN) + + + + \ No newline at end of file diff --git a/nodegen/node/gather.py b/nodegen/node/gather.py index 5ba2692fb..ed2317555 100644 --- a/nodegen/node/gather.py +++ b/nodegen/node/gather.py @@ -7,258 +7,83 @@ class Gather(RunAll): @staticmethod def gather_fp16x16(): - def gather_3D(): - def default(): - x1 = np.arange(0,27).reshape(3,3,3).astype(np.int64) - x2 = np.array([[0,1], [2,1], [0, 2]]).astype(np.uint32) - y = x1.take(x2, axis=0) - - x1 = Tensor(Dtype.FP16x16, x1.shape, to_fp(x1.flatten(), FixedImpl.FP16x16)) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.FP16x16, y.shape, to_fp( - y.flatten(), FixedImpl.FP16x16)) - - name = "gather_fp16x16_3d_default" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather(indices:input_1, axis:Option::Some(0))", - name= name) - - def axis1(): - x1 = np.arange(0,27).reshape(3,3,3).astype(np.int64) - x2 = np.array([[0,1], [2,1], [0, 2]]).astype(np.int64) - y = x1.take(x2, axis=1) - - x1 = Tensor(Dtype.FP16x16, x1.shape, to_fp(x1.flatten(), FixedImpl.FP16x16)) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.FP16x16, y.shape, to_fp( - y.flatten(), FixedImpl.FP16x16)) - - name = "gather_fp16x16_3d_axis1" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather(indices:input_1, axis:Option::Some(1))", - name= name) - - def axis2(): - x1 = np.arange(0,27).reshape(3,3,3).astype(np.int64) - x2 = np.array([[0,1], [2,1], [0, 2]]).astype(np.int64) - y = x1.take(x2, axis=2) - - x1 = Tensor(Dtype.FP16x16, x1.shape, to_fp(x1.flatten(), FixedImpl.FP16x16)) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.FP16x16, y.shape, to_fp( - y.flatten(), FixedImpl.FP16x16)) - - name = "gather_fp16x16_3d_axis2" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather(indices:input_1, axis:Option::Some(2))", - name= name) - - default() - axis1() - axis2() - gather_3D() - - @staticmethod - def gather_fp8x23(): + def default(): + x1 = np.arange(0,27).reshape(3,3,3).astype(np.int64) + x2 = np.array([[0,1], [2,1], [0, 2]]).astype(np.uint32) + y = x1.take(x2, axis=0) + + x1 = Tensor(Dtype.FP16x16, x1.shape, to_fp(x1.flatten(), FixedImpl.FP16x16)) + x2 = Tensor(Dtype.I32, x2.shape, x2.flatten()) + y = Tensor(Dtype.FP16x16, y.shape, to_fp( + y.flatten(), FixedImpl.FP16x16)) + + name = "gather_fp16x16_3d_default" + make_test( + inputs = [x1, x2], output = y, func_sig = "input_0.gather(indices:input_1, axis:Option::Some(0))", + name= name) - def gather_3D(): - def default(): - x1 = np.arange(0,27).reshape(3,3,3).astype(np.int64) - x2 = np.array([[0,1], [2,1], [0, 2]]).astype(np.int64) - y = x1.take(x2, axis=0) - - x1 = Tensor(Dtype.FP8x23, x1.shape, to_fp(x1.flatten(), FixedImpl.FP8x23)) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.FP8x23, y.shape, to_fp(y.flatten(), FixedImpl.FP8x23)) - - name = "gather_fp8x23_3d_default" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather(indices:input_1, axis:Option::Some(0))", - name= name) - - def axis1(): - x1 = np.arange(0,27).reshape(3,3,3).astype(np.int64) - x2 = np.array([[0,1], [2,1], [0, 2]]).astype(np.int64) - y = x1.take(x2, axis=1) - - x1 = Tensor(Dtype.FP8x23, x1.shape, to_fp(x1.flatten(), FixedImpl.FP8x23)) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.FP8x23, y.shape, to_fp(y.flatten(), FixedImpl.FP8x23)) - - name = "gather_fp8x23_3d_axis1" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather(indices:input_1, axis:Option::Some(1))", - name= name) - - def axis2(): - x1 = np.arange(0,27).reshape(3,3,3).astype(np.int64) - x2 = np.array([[0,1], [2,1], [0, 2]]).astype(np.int64) - y = x1.take(x2, axis=2) - - x1 = Tensor(Dtype.FP8x23, x1.shape, to_fp(x1.flatten(), FixedImpl.FP8x23)) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.FP8x23, y.shape, to_fp(y.flatten(), FixedImpl.FP8x23)) - - name = "gather_fp8x23_3d_axis2" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather(indices:input_1, axis:Option::Some(2))", - name= name) - - default() - axis1() - axis2() - gather_3D() - - @staticmethod - def gather_i8(): + def axis1(): + x1 = np.arange(0,27).reshape(3,3,3).astype(np.int64) + x2 = np.array([[0,1], [2,1], [0, 2]]).astype(np.int64) + y = x1.take(x2, axis=1) + + x1 = Tensor(Dtype.FP16x16, x1.shape, to_fp(x1.flatten(), FixedImpl.FP16x16)) + x2 = Tensor(Dtype.I32, x2.shape, x2.flatten()) + y = Tensor(Dtype.FP16x16, y.shape, to_fp( + y.flatten(), FixedImpl.FP16x16)) + + name = "gather_fp16x16_3d_axis1" + make_test( + inputs = [x1, x2], output = y, func_sig = "input_0.gather(indices:input_1, axis:Option::Some(1))", + name= name) - def gather_3D(): - def default(): - x1 = np.arange(0,27).reshape(3,3,3).astype(np.int8) - x2 = np.array([[0,1], [2,1], [0, 2]]).astype(np.int8) - y = x1.take(x2, axis=0) - - x1 = Tensor(Dtype.I8, x1.shape, x1.flatten()) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.I8, y.shape, y.flatten()) - - name = "gather_i8_3d_default" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather(indices:input_1, axis:Option::Some(0))", - name= name) - - def axis1(): - x1 = np.arange(0,27).reshape(3,3,3).astype(np.int8) - x2 = np.array([[0,1], [2,1], [0, 2]]).astype(np.int8) - y = x1.take(x2, axis=1) - - x1 = Tensor(Dtype.I8, x1.shape, x1.flatten()) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.I8, y.shape, y.flatten()) - - name = "gather_i8_3d_axis1" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather(indices:input_1, axis:Option::Some(1))", - name= name) - - def axis2(): - x1 = np.arange(0,27).reshape(3,3,3).astype(np.int8) - x2 = np.array([[0,1], [2,1], [0, 2]]).astype(np.int8) - y = x1.take(x2, axis=2) - - x1 = Tensor(Dtype.I8, x1.shape, x1.flatten()) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.I8, y.shape, y.flatten()) - - name = "gather_i8_3d_axis2" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather(indices:input_1, axis:Option::Some(2))", - name= name) - - default() - axis1() - axis2() - gather_3D() - - - @staticmethod - def gather_i32(): + def axis2(): + x1 = np.arange(0,27).reshape(3,3,3).astype(np.int64) + x2 = np.array([[0,1], [2,1], [0, 2]]).astype(np.int64) + y = x1.take(x2, axis=2) + + x1 = Tensor(Dtype.FP16x16, x1.shape, to_fp(x1.flatten(), FixedImpl.FP16x16)) + x2 = Tensor(Dtype.I32, x2.shape, x2.flatten()) + y = Tensor(Dtype.FP16x16, y.shape, to_fp( + y.flatten(), FixedImpl.FP16x16)) + + name = "gather_fp16x16_3d_axis2" + make_test( + inputs = [x1, x2], output = y, func_sig = "input_0.gather(indices:input_1, axis:Option::Some(2))", + name= name) + + def negative_indices(): + x1 = np.arange(10).astype(np.float32) + x2 = np.array([0, -9, -10]).astype(np.int64) + y = np.take(x1, x2, axis=0) + + x1 = Tensor(Dtype.FP16x16, x1.shape, to_fp(x1.flatten(), FixedImpl.FP16x16)) + x2 = Tensor(Dtype.I32, x2.shape, x2.flatten()) + y = Tensor(Dtype.FP16x16, y.shape, to_fp( + y.flatten(), FixedImpl.FP16x16)) + + name = "gather_negative_indices" + make_test( + inputs = [x1, x2], output = y, func_sig = "input_0.gather(indices:input_1, axis:Option::Some(0))", + name= name) + + def negative_axis(): + x1 = np.arange(0,27).reshape(3,3,3).astype(np.int64) + x2 = np.array([[0,1], [2,1], [0, 2]]).astype(np.uint32) + y = x1.take(x2, axis=-1) + + x1 = Tensor(Dtype.FP16x16, x1.shape, to_fp(x1.flatten(), FixedImpl.FP16x16)) + x2 = Tensor(Dtype.I32, x2.shape, x2.flatten()) + y = Tensor(Dtype.FP16x16, y.shape, to_fp( + y.flatten(), FixedImpl.FP16x16)) + + name = "gather_negative_axis" + make_test( + inputs = [x1, x2], output = y, func_sig = "input_0.gather(indices:input_1, axis:Option::Some(-1))", + name= name) - def gather_3D(): - def default(): - x1 = np.arange(0,27).reshape(3,3,3).astype(np.int32) - x2 = np.array([[0,1], [2,1], [0, 2]]).astype(np.int32) - y = x1.take(x2, axis=0) - - x1 = Tensor(Dtype.I32, x1.shape, x1.flatten()) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.I32, y.shape, y.flatten()) - - name = "gather_i32_3d_default" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather(indices:input_1, axis:Option::Some(0))", - name= name) - - def axis1(): - x1 = np.arange(0,27).reshape(3,3,3).astype(np.int32) - x2 = np.array([[0,1], [2,1], [0, 2]]).astype(np.int32) - y = x1.take(x2, axis=1) - - x1 = Tensor(Dtype.I32, x1.shape, x1.flatten()) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.I32, y.shape, y.flatten()) - - name = "gather_i32_3d_axis1" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather(indices:input_1, axis:Option::Some(1))", - name= name) - - def axis2(): - x1 = np.arange(0,27).reshape(3,3,3).astype(np.int32) - x2 = np.array([[0,1], [2,1], [0, 2]]).astype(np.int32) - y = x1.take(x2, axis=2) - - x1 = Tensor(Dtype.I32, x1.shape, x1.flatten()) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.I32, y.shape, y.flatten()) - - name = "gather_i32_3d_axis2" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather(indices:input_1, axis:Option::Some(2))", - name= name) - - default() - axis1() - axis2() - gather_3D() - - @staticmethod - def gather_u32(): - - def gather_3D(): - def default(): - x1 = np.arange(0,36).reshape(3,4,3).astype(np.uint32) - x2 = np.array([[0,1], [2,1], [0, 2]]).astype(np.uint32) - y = x1.take(x2, axis=0) - - x1 = Tensor(Dtype.U32, x1.shape, x1.flatten()) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "gather_u32_3d_default" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather(indices:input_1, axis:Option::Some(0))", - name= name) - - def axis1(): - x1 = np.arange(0,36).reshape(3,4,3).astype(np.uint32) - x2 = np.array([[0,1], [2,1], [1, 3]]).astype(np.uint32) - y = x1.take(x2, axis=1) - - x1 = Tensor(Dtype.U32, x1.shape, x1.flatten()) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "gather_u32_3d_axis1" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather(indices:input_1, axis:Option::Some(1))", - name= name) - - def axis2(): - x1 = np.arange(0,36).reshape(3,4,3).astype(np.uint32) - x2 = np.array([[0,1], [2,1], [1, 2]]).astype(np.uint32) - y = x1.take(x2, axis=2) - - x1 = Tensor(Dtype.U32, x1.shape, x1.flatten()) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "gather_u32_3d_axis2" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather(indices:input_1, axis:Option::Some(2))", - name= name) - - default() - axis1() - axis2() - gather_3D() + default() + axis1() + axis2() + negative_indices() + negative_axis() diff --git a/nodegen/node/gather_elements.py b/nodegen/node/gather_elements.py index 604a666c7..a977212a7 100644 --- a/nodegen/node/gather_elements.py +++ b/nodegen/node/gather_elements.py @@ -13,256 +13,68 @@ class Gather_elements(RunAll): @staticmethod def gather_elements_fp16x16(): - def gather_elements_3D(): - def default(): - x1 = np.arange(0,27).reshape(3,3,3).astype(np.int64) - x2 = np.random.randint(low = 0,high=2, size=(3,3,3)).astype(np.uint32) - y = gather_elements(x1, x2, axis=0) + def default(): + x1 = np.arange(0,27).reshape(3,3,3).astype(np.int64) + x2 = np.random.randint(low = 0,high=2, size=(3,3,3)).astype(np.uint32) + y = gather_elements(x1, x2, axis=0) + + x1 = Tensor(Dtype.FP16x16, x1.shape, to_fp(x1.flatten(), FixedImpl.FP16x16)) + x2 = Tensor(Dtype.I32, x2.shape, x2.flatten()) + y = Tensor(Dtype.FP16x16, y.shape, to_fp( + y.flatten(), FixedImpl.FP16x16)) + + name = "gather_elements_default" + make_test( + inputs = [x1, x2], output = y, func_sig = "input_0.gather_elements(indices:input_1, axis:Option::Some(0))", + name= name) + + def axis1(): + x1 = np.array([[1, 2], [3, 4]], dtype=np.float32) + x2 = np.array([[0, 0], [1, 0]], dtype=np.int32) + y = gather_elements(x1, x2, axis=1) + + x1 = Tensor(Dtype.FP16x16, x1.shape, to_fp(x1.flatten(), FixedImpl.FP16x16)) + x2 = Tensor(Dtype.I32, x2.shape, x2.flatten()) + y = Tensor(Dtype.FP16x16, y.shape, to_fp( + y.flatten(), FixedImpl.FP16x16)) + + name = "gather_elements_axis1" + make_test( + inputs = [x1, x2], output = y, func_sig = "input_0.gather_elements(indices:input_1, axis:Option::Some(1))", + name= name) + + def axis2(): + x1 = np.arange(0,27).reshape(3,3,3).astype(np.int64) + x2 = np.random.randint(low = 0,high=3, size=(3,3,3)).astype(np.uint32) + y = gather_elements(x1, x2, axis=2) + + x1 = Tensor(Dtype.FP16x16, x1.shape, to_fp(x1.flatten(), FixedImpl.FP16x16)) + x2 = Tensor(Dtype.I32, x2.shape, x2.flatten()) + y = Tensor(Dtype.FP16x16, y.shape, to_fp( + y.flatten(), FixedImpl.FP16x16)) + + name = "gather_elements_axis2" + make_test( + inputs = [x1, x2], output = y, func_sig = "input_0.gather_elements(indices:input_1, axis:Option::Some(2))", + name= name) + + def negative_indices(): + x1 = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]], dtype=np.float32) + x2 = np.array([[-1, -2, 0], [-2, 0, 0]], dtype=np.int32) + y = gather_elements(x1, x2, axis=0) + + x1 = Tensor(Dtype.FP16x16, x1.shape, to_fp(x1.flatten(), FixedImpl.FP16x16)) + x2 = Tensor(Dtype.I32, x2.shape, x2.flatten()) + y = Tensor(Dtype.FP16x16, y.shape, to_fp( + y.flatten(), FixedImpl.FP16x16)) + + name = "gather_elements_negative_indices" + make_test( + inputs = [x1, x2], output = y, func_sig = "input_0.gather_elements(indices:input_1, axis:Option::Some(0))", + name= name) + + default() + axis1() + axis2() + negative_indices() - x1 = Tensor(Dtype.FP16x16, x1.shape, to_fp(x1.flatten(), FixedImpl.FP16x16)) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.FP16x16, y.shape, to_fp( - y.flatten(), FixedImpl.FP16x16)) - - name = "gather_elements_fp16x16_3d_default" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather_elements(indices:input_1, axis:Option::Some(0))", - name= name) - - def axis1(): - x1 = np.arange(0,27).reshape(3,3,3).astype(np.int64) - x2 = np.random.randint(low = 0,high=3, size=(3,3,3)).astype(np.uint32) - y = gather_elements(x1, x2, axis=1) - - x1 = Tensor(Dtype.FP16x16, x1.shape, to_fp(x1.flatten(), FixedImpl.FP16x16)) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.FP16x16, y.shape, to_fp( - y.flatten(), FixedImpl.FP16x16)) - - name = "gather_elements_fp16x16_3d_axis1" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather_elements(indices:input_1, axis:Option::Some(1))", - name= name) - - def axis2(): - x1 = np.arange(0,27).reshape(3,3,3).astype(np.int64) - x2 = np.random.randint(low = 0,high=3, size=(3,3,3)).astype(np.uint32) - y = gather_elements(x1, x2, axis=2) - - x1 = Tensor(Dtype.FP16x16, x1.shape, to_fp(x1.flatten(), FixedImpl.FP16x16)) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.FP16x16, y.shape, to_fp( - y.flatten(), FixedImpl.FP16x16)) - - name = "gather_elements_fp16x16_3d_axis2" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather_elements(indices:input_1, axis:Option::Some(2))", - name= name) - - default() - axis1() - axis2() - gather_elements_3D() - - - @staticmethod - def gather_elements_fp8x23(): - def gather_elements_3D(): - def default(): - x1 = np.arange(0,27).reshape(3,3,3).astype(np.int64) - x2 = np.random.randint(low = 0,high=2, size=(3,3,3)).astype(np.int64) - y = gather_elements(x1, x2, axis=0) - - x1 = Tensor(Dtype.FP8x23, x1.shape, to_fp(x1.flatten(), FixedImpl.FP8x23)) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.FP8x23, y.shape, to_fp(y.flatten(), FixedImpl.FP8x23)) - - name = "gather_elements_fp8x23_3d_default" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather_elements(indices:input_1, axis:Option::Some(0))", - name= name) - - def axis1(): - x1 = np.arange(0,27).reshape(3,3,3).astype(np.int64) - x2 = np.random.randint(low = 0,high=3, size=(3,3,3)).astype(np.int64) - y = gather_elements(x1, x2, axis=1) - - x1 = Tensor(Dtype.FP8x23, x1.shape, to_fp(x1.flatten(), FixedImpl.FP8x23)) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.FP8x23, y.shape, to_fp(y.flatten(), FixedImpl.FP8x23)) - - name = "gather_elements_fp8x23_3d_axis1" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather_elements(indices:input_1, axis:Option::Some(1))", - name= name) - - def axis2(): - x1 = np.arange(0,27).reshape(3,3,3).astype(np.int64) - x2 = np.random.randint(low = 0,high=3, size=(3,3,3)).astype(np.int64) - y = gather_elements(x1, x2, axis=2) - - x1 = Tensor(Dtype.FP8x23, x1.shape, to_fp(x1.flatten(), FixedImpl.FP8x23)) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.FP8x23, y.shape, to_fp(y.flatten(), FixedImpl.FP8x23)) - - name = "gather_elements_fp8x23_3d_axis2" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather_elements(indices:input_1, axis:Option::Some(2))", - name= name) - - default() - axis1() - axis2() - gather_elements_3D() - - - @staticmethod - def gather_elements_i8(): - def gather_elements_3D(): - def default(): - x1 = np.arange(0,9).reshape(3,3).astype(np.int8) - x2 = np.random.randint(low = 0,high=2, size=(3,3)).astype(np.int8) - y = gather_elements(x1, x2, axis=0) - - x1 = Tensor(Dtype.I8, x1.shape, x1.flatten()) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.I8, y.shape, y.flatten()) - - name = "gather_elements_i8_3d_default" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather_elements(indices:input_1, axis:Option::Some(0))", - name= name) - - def axis1(): - x1 = np.arange(0,9).reshape(3,3).astype(np.int8) - x2 = np.random.randint(low = 0,high=2, size=(3,3)).astype(np.int8) - y = gather_elements(x1, x2, axis=1) - - x1 = Tensor(Dtype.I8, x1.shape, x1.flatten()) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.I8, y.shape, y.flatten()) - - name = "gather_elements_i8_3d_axis1" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather_elements(indices:input_1, axis:Option::Some(1))", - name= name) - - default() - axis1() - gather_elements_3D() - - - @staticmethod - def gather_elements_i32(): - def gather_elements_3D(): - def default(): - x1 = np.arange(0,24).reshape(4,2,3).astype(np.int32) - x2 = np.random.randint(low = 0,high=2, size=(5,2,3)).astype(np.int32) - y = gather_elements(x1, x2, axis=0) - - x1 = Tensor(Dtype.I32, x1.shape, x1.flatten()) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.I32, y.shape, y.flatten()) - - name = "gather_elements_i32_3d_default" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather_elements(indices:input_1, axis:Option::Some(0))", - name= name) - - def axis1(): - x1 = np.arange(0,24).reshape(4,2,3).astype(np.int32) - x2 = np.random.randint(low = 0,high=2, size=(4,3,3)).astype(np.int32) - y = gather_elements(x1, x2, axis=1) - - x1 = Tensor(Dtype.I32, x1.shape, x1.flatten()) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.I32, y.shape, y.flatten()) - - name = "gather_elements_i32_3d_axis1" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather_elements(indices:input_1, axis:Option::Some(1))", - name= name) - - def axis2(): - x1 = np.arange(0,24).reshape(4,2,3).astype(np.int32) - x2 = np.random.randint(low = 0,high=2, size=(4,2,4)).astype(np.int32) - y = gather_elements(x1, x2, axis=2) - - x1 = Tensor(Dtype.I32, x1.shape, x1.flatten()) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.I32, y.shape, y.flatten()) - - name = "gather_elements_i32_3d_axis2" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather_elements(indices:input_1, axis:Option::Some(2))", - name= name) - - default() - axis1() - axis2() - gather_elements_3D() - - @staticmethod - def gather_elements_u32(): - def gather_elements_3D(): - def default(): - x1 = np.arange(0,108).reshape(3,3,4,3).astype(np.int32) - x2 = np.random.randint(low = 0,high=3, size=(10,3,4,3)).astype(np.int32) - y = gather_elements(x1, x2, axis=0) - - x1 = Tensor(Dtype.U32, x1.shape, x1.flatten()) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "gather_elements_u32_default" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather_elements(indices:input_1, axis:Option::Some(0))", - name= name) - - def axis1(): - x1 = np.arange(0,108).reshape(3,3,4,3).astype(np.int32) - x2 = np.random.randint(low = 0,high=3, size=(3,5,4,3)).astype(np.int32) - y = gather_elements(x1, x2, axis=1) - - x1 = Tensor(Dtype.U32, x1.shape, x1.flatten()) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "gather_elements_u32_axis1" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather_elements(indices:input_1, axis:Option::Some(1))", - name= name) - - def axis2(): - x1 = np.arange(0,108).reshape(3,3,4,3).astype(np.int32) - x2 = np.random.randint(low = 0,high=3, size=(3,3,4,3)).astype(np.int32) - y = gather_elements(x1, x2, axis=2) - - x1 = Tensor(Dtype.U32, x1.shape, x1.flatten()) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "gather_elements_u32_axis2" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather_elements(indices:input_1, axis:Option::Some(2))", - name= name) - - def axis3(): - x1 = np.arange(0,108).reshape(3,3,4,3).astype(np.int32) - x2 = np.random.randint(low = 0,high=3, size=(3,3,4,6)).astype(np.int32) - y = gather_elements(x1, x2, axis=3) - - x1 = Tensor(Dtype.U32, x1.shape, x1.flatten()) - x2 = Tensor(Dtype.U32, x2.shape, x2.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "gather_elements_u32_axis3" - make_test( - inputs = [x1, x2], output = y, func_sig = "input_0.gather_elements(indices:input_1, axis:Option::Some(3))", - name= name) - - default() - axis1() - axis2() - axis3() - gather_elements_3D() \ No newline at end of file diff --git a/nodegen/node/less.py b/nodegen/node/less.py index 20b39263d..452ea2732 100644 --- a/nodegen/node/less.py +++ b/nodegen/node/less.py @@ -13,7 +13,7 @@ def default(): x = Tensor(Dtype.U32, x.shape, x.flatten()) y = Tensor(Dtype.U32, y.shape, y.flatten()) - z = Tensor(Dtype.U32, z.shape, z.flatten()) + z = Tensor(Dtype.I32, z.shape, z.flatten()) name = "less_u32" make_test([x, y], z, "input_0.less(@input_1)", name) @@ -25,7 +25,7 @@ def broadcast(): x = Tensor(Dtype.U32, x.shape, x.flatten()) y = Tensor(Dtype.U32, y.shape, y.flatten()) - z = Tensor(Dtype.U32, z.shape, z.flatten()) + z = Tensor(Dtype.I32, z.shape, z.flatten()) name = "less_u32_broadcast" make_test([x, y], z, "input_0.less(@input_1)", name) @@ -42,7 +42,7 @@ def default(): x = Tensor(Dtype.I32, x.shape, x.flatten()) y = Tensor(Dtype.I32, y.shape, y.flatten()) - z = Tensor(Dtype.U32, z.shape, z.flatten()) + z = Tensor(Dtype.I32, z.shape, z.flatten()) name = "less_i32" make_test([x, y], z, "input_0.less(@input_1)", name) @@ -54,7 +54,7 @@ def broadcast(): x = Tensor(Dtype.I32, x.shape, x.flatten()) y = Tensor(Dtype.I32, y.shape, y.flatten()) - z = Tensor(Dtype.U32, z.shape, z.flatten()) + z = Tensor(Dtype.I32, z.shape, z.flatten()) name = "less_i32_broadcast" make_test([x, y], z, "input_0.less(@input_1)", name) @@ -71,7 +71,7 @@ def default(): x = Tensor(Dtype.I8, x.shape, x.flatten()) y = Tensor(Dtype.I8, y.shape, y.flatten()) - z = Tensor(Dtype.U32, z.shape, z.flatten()) + z = Tensor(Dtype.I32, z.shape, z.flatten()) name = "less_i8" make_test([x, y], z, "input_0.less(@input_1)", name) @@ -83,7 +83,7 @@ def broadcast(): x = Tensor(Dtype.I8, x.shape, x.flatten()) y = Tensor(Dtype.I8, y.shape, y.flatten()) - z = Tensor(Dtype.U32, z.shape, z.flatten()) + z = Tensor(Dtype.I32, z.shape, z.flatten()) name = "less_i8_broadcast" make_test([x, y], z, "input_0.less(@input_1)", name) @@ -102,7 +102,7 @@ def default(): x.flatten(), FixedImpl.FP8x23)) y = Tensor(Dtype.FP8x23, y.shape, to_fp( y.flatten(), FixedImpl.FP8x23)) - z = Tensor(Dtype.U32, z.shape, z.flatten()) + z = Tensor(Dtype.I32, z.shape, z.flatten()) name = "less_fp8x23" make_test([x, y], z, "input_0.less(@input_1)", name) @@ -116,7 +116,7 @@ def broadcast(): x.flatten(), FixedImpl.FP8x23)) y = Tensor(Dtype.FP8x23, y.shape, to_fp( y.flatten(), FixedImpl.FP8x23)) - z = Tensor(Dtype.U32, z.shape, z.flatten()) + z = Tensor(Dtype.I32, z.shape, z.flatten()) name = "less_fp8x23_broadcast" make_test([x, y], z, "input_0.less(@input_1)", name) @@ -135,7 +135,7 @@ def default(): x.flatten(), FixedImpl.FP16x16)) y = Tensor(Dtype.FP16x16, y.shape, to_fp( y.flatten(), FixedImpl.FP16x16)) - z = Tensor(Dtype.U32, z.shape, z.flatten()) + z = Tensor(Dtype.I32, z.shape, z.flatten()) name = "less_fp16x16" make_test([x, y], z, "input_0.less(@input_1)", name) @@ -149,7 +149,7 @@ def broadcast(): x.flatten(), FixedImpl.FP16x16)) y = Tensor(Dtype.FP16x16, y.shape, to_fp( y.flatten(), FixedImpl.FP16x16)) - z = Tensor(Dtype.U32, z.shape, z.flatten()) + z = Tensor(Dtype.I32, z.shape, z.flatten()) name = "less_fp16x16_broadcast" make_test([x, y], z, "input_0.less(@input_1)", name) diff --git a/nodegen/node/less_equal.py b/nodegen/node/less_equal.py index c54040331..2a29d0816 100644 --- a/nodegen/node/less_equal.py +++ b/nodegen/node/less_equal.py @@ -13,7 +13,7 @@ def default(): x = Tensor(Dtype.U32, x.shape, x.flatten()) y = Tensor(Dtype.U32, y.shape, y.flatten()) - z = Tensor(Dtype.U32, z.shape, z.flatten()) + z = Tensor(Dtype.I32, z.shape, z.flatten()) name = "less_equal_u32" make_test([x, y], z, "input_0.less_equal(@input_1)", name) @@ -25,7 +25,7 @@ def broadcast(): x = Tensor(Dtype.U32, x.shape, x.flatten()) y = Tensor(Dtype.U32, y.shape, y.flatten()) - z = Tensor(Dtype.U32, z.shape, z.flatten()) + z = Tensor(Dtype.I32, z.shape, z.flatten()) name = "less_equal_u32_broadcast" make_test([x, y], z, "input_0.less_equal(@input_1)", name) @@ -42,7 +42,7 @@ def default(): x = Tensor(Dtype.I32, x.shape, x.flatten()) y = Tensor(Dtype.I32, y.shape, y.flatten()) - z = Tensor(Dtype.U32, z.shape, z.flatten()) + z = Tensor(Dtype.I32, z.shape, z.flatten()) name = "less_equal_i32" make_test([x, y], z, "input_0.less_equal(@input_1)", name) @@ -54,7 +54,7 @@ def broadcast(): x = Tensor(Dtype.I32, x.shape, x.flatten()) y = Tensor(Dtype.I32, y.shape, y.flatten()) - z = Tensor(Dtype.U32, z.shape, z.flatten()) + z = Tensor(Dtype.I32, z.shape, z.flatten()) name = "less_equal_i32_broadcast" make_test([x, y], z, "input_0.less_equal(@input_1)", name) @@ -71,7 +71,7 @@ def default(): x = Tensor(Dtype.I8, x.shape, x.flatten()) y = Tensor(Dtype.I8, y.shape, y.flatten()) - z = Tensor(Dtype.U32, z.shape, z.flatten()) + z = Tensor(Dtype.I32, z.shape, z.flatten()) name = "less_equal_i8" make_test([x, y], z, "input_0.less_equal(@input_1)", name) @@ -83,7 +83,7 @@ def broadcast(): x = Tensor(Dtype.I8, x.shape, x.flatten()) y = Tensor(Dtype.I8, y.shape, y.flatten()) - z = Tensor(Dtype.U32, z.shape, z.flatten()) + z = Tensor(Dtype.I32, z.shape, z.flatten()) name = "less_equal_i8_broadcast" make_test([x, y], z, "input_0.less_equal(@input_1)", name) @@ -102,7 +102,7 @@ def default(): x.flatten(), FixedImpl.FP8x23)) y = Tensor(Dtype.FP8x23, y.shape, to_fp( y.flatten(), FixedImpl.FP8x23)) - z = Tensor(Dtype.U32, z.shape, z.flatten()) + z = Tensor(Dtype.I32, z.shape, z.flatten()) name = "less_equal_fp8x23" make_test([x, y], z, "input_0.less_equal(@input_1)", name) @@ -116,7 +116,7 @@ def broadcast(): x.flatten(), FixedImpl.FP8x23)) y = Tensor(Dtype.FP8x23, y.shape, to_fp( y.flatten(), FixedImpl.FP8x23)) - z = Tensor(Dtype.U32, z.shape, z.flatten()) + z = Tensor(Dtype.I32, z.shape, z.flatten()) name = "less_equal_fp8x23_broadcast" make_test([x, y], z, "input_0.less_equal(@input_1)", name) @@ -135,7 +135,7 @@ def default(): x.flatten(), FixedImpl.FP16x16)) y = Tensor(Dtype.FP16x16, y.shape, to_fp( y.flatten(), FixedImpl.FP16x16)) - z = Tensor(Dtype.U32, z.shape, z.flatten()) + z = Tensor(Dtype.I32, z.shape, z.flatten()) name = "less_equal_fp16x16" make_test([x, y], z, "input_0.less_equal(@input_1)", name) @@ -149,7 +149,7 @@ def broadcast(): x.flatten(), FixedImpl.FP16x16)) y = Tensor(Dtype.FP16x16, y.shape, to_fp( y.flatten(), FixedImpl.FP16x16)) - z = Tensor(Dtype.U32, z.shape, z.flatten()) + z = Tensor(Dtype.I32, z.shape, z.flatten()) name = "less_equal_fp16x16_broadcast" make_test([x, y], z, "input_0.less_equal(@input_1)", name) diff --git a/nodegen/node/max_pool.py b/nodegen/node/max_pool.py new file mode 100644 index 000000000..a2b240746 --- /dev/null +++ b/nodegen/node/max_pool.py @@ -0,0 +1,1263 @@ +import numpy as np +from nodegen.node import RunAll +from ..helpers import make_test, to_fp, Tensor, Dtype, FixedImpl, Trait + +import numpy as np +import numpy as np + +from typing import Tuple, Union +from onnx.reference.ops._op_common_pool import CommonPool + + +def max_pool( + x, + auto_pad=None, + ceil_mode=None, + dilations=None, + kernel_shape=None, + pads=None, + storage_order=None, + strides=None, + output_len=None +): + if ( + dilations is not None + and (min(dilations) != max(dilations) or min(dilations) != 1) + ) or ( + strides is not None and (min(strides) != max(strides) or min(strides) != 1) + ): + return _max_pool( + x, + auto_pad=auto_pad, + ceil_mode=ceil_mode, + dilations=dilations, + kernel_shape=kernel_shape, + pads=pads, + storage_order=storage_order, + strides=strides, + output_len=output_len + ) + + return common_pool( + "MAX", + 0, + x, + auto_pad=auto_pad, + ceil_mode=ceil_mode, + dilations=dilations, + kernel_shape=kernel_shape, + pads=pads, + strides=strides, + p=1 + ) +def _max_pool( # type: ignore + + x, + auto_pad, + ceil_mode, + dilations, + kernel_shape, + pads, + storage_order, + strides, + output_len +): + if pads is None: + pads = [0 for i in range(len(kernel_shape) * 2)] + if strides is None: + strides = [1 for i in range(len(kernel_shape))] + if dilations is None: + dilations = [1 for i in range(len(kernel_shape))] + n_dims = len(kernel_shape) + new_pads = np.array([(pads[i], pads[i + n_dims]) for i in range(n_dims)]) + input_spatial_shape = x.shape[2:] + output_spatial_shape = [0 for s in input_spatial_shape] + if ceil_mode: + for i in range(len(input_spatial_shape)): + output_spatial_shape[i] = int( + np.ceil( + ( + input_spatial_shape[i] + + new_pads[i].sum() + - ((kernel_shape[i] - 1) * dilations[i] + 1) + ) + / strides[i] + + 1 + ) + ) + need_to_reduce_out_size_in_ceil_mode = ( + output_spatial_shape[i] - 1 + ) * strides[i] >= input_spatial_shape[i] + new_pads[i][0] + if need_to_reduce_out_size_in_ceil_mode: + output_spatial_shape[i] -= 1 + else: + for i in range(len(input_spatial_shape)): + output_spatial_shape[i] = int( + np.floor( + ( + input_spatial_shape[i] + + new_pads[i].sum() + - ((kernel_shape[i] - 1) * dilations[i] + 1) + ) + / strides[i] + + 1 + ) + ) + if auto_pad and auto_pad != "NOTSET": + # Deprecated attribute + if auto_pad in ("SAME_UPPER", "SAME_LOWER"): + for i in range(len(input_spatial_shape)): + if auto_pad == "SAME_UPPER": + output_spatial_shape[i] = int( + np.ceil(input_spatial_shape[i] / strides[i]) + ) + else: + output_spatial_shape[i] = int( + np.floor(input_spatial_shape[i] / strides[i]) + ) + pad_i = ( + (output_spatial_shape[i] - 1) * strides[i] + + ((kernel_shape[i] - 1) * dilations[i] + 1) + - input_spatial_shape[i] + ) + new_pads[i, 0] = pad_i // 2 + new_pads[i, 1] = pad_i - new_pads[i, 0] + else: + for i in range(len(input_spatial_shape)): + output_spatial_shape[i] = int( + np.ceil( + ( + input_spatial_shape[i] + - ((kernel_shape[i] - 1) * dilations[i] + 1) + + 1 + ) + / strides[i] + ) + ) + if len(input_spatial_shape) == 1: + return _max_pool_1d( + x, + auto_pad, + ceil_mode, + dilations, + kernel_shape, + new_pads, + storage_order, + strides, + output_spatial_shape, + output_len + ) + if len(input_spatial_shape) == 2: + return _max_pool_2d( + x, + auto_pad, + ceil_mode, + dilations, + kernel_shape, + new_pads, + storage_order, + strides, + output_spatial_shape, + output_len + ) + if len(input_spatial_shape) == 3: + return _max_pool_3d( + x, + auto_pad, + ceil_mode, + dilations, + kernel_shape, + new_pads, + storage_order, + strides, + output_spatial_shape, + output_len + ) + return _max_pool_nd( + x, + auto_pad, + ceil_mode, + dilations, + kernel_shape, + new_pads, + storage_order, + strides, + output_spatial_shape, + output_len + ) +def _max_pool_1d( # type: ignore + + x, + auto_pad, + ceil_mode, + dilations, + kernel_shape, + new_pads, + storage_order, + strides, + output_spatial_shape, + output_len +): + global_pooling = False + y_dims = x.shape[:2] + tuple(output_spatial_shape) + y = np.zeros(y_dims, dtype=x.dtype) + indices = np.full(y_dims, dtype=np.int64, fill_value=-1) + x_dims = x.shape + channels = x_dims[1] + height = x_dims[2] + pooled_height = y_dims[2] + total_channels = x_dims[0] * channels + stride_h = 1 if global_pooling else strides[0] + x_step = height + y_step = pooled_height + dilation_h = dilations[0] + X_data = x.ravel() + Y_data = y.ravel() + I_data = indices.ravel() + def iteration(c): + x_d = c * x_step + y_d = c * y_step + i_d = c * y_step + for ph in range(pooled_height): + hstart = ph * stride_h - new_pads[0, 0] + hend = hstart + kernel_shape[0] * dilation_h + Yh = None + h_index = -1 + for h in range(hstart, hend, dilation_h): + if h < 0 or h >= height: + continue + if Yh is None or X_data[x_d + h] > Yh: + Yh = X_data[x_d + h] + h_index = h + Y_data[y_d + ph] = Yh + I_data[i_d + ph] = c * x_step + h_index + for c in range(total_channels): + iteration(c) + if output_len == 1: # type: ignore + return (Y_data.reshape(y_dims),) + return (Y_data.reshape(y_dims), I_data.reshape(y_dims)) +def _max_pool_2d( # type: ignore + + x, + auto_pad, + ceil_mode, + dilations, + kernel_shape, + new_pads, + storage_order, + strides, + output_spatial_shape, + output_len +): + global_pooling = False + y_dims = x.shape[:2] + tuple(output_spatial_shape) + y = np.zeros(y_dims, dtype=x.dtype) + indices = np.full(y_dims, dtype=np.int64, fill_value=-1) + x_dims = x.shape + channels = x_dims[1] + height = x_dims[2] + width = x_dims[3] if len(kernel_shape) > 1 else 1 + pooled_height = y_dims[2] + pooled_width = y_dims[3] if len(kernel_shape) > 1 else 1 + total_channels = x_dims[0] * channels + stride_h = 1 if global_pooling else strides[0] + stride_w = 1 if global_pooling else strides[1] + x_step = height * width + y_step = pooled_height * pooled_width + dilation_h = dilations[0] + dilation_w = dilations[1] + X_data = x.ravel() + Y_data = y.ravel() + I_data = indices.ravel() + def iteration(c): # type: ignore + x_d = c * x_step # X_data + y_d = c * y_step # Y_data + for ph in range(pooled_height): + hstart = ph * stride_h - new_pads[0, 0] + hend = hstart + kernel_shape[0] * dilation_h + for pw in range(pooled_width): + wstart = pw * stride_w - new_pads[1, 0] + wend = wstart + kernel_shape[1] * dilation_w + + pool_index = ph * pooled_width + pw + Yh = None + h_index = -1 + w_index = -1 + for h in range(hstart, hend, dilation_h): + if h < 0 or h >= height: + continue + for w in range(wstart, wend, dilation_w): + if w < 0 or w >= width: + continue + input_index = h * width + w + if input_index < 0 or input_index > X_data.shape[0]: + continue + if Yh is None or X_data[x_d + input_index] > Yh: + Yh = X_data[x_d + input_index] + h_index = h + w_index = w + if Yh is None: + continue + Y_data[y_d + pool_index] = Yh + I_data[y_d + pool_index] = ( + c * x_step + h_index * width + w_index + if storage_order == 0 + else c * x_step + h_index + w_index * height + ) + for c in range(total_channels): + iteration(c) + if output_len == 1: # type: ignore + return (Y_data.reshape(y_dims),) + return (Y_data.reshape(y_dims), I_data.reshape(y_dims)) +def _max_pool_3d( # type: ignore + + x, + auto_pad, + ceil_mode, + dilations, + kernel_shape, + new_pads, + storage_order, + strides, + output_spatial_shape, + output_len +): + global_pooling = False + y_dims = x.shape[:2] + tuple(output_spatial_shape) + y = np.zeros(y_dims, dtype=x.dtype) + indices = np.full(y_dims, dtype=np.int64, fill_value=-1) + x_dims = x.shape + channels = x_dims[1] + height = x_dims[2] + width = x_dims[3] if len(kernel_shape) > 1 else 1 + depth = x_dims[4] if len(kernel_shape) > 2 else 1 + pooled_height = y_dims[2] + pooled_width = y_dims[3] if len(kernel_shape) > 1 else 1 + pooled_depth = y_dims[4] if len(kernel_shape) > 2 else 1 + total_channels = x_dims[0] * channels + stride_h = 1 if global_pooling else strides[0] + stride_w = 1 if global_pooling else strides[1] + stride_d = 1 if global_pooling else strides[2] + x_step = height * width * depth + y_step = pooled_height * pooled_width * pooled_depth + dilation_h = dilations[0] + dilation_w = dilations[1] + dilation_d = dilations[2] + X_data = x.ravel() + Y_data = y.ravel() + I_data = indices.ravel() + def iteration(c): + x_d = c * x_step + y_d = c * y_step + i_d = c * y_step + for ph in range(pooled_height): + hstart = ph * stride_h - new_pads[0, 0] + hend = hstart + kernel_shape[0] * dilation_h + for pw in range(pooled_width): + wstart = pw * stride_w - new_pads[1, 0] + wend = wstart + kernel_shape[1] * dilation_w + for pd in range(pooled_depth): + dstart = pd * stride_d - new_pads[2, 0] + dend = dstart + kernel_shape[2] * dilation_d + pool_index = ( + ph * pooled_width * pooled_depth + pw * pooled_depth + pd + ) + Yh = None + h_index = -1 + w_index = -1 + d_index = -1 + for h in range(hstart, hend, dilation_h): + if h < 0 or h >= height: + continue + for w in range(wstart, wend, dilation_w): + if w < 0 or w >= width: + continue + for d in range(dstart, dend, dilation_d): + if d < 0 or d >= depth: + continue + input_index = h * width * depth + w * depth + d + if Yh is None or X_data[x_d + input_index] > Yh: + Yh = X_data[x_d + input_index] + h_index = h + w_index = w + d_index = d + + + Y_data[y_d + pool_index] = Yh + I_data[i_d + pool_index] = ( + ( + c * x_step + + h_index * width * depth + + w_index * depth + + d_index + ) + if storage_order == 0 + else ( + c * x_step + + h_index + + w_index * height + + d_index * height * width + ) + ) + for c in range(total_channels): + iteration(c) + if output_len == 1: # type: ignore + return (Y_data.reshape(y_dims),) + return (Y_data.reshape(y_dims), I_data.reshape(y_dims)) +def stride(arr): + stride = np.zeros(len(arr)) + acc = 1 + for i in range(len(arr)): + stride[i] = acc + acc *= arr[-(i + 1)] + return np.flip(stride) +def reverse_stride(arr): + stride = np.zeros(len(arr)) + acc = 1 + for i in range(len(arr)): + acc *= arr[i] + stride[i] = acc + + return stride + + +def _max_pool_nd( # type: ignore + + x, + auto_pad, + ceil_mode, + dilations, + kernel_shape, + new_pads, + storage_order, + strides, + output_spatial_shape, + output_len +): + nd = len(x.shape[2:]) + y_dims = x.shape[:2] + tuple(output_spatial_shape) + y = np.zeros(y_dims, dtype=x.dtype) + indices = np.full(y_dims, dtype=np.int64, fill_value=-1) + x_dims = x.shape + channels = x_dims[1] + x_stride = stride(x.shape) + y_stride = stride(y_dims) + total_channels = x_dims[0] * channels + x_step = x_stride[1] + y_step = y_stride[1] + X_data = x.ravel() + Y_data = y.ravel() + I_data = indices.ravel() + def iteration(c): + x_d = int(c * x_step) + y_d = int(c * y_step) + + for p in range(int(y_step)): + pool_index = p + flatten_index = p + + nstart = np.zeros(nd) + nend = np.zeros(nd) + nstep = np.zeros(nd) + + for n in range(nd): + pn, rem = divmod(flatten_index, y_stride[n + 2]) + flatten_index = rem + + ns = pn * strides[n] - new_pads[n, 0] + nstart[n] = ns + nend[n] = ns + kernel_shape[n] * dilations[n] + + nstep[n] = np.ceil((nend[n] - ns) / dilations[n]) + + nstride = stride(nstep) + max_iter = int(nstep[0] * nstride[0]) + n_index = np.full(y_dims, dtype=np.int64, fill_value=-1) + Yh = None + + for i in range(max_iter): + flatten_index = i + is_outside = False + input_index = 0 + + i_index = np.zeros(nd) + + for n in range(nd): + item, rem = divmod(flatten_index, nstride[n]) + flatten_index = rem + + item_ = item * dilations[n] + nstart[n] + if item_ < 0 or item_ >= x.shape[2 + n]: + is_outside = True + i_index[n] = item_ + input_index += item_ * x_stride[2 + n] + + input_index = int(input_index) + if is_outside == False: + if input_index < 0 or input_index > X_data.shape[0]: + continue + if Yh is None or X_data[x_d + input_index] > Yh: + Yh = X_data[x_d + input_index] + n_index = i_index + + + Y_data[y_d + p] = Yh + + for c in range(total_channels): + iteration(c) + if output_len == 1: # type: ignore + return (Y_data.reshape(y_dims),) + return (Y_data.reshape(y_dims), I_data.reshape(y_dims)) + + + +import itertools +import math +from typing import Sequence, Tuple, Union +import numpy as np + + + +def get_pad_shape( + auto_pad: str, + input_spatial_shape: Sequence[int], + kernel_spatial_shape: Sequence[int], + strides_spatial: Sequence[int], + output_spatial_shape: Sequence[int], +) -> Sequence[int]: + spatial_dims = len(input_spatial_shape) + pad_shape = [0] * spatial_dims + strides_spatial = strides_spatial or [1] * spatial_dims + if auto_pad in ("SAME_UPPER", "SAME_LOWER"): + for i in range(spatial_dims): + pad_shape[i] = ( + (output_spatial_shape[i] - 1) * strides_spatial[i] + + kernel_spatial_shape[i] + - input_spatial_shape[i] + ) + elif auto_pad == "VALID": + pass + + return pad_shape +def get_pad_with_auto_pad(auto_pad: str, pad_shape: Sequence[int]) -> Sequence[int]: + spatial_dims = len(pad_shape) + if auto_pad == "SAME_UPPER": + pads = [pad_shape[i] // 2 for i in range(spatial_dims)] + [ + pad_shape[i] - pad_shape[i] // 2 for i in range(spatial_dims) + ] + elif auto_pad == "SAME_LOWER": + pads = [pad_shape[i] - pad_shape[i] // 2 for i in range(spatial_dims)] + [ + pad_shape[i] // 2 for i in range(spatial_dims) + ] + else: + pads = [0] * spatial_dims * 2 # no padding + return pads + +def get_output_shape_explicit_padding( + pads: Sequence[int], + input_spatial_shape: Sequence[int], + kernel_spatial_shape: Sequence[int], + strides_spatial: Sequence[int], + dilations: Union[Sequence[int], None] = None, + ceil_mode: bool = False, +) -> Tuple[Sequence[int], Sequence[int]]: + + output_spatial_shape = [0] * len(input_spatial_shape) + pads = pads or [0] * len(input_spatial_shape) * 2 + strides_spatial = strides_spatial or [1] * len(input_spatial_shape) + dims = len(input_spatial_shape) + if dilations is None: + dilations = np.ones([dims], dtype=np.int64) + + for dim in range(dims): + dim_size = ( + input_spatial_shape[dim] + + pads[dim] + + pads[dims + dim] + - dilations[dim] * (kernel_spatial_shape[dim] - 1) + - 1 + ) / strides_spatial[dim] + 1 + + if ceil_mode: + output_spatial_shape[dim] = int(np.ceil(dim_size)) + else: + output_spatial_shape[dim] = int(np.floor(dim_size)) + + pads_spatial_shape_new = pads[:] + for dim in range(dims): + sliding_window_size = (kernel_spatial_shape[dim] - 1) * dilations[dim] + 1 + actual_padded_input_size = (output_spatial_shape[dim] - 1) * strides_spatial[ + dim + ] + sliding_window_size + extra_pad = ( + actual_padded_input_size + - input_spatial_shape[dim] + - pads[dim] + - pads[dims + dim] + ) + if extra_pad > 0: + pads_spatial_shape_new[dim] += extra_pad // 2 + pads_spatial_shape_new[dims + dim] += extra_pad - extra_pad // 2 + + return output_spatial_shape, pads_spatial_shape_new + +def get_output_shape_auto_pad( + auto_pad: str, + input_spatial_shape: Sequence[int], + kernel_spatial_shape: Sequence[int], + strides_spatial: Sequence[int], +) -> Sequence[int]: + strides_spatial = strides_spatial or [1] * len(input_spatial_shape) + out_shape = [0] * len(input_spatial_shape) + for i in range(len(input_spatial_shape)): + if auto_pad in ("SAME_UPPER", "SAME_LOWER"): + out_shape[i] = ( + math.floor((input_spatial_shape[i] - 1) / strides_spatial[i]) + 1 + ) + elif auto_pad == "VALID": + out_shape[i] = ( + math.floor( + (input_spatial_shape[i] - kernel_spatial_shape[i]) + / strides_spatial[i] + ) + + 1 + ) + else: + raise ValueError( + "auto_pad can only be NOTSET, SAME_UPPER, SAME_LOWER, or VALID" + ) + + return out_shape + +def lp_pool(x: np.array, p: int) -> float: + y = 0 + for v in np.nditer(x): + y += abs(v) ** p + return y ** (1.0 / p) + +def pool( + padded: np.ndarray, + x_shape: Sequence[int], + kernel: Sequence[int], + strides: Sequence[int], + out_shape: Sequence[int], + pooling_type: str, + pads: Union[Sequence[int], None] = None, + dilations: Union[Sequence[int], None] = None, + count_include_pad: int = 0, + p: int = 1, +) -> np.ndarray: + spatial_size = len(x_shape) - 2 + y = np.zeros([x_shape[0], x_shape[1], *list(out_shape)], dtype=padded.dtype) + if dilations is None: + dilations = np.ones([spatial_size], dtype=np.int64) + if pads is None: + pads = np.zeros([spatial_size * 2], dtype=np.int64) + elif len(pads) == 1: + pads = pads * spatial_size * 2 + strides = strides or [1] * spatial_size + + def lp_pool_p(x): + return lp_pool(x, p) + + + + for shape in itertools.product( + range(x_shape[0]), + range(x_shape[1]), + *[ + range( + int( + ( + x_shape[i + 2] + + pads[i] + + pads[i + spatial_size] + - (1 + (kernel[i] - 1) * dilations[i]) + ) + / strides[i] + + 1 + ) + ) + for i in range(spatial_size) + ], + ): + window = padded[shape[0], shape[1]] + window_vals = np.array( + [ + window[i] + for i in list( + itertools.product( + *[ + range( + strides[i] * shape[i + 2], + strides[i] * shape[i + 2] + + (1 + (kernel[i] - 1) * dilations[i]), + dilations[i], + ) + for i in range(spatial_size) + ] + ) + ) + ] + ) + if pooling_type == "AVG": + f = np.average + elif pooling_type == "MAX": + f = np.max + elif pooling_type == "LPPOOL": + f = lp_pool_p + else: + raise NotImplementedError( + f"Pooling type {pooling_type} does not support. Should be AVG, MAX" + ) + + if count_include_pad == 1 and (pooling_type in {"AVG", "LPPOOL"}): + y[shape] = f(window_vals) + else: + y[shape] = f(window_vals[np.where(~np.isnan(window_vals))]) + return y + + +def common_pool( + pooling_type, + count_include_pad, + x, + auto_pad=None, + ceil_mode=None, + dilations=None, + kernel_shape=None, + pads=None, + strides=None, + p=None, +): + x_shape = np.shape(x) + pading_value = np.nan if pooling_type == "MAX" or count_include_pad == 0 else 0 + if auto_pad in ["SAME_UPPER", "SAME_LOWER", "VALID"]: + assert ( + ceil_mode is None or ceil_mode == 0 + ), "ceil_mode is not supported with auto_pad" + out_shape = get_output_shape_auto_pad( + auto_pad, x.shape[2:], kernel_shape, strides + ) + pads_shape = get_pad_shape( + auto_pad, x_shape[2:], kernel_shape, strides, out_shape + ) + pads = get_pad_with_auto_pad(auto_pad, pads_shape) + n_dims = len(pads) // 2 + pads_np = [(pads[i], pads[i + n_dims]) for i in range(n_dims)] + padded = np.pad( + x, + ((0, 0), (0, 0), *pads_np), + mode="constant", + constant_values=pading_value, + ) + y = pool( + padded, + x_shape, + kernel_shape, + strides, + out_shape, + pooling_type, + pads, + dilations, + count_include_pad, + p, + ) + return (y,) + else: + out_shape, pads = get_output_shape_explicit_padding( + pads, x_shape[2:], kernel_shape, strides, dilations, ceil_mode + ) + # convert pads from [x1_begin, x2_begin,...,x1_end, x2_end,...] to [(x1_begin, x1_end), (x2_begin, x2_end),...] + n_dims = len(pads) // 2 + pads_np = [(pads[i], pads[i + n_dims]) for i in range(n_dims)] + padded = np.pad( + x, + ((0, 0), (0, 0), *pads_np), + mode="constant", + constant_values=pading_value, + ) + y = pool( + padded, + x_shape, + kernel_shape, + strides, + out_shape, + pooling_type, + pads, + dilations, + count_include_pad, + p, + ) + return (y,) + +class Max_pool(RunAll): + + @staticmethod + def export_maxpool_1d() -> None: + + x = np.random.randn(1, 3, 32).astype(np.float32) + kernel_shape = np.array([2]) + strides = np.array([2]) + padded = x + y = max_pool(padded, kernel_shape=kernel_shape, strides=strides,output_len=1) + y = np.array(y[0]) + + x = Tensor(Dtype.FP16x16, x.shape, to_fp(x.flatten(), FixedImpl.FP16x16)) + y = Tensor(Dtype.FP16x16, y.shape, to_fp(y.flatten(), FixedImpl.FP16x16)) + + + name = "maxpool_1d" + func_sig = "NNTrait::max_pool(" + func_sig += "@input_0," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "array![2].span()," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::Some(array![2].span())," + func_sig += "1)" + make_test( + [x], y, func_sig, name, Trait.NN) + + @staticmethod + def export_maxpool_1d_default() -> None: + + x = np.random.randn(1, 3, 32).astype(np.float32) + kernel_shape = np.array([2]) + padded = x + y = max_pool(padded, kernel_shape=kernel_shape,output_len=1) + y = np.array(y[0]) + + x = Tensor(Dtype.FP16x16, x.shape, to_fp(x.flatten(), FixedImpl.FP16x16)) + y = Tensor(Dtype.FP16x16, y.shape, to_fp(y.flatten(), FixedImpl.FP16x16)) + + + name = "maxpool_1d_default" + func_sig = "NNTrait::max_pool(" + func_sig += "@input_0," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "array![2].span()," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "1)" + make_test( + [x], y, func_sig, name, Trait.NN) + + + @staticmethod + def export_maxpool_2d() -> None: + x = np.array( + [ + [ + [ + [1, 2, 3, 4, 5], + [6, 7, 8, 9, 10], + [11, 12, 13, 14, 15], + [16, 17, 18, 19, 20], + [21, 22, 23, 24, 25], + ] + ] + ] + ).astype(np.float32) + + kernel_shape=(2, 2) + strides=(2, 2) + padded = x + y = max_pool(padded,strides = strides,kernel_shape=kernel_shape,output_len=1) + y = np.array(y[0]) + + x = Tensor(Dtype.FP16x16, x.shape, to_fp(x.flatten(), FixedImpl.FP16x16)) + y = Tensor(Dtype.FP16x16, y.shape, to_fp(y.flatten(), FixedImpl.FP16x16)) + + + name = "maxpool_2d" + func_sig = "NNTrait::max_pool(" + func_sig += "@input_0," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "array![2, 2].span()," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::Some(array![2, 2].span())," + func_sig += "1)" + make_test( + [x], y, func_sig, name, Trait.NN) + + @staticmethod + def export_maxpool_2d_default() -> None: + x = np.random.randn(1, 3, 8, 8).astype(np.float32) + kernel_shape = (2, 2) + padded = x + y = max_pool(padded, kernel_shape=kernel_shape, output_len=1) + y = np.array(y[0]) + + x = Tensor(Dtype.FP16x16, x.shape, to_fp(x.flatten(), FixedImpl.FP16x16)) + y = Tensor(Dtype.FP16x16, y.shape, to_fp(y.flatten(), FixedImpl.FP16x16)) + + name = "maxpool_2d_default" + func_sig = "NNTrait::max_pool(" + func_sig += "@input_0," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "array![2, 2].span()," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "1)" + make_test( + [x], y, func_sig, name, Trait.NN) + + + def export_maxpool_2d_pads_default() -> None: + x = np.array( + [ + [ + [ + [1, 2, 3, 4, 5], + [6, 7, 8, 9, 10], + [11, 12, 13, 14, 15], + [16, 17, 18, 19, 20], + [21, 22, 23, 24, 25], + ] + ] + ] + ).astype(np.uint8) + kernel_shape=(5, 5) + pads=(2, 2, 2, 2) + padded = x + y = max_pool(padded,pads = pads,kernel_shape=kernel_shape,output_len=1) + y = np.array(y[0]) + + + x = Tensor(Dtype.FP16x16, x.shape, to_fp(x.flatten(), FixedImpl.FP16x16)) + y = Tensor(Dtype.FP16x16, y.shape, to_fp(y.flatten(), FixedImpl.FP16x16)) + + name = "maxpool_2d_pads_default" + func_sig = "NNTrait::max_pool(" + func_sig += "@input_0," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "array![5, 5].span()," + func_sig += "Option::Some(array![2, 2, 2, 2].span())," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "1)" + make_test( + [x], y, func_sig, name, Trait.NN) + + @staticmethod + def export_maxpool_2d_constraint_index() -> None: + x = np.array( + [ + [ + [ + [1, 2, 3, 4, 5], + [6, 7, 8, 9, 10], + [11, 12, 13, 14, 15], + [16, 17, 18, 19, 20], + [21, 22, 23, 24, 25], + ] + ] + ] + ).astype(np.float32) + y = np.array([[[[7, 9], [17, 19]]]]).astype(np.float32) + z = np.array([[[[6, 16], [8, 18]]]]).astype(np.int64) + + kernel_shape=(2, 2) + strides=(2, 2) + padded = x + (y, z) = max_pool(padded,strides = strides,kernel_shape=kernel_shape,output_len=2, storage_order=1) + + y = np.array(y) + z = np.array(z) + + x = Tensor(Dtype.FP16x16, x.shape, to_fp(x.flatten(), FixedImpl.FP16x16)) + y = Tensor(Dtype.FP16x16, y.shape, to_fp(y.flatten(), FixedImpl.FP16x16)) + z = Tensor(Dtype.U32, z.shape, z.flatten()) + + + name = "maxpool_2d_constraint_index" + func_sig = "NNTrait::max_pool(" + func_sig += "@input_0," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "array![2, 2].span()," + func_sig += "Option::None," + func_sig += "Option::Some(1)," + func_sig += "Option::Some(array![2, 2].span())," + func_sig += "2)" + make_test( + [x], z, func_sig, name, Trait.NN) + + @staticmethod + def export_maxpool_2d_same_upper() -> None: + x = np.array( + [ + [ + [ + [1, 2, 3, 4, 5], + [6, 7, 8, 9, 10], + [11, 12, 13, 14, 15], + [16, 17, 18, 19, 20], + [21, 22, 23, 24, 25], + ] + ] + ] + ).astype(np.float32) + + kernel_shape=(3, 3) + strides=(2, 2) + padded = x + y = max_pool(padded,strides = strides,kernel_shape=kernel_shape,auto_pad="SAME_UPPER") + y = np.array(y[0]) + + x = Tensor(Dtype.FP16x16, x.shape, to_fp(x.flatten(), FixedImpl.FP16x16)) + y = Tensor(Dtype.FP16x16, y.shape, to_fp(y.flatten(), FixedImpl.FP16x16)) + + + name = "maxpool_2d_same_upper" + func_sig = "NNTrait::max_pool(" + func_sig += "@input_0," + func_sig += "Option::Some(AUTO_PAD::SAME_UPPER)," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "array![3, 3].span()," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::Some(array![2, 2].span())," + func_sig += "1)" + make_test( + [x], y, func_sig, name, Trait.NN) + + @staticmethod + def export_maxpool_2d_same_upper_default() -> None: + x = np.random.randn(1, 3, 8, 8).astype(np.float32) + kernel_shape = (2, 2) + padded = x + y = max_pool(padded,auto_pad="SAME_UPPER", kernel_shape=kernel_shape, output_len=1) + y = np.array(y[0]) + + x = Tensor(Dtype.FP16x16, x.shape, to_fp(x.flatten(), FixedImpl.FP16x16)) + y = Tensor(Dtype.FP16x16, y.shape, to_fp(y.flatten(), FixedImpl.FP16x16)) + + name = "maxpool_2d_same_upper_default" + func_sig = "NNTrait::max_pool(" + func_sig += "@input_0," + func_sig += "Option::Some(AUTO_PAD::SAME_UPPER)," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "array![2, 2].span()," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "1)" + make_test( + [x], y, func_sig, name, Trait.NN) + + @staticmethod + def export_maxpool_2d_same_lower_default() -> None: + x = np.random.randn(1, 3, 8, 8).astype(np.float32) + x_shape = np.shape(x) + kernel_shape = (2, 2) + padded = x + y = max_pool(padded,auto_pad="SAME_LOWER", kernel_shape=kernel_shape, output_len=1) + y = np.array(y[0]) + + + x = Tensor(Dtype.FP16x16, x.shape, to_fp(x.flatten(), FixedImpl.FP16x16)) + y = Tensor(Dtype.FP16x16, y.shape, to_fp(y.flatten(), FixedImpl.FP16x16)) + + name = "maxpool_2d_same_lower_default" + func_sig = "NNTrait::max_pool(" + func_sig += "@input_0," + func_sig += "Option::Some(AUTO_PAD::SAME_LOWER)," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "array![2, 2].span()," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "1)" + make_test( + [x], y, func_sig, name, Trait.NN) + + @staticmethod + def export_maxpool_2d_ceil() -> None: + x = np.array( + [ + [ + [ + [1, 2, 3, 4], + [5, 6, 7, 8], + [9, 10, 11, 12], + [13, 14, 15, 16], + ] + ] + ] + ).astype(np.float32) + y = np.array([[[[11, 12], [15, 16]]]]).astype(np.float32) + + kernel_shape = (3, 3) + strides = (2, 2) + padded = x + y = max_pool(padded,strides = strides, ceil_mode = True,kernel_shape=kernel_shape, output_len=1) + y = np.array(y[0]) + + + x = Tensor(Dtype.FP16x16, x.shape, to_fp(x.flatten(), FixedImpl.FP16x16)) + y = Tensor(Dtype.FP16x16, y.shape, to_fp(y.flatten(), FixedImpl.FP16x16)) + + name = "maxpool_2d_ceil" + func_sig = "NNTrait::max_pool(" + func_sig += "@input_0," + func_sig += "Option::None," + func_sig += "Option::Some(1)," + func_sig += "Option::None," + func_sig += "array![3, 3].span()," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::Some(array![2, 2].span())," + func_sig += "1)" + make_test( + [x], y, func_sig, name, Trait.NN) + + @staticmethod + def export_maxpool_2d_dilations() -> None: + x = np.array( + [ + [ + [ + [1, 2, 3, 4], + [5, 6, 7, 8], + [9, 10, 11, 12], + [13, 14, 15, 16], + ] + ] + ] + ).astype(np.float32) + + kernel_shape = (2 , 2) + dilations = (2, 2) + padded = x + y = max_pool(padded,dilations = dilations, ceil_mode = True,kernel_shape=kernel_shape, output_len=1) + y = np.array(y[0]) + + x = Tensor(Dtype.FP16x16, x.shape, to_fp(x.flatten(), FixedImpl.FP16x16)) + y = Tensor(Dtype.FP16x16, y.shape, to_fp(y.flatten(), FixedImpl.FP16x16)) + + + name = "maxpool_2d_dilations" + func_sig = "NNTrait::max_pool(" + func_sig += "@input_0," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::Some(array![2, 2].span())," + func_sig += "array![2, 2].span()," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "1)" + make_test( + [x], y, func_sig, name, Trait.NN) + + @staticmethod + def export_maxpool_3d_dilations() -> None: + + x = np.array( + [ + [ + [ + [ + [1, 2, 3, 4], + [5, 6, 7, 8], + [9, 10, 11, 12], + [13, 14, 15, 16], + ], + [ + [1, 2, 3, 4], + [5, 6, 7, 8], + [9, 10, 11, 12], + [13, 14, 15, 16], + ], + [ + [1, 2, 3, 4], + [5, 6, 7, 8], + [9, 10, 11, 12], + [13, 14, 15, 16], + ], + [ + [1, 2, 3, 4], + [5, 6, 7, 8], + [9, 10, 11, 12], + [13, 14, 15, 16], + ], + ] + ] + ] + ).astype(np.float32) + kernel_shape=(2, 2, 2) + strides=(1, 1, 1) + dilations=(2, 2, 2) + padded = x + y = max_pool(padded, dilations=dilations, kernel_shape=kernel_shape, strides=strides,output_len=1) + y = np.array(y[0]) + + + x = Tensor(Dtype.FP16x16, x.shape, to_fp(x.flatten(), FixedImpl.FP16x16)) + y = Tensor(Dtype.FP16x16, y.shape, to_fp(y.flatten(), FixedImpl.FP16x16)) + + name = "maxpool_3d_dilations" + func_sig = "NNTrait::max_pool(" + func_sig += "@input_0," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::Some(array![2, 2, 2].span())," + func_sig += "array![2, 2, 2].span()," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::Some(array![1, 1, 1].span())," + func_sig += "1)" + make_test( + [x], y, func_sig, name, Trait.NN) + + @staticmethod + def export_maxpool_4d_dilations() -> None: + x = np.random.randn(1, 3, 4, 4, 4, 4).astype(np.float32) + x_shape = np.shape(x) + kernel_shape = (2, 2, 2, 2) + strides = (1, 1, 1, 1) + dilations = (2, 2, 2, 2) + padded = x + y = max_pool(padded,dilations = dilations, ceil_mode = True,kernel_shape=kernel_shape, output_len=1) + y = np.array(y[0]) + + x = Tensor(Dtype.FP16x16, x.shape, to_fp(x.flatten(), FixedImpl.FP16x16)) + y = Tensor(Dtype.FP16x16, y.shape, to_fp(y.flatten(), FixedImpl.FP16x16)) + + name = "maxpool_4d_dilations" + func_sig = "NNTrait::max_pool(" + func_sig += "@input_0," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::Some(array![2, 2, 2, 2].span())," + func_sig += "array![2, 2, 2, 2].span()," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "1)" + make_test( + [x], y, func_sig, name, Trait.NN) + + + + + \ No newline at end of file diff --git a/nodegen/node/qlinear_conv.py b/nodegen/node/qlinear_conv.py new file mode 100644 index 000000000..3bdee0819 --- /dev/null +++ b/nodegen/node/qlinear_conv.py @@ -0,0 +1,101 @@ +import numpy as np +from nodegen.node import RunAll +from ..helpers import make_test, to_fp, Tensor, Dtype, FixedImpl +from .conv import conv + + +def qlinear_conv( + x, + x_scale, + x_zero_point, + w, + w_scale, + w_zero_point, + y_scale, + y_zero_point, + B=None, + auto_pad=None, + dilations=None, + group=None, + kernel_shape=None, + pads=None, + strides=None, +): + X = x.astype(np.int32) + if x_zero_point is not None: + X -= x_zero_point + W = w.astype(np.int32) + if w_zero_point is not None: + if len(w_zero_point.shape) == 1 and w_zero_point.shape[0] == W.shape[0]: + missing = (w_zero_point.shape[0],) + (1,) * (len(W.shape) - 1) + W -= w_zero_point.reshape(missing) + else: + W -= w_zero_point + res = conv( + X, W, B, auto_pad, dilations, group, kernel_shape, pads, strides + ).astype(np.int32) + R = res * (x_scale * w_scale / y_scale) + if y_zero_point is not None: + R += y_zero_point + if y_zero_point.dtype == np.int8: + R = np.clip(R, -128, 127) + else: + R = np.clip(R, 0, 255) + return (np.rint(R).astype(y_zero_point.dtype),) + if x.dtype == np.int8: + R = np.clip(R, -128, 127) + else: + R = np.clip(R, 0, 255) + return (np.rint(R).astype(x.dtype),) + + +class Qlinear_conv(RunAll): + @staticmethod + def export_qlinear_conv() -> None: + x = np.array([ + [1, 2, 3], + [4, 5, 6], + [7, 8, 9]], + + dtype=np.int8, + ).reshape((1, 1, 3, 3)) + x_scale = np.float32(0.5) + x_zero_point = np.int8(2) + + w = np.array([0], dtype=np.int8).reshape((1, 1, 1, 1)) + w_scale = np.array([0.4], dtype=np.float32) + w_zero_point = np.array([3], dtype=np.int8) + + y_scale = np.float32(0.2) + y_zero_point = np.int8(4) + + param = np.array([0.5, 2, 0.4, 3, 0.2, 4]) + + y = qlinear_conv(x,x_scale,x_zero_point,w,w_scale,w_zero_point,y_scale,y_zero_point,) + y = np.array(y) + + x = Tensor(Dtype.I8, x.shape, x.flatten()) + w = Tensor(Dtype.I8, w.shape, w.flatten()) + y = Tensor(Dtype.I8, y.shape, y.flatten()) + param = Tensor(Dtype.FP16x16, param.shape, to_fp(param.flatten(), FixedImpl.FP16x16)) + + + name = "qlinear_conv" + func_sig = "qlinear_conv(" + func_sig += "@input_0," + func_sig += "@TensorTrait::new(shape: array![1].span(), data: array![*input_2.data.at(0)].span(),)," + func_sig += "@TensorTrait::new(shape: array![1].span(), data: array![*input_2.data.at(1)].span(),)," + func_sig += "@input_1," + func_sig += "@TensorTrait::new(shape: array![1].span(), data: array![*input_2.data.at(2)].span(),)," + func_sig += "@TensorTrait::new(shape: array![1].span(), data: array![*input_2.data.at(3)].span(),)," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "Option::None," + func_sig += "@TensorTrait::new(shape: array![1].span(), data: array![*input_2.data.at(4)].span(),)," + func_sig += "@TensorTrait::new(shape: array![1].span(), data: array![*input_2.data.at(5)].span(),))" + make_test( + [x, w, param], y, func_sig, name) diff --git a/nodegen/node/reduce_sum.py b/nodegen/node/reduce_sum.py index 111724001..d3f311b25 100644 --- a/nodegen/node/reduce_sum.py +++ b/nodegen/node/reduce_sum.py @@ -4,285 +4,79 @@ class Reduce_sum(RunAll): - @staticmethod - def reduce_sum_u32(): - def reduce_sum_1D(): - x = np.array([0, 1, 2,]).astype(np.uint32) - y = np.array([3]).astype(np.uint32) - - x = Tensor(Dtype.U32, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "reduce_sum_u32_1D" - make_test( - [x], y, "input_0.reduce_sum(0, false)", name) - - def reduce_sum_2D(): - def default(): - x = np.array([0, 1, 2, 3]).astype(np.uint32).reshape(2, 2) - y = np.array([2, 4]).astype(np.uint32) - - x = Tensor(Dtype.U32, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "reduce_sum_u32_2D_default" - make_test( - [x], y, "input_0.reduce_sum(0, false)", name) - - def keepdims(): - x = np.array([0, 1, 2, 3]).astype(np.uint32).reshape(2, 2) - y = np.array([2, 4]).astype(np.uint32).reshape(1, 2) - - x = Tensor(Dtype.U32, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "reduce_sum_u32_2D_keepdims" - make_test( - [x], y, "input_0.reduce_sum(0, true)", name) - - def axis_1(): - x = np.array([0, 1, 2, 3]).astype(np.uint32).reshape(2, 2) - y = np.array([1, 5]).astype(np.uint32) - - x = Tensor(Dtype.U32, x.shape, x.flatten()) - y = Tensor(Dtype.U32, y.shape, y.flatten()) - - name = "reduce_sum_u32_2D_axis_1" - make_test( - [x], y, "input_0.reduce_sum(1, false)", name) - - default() - keepdims() - axis_1() - reduce_sum_1D() - reduce_sum_2D() @staticmethod - def reduce_sum_i32(): - def reduce_sum_1D(): - x = np.array([0, 1, 2,]).astype(np.int32) - y = np.array([3]).astype(np.int32) + def reduce_sum_no_keep_dims(): + axes = np.array([1], dtype=np.uint32) + keepdims = 0 - x = Tensor(Dtype.I32, x.shape, x.flatten()) - y = Tensor(Dtype.I32, y.shape, y.flatten()) + x = np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]], [ + [9, 10], [11, 12]]]).astype(np.uint32) + y = np.sum(x, axis=tuple(axes.tolist()), keepdims=keepdims == 1) - name = "reduce_sum_i32_1D" - make_test( - [x], y, "input_0.reduce_sum(0, false)", name) + x = Tensor(Dtype.U32, x.shape, x.flatten()) + y = Tensor(Dtype.U32, y.shape, y.flatten()) - def reduce_sum_2D(): - def default(): - x = np.array([0, 1, 2, 3]).astype(np.int32).reshape(2, 2) - y = np.array([2, 4]).astype(np.int32) - - x = Tensor(Dtype.I32, x.shape, x.flatten()) - y = Tensor(Dtype.I32, y.shape, y.flatten()) - - name = "reduce_sum_i32_2D_default" - make_test( - [x], y, "input_0.reduce_sum(0, false)", name) - - def keepdims(): - x = np.array([0, 1, 2, 3]).astype(np.int32).reshape(2, 2) - y = np.array([2, 4]).astype(np.int32).reshape(1, 2) - - x = Tensor(Dtype.I32, x.shape, x.flatten()) - y = Tensor(Dtype.I32, y.shape, y.flatten()) - - name = "reduce_sum_i32_2D_keepdims" - make_test( - [x], y, "input_0.reduce_sum(0, true)", name) - - def axis_1(): - x = np.array([0, 1, 2, 3]).astype(np.int32).reshape(2, 2) - y = np.array([1, 5]).astype(np.int32) - - x = Tensor(Dtype.I32, x.shape, x.flatten()) - y = Tensor(Dtype.I32, y.shape, y.flatten()) - - name = "reduce_sum_i32_2D_axis_1" - make_test( - [x], y, "input_0.reduce_sum(1, false)", name) - - default() - keepdims() - axis_1() - reduce_sum_1D() - reduce_sum_2D() + name = "reduce_sum_no_keep_dims" + make_test( + [x], y, "input_0.reduce_sum(Option::Some(array![1].span()), Option::Some(false), Option::None)", name) @staticmethod - def reduce_sum_i8(): - def reduce_sum_1D(): - x = np.array([0, 1, 2,]).astype(np.int8) - y = np.array([3]).astype(np.int8) - - x = Tensor(Dtype.FP8x23, x.shape, x.flatten()) - y = Tensor(Dtype.FP8x23, y.shape, y.flatten()) - - name = "reduce_sum_i8_1D" - make_test( - [x], y, "input_0.reduce_sum(0, false)", name) - - def reduce_sum_2D(): - def default(): - x = np.array([0, 1, 2, 3]).astype(np.int8).reshape(2, 2) - y = np.array([2, 4]).astype(np.int8) + def reduce_sum_keep_dims(): + axes = np.array([1], dtype=np.uint32) + keepdims = 1 - x = Tensor(Dtype.FP8x23, x.shape, x.flatten()) - y = Tensor(Dtype.FP8x23, y.shape, y.flatten()) + x = np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]], [ + [9, 10], [11, 12]]]).astype(np.uint32) + y = np.sum(x, axis=tuple(axes.tolist()), keepdims=keepdims == 1) - name = "reduce_sum_i8_2D_default" - make_test( - [x], y, "input_0.reduce_sum(0, false)", name) + x = Tensor(Dtype.U32, x.shape, x.flatten()) + y = Tensor(Dtype.U32, y.shape, y.flatten()) - def keepdims(): - x = np.array([0, 1, 2, 3]).astype(np.int8).reshape(2, 2) - y = np.array([2, 4]).astype(np.int8).reshape(1, 2) - - x = Tensor(Dtype.FP8x23, x.shape, x.flatten()) - y = Tensor(Dtype.FP8x23, y.shape, y.flatten()) - - name = "reduce_sum_i8_2D_keepdims" - make_test( - [x], y, "input_0.reduce_sum(0, true)", name) - - def axis_1(): - x = np.array([0, 1, 2, 3]).astype(np.int8).reshape(2, 2) - y = np.array([1, 5]).astype(np.int8) - - x = Tensor(Dtype.FP8x23, x.shape, x.flatten()) - y = Tensor(Dtype.FP8x23, y.shape, y.flatten()) - - name = "reduce_sum_i8_2D_axis_1" - make_test( - [x], y, "input_0.reduce_sum(1, false)", name) - - default() - keepdims() - axis_1() - reduce_sum_1D() - reduce_sum_2D() + name = "reduce_sum_keep_dims" + make_test( + [x], y, "input_0.reduce_sum(Option::Some(array![1].span()), Option::Some(true), Option::None)", name) @staticmethod - def reduce_sum_fp8x23(): - def reduce_sum_1D(): - x = np.array([0, 1, 2,]).astype(np.int64) - y = np.array([3]).astype(np.int64) - - x = Tensor(Dtype.FP8x23, x.shape, to_fp( - x.flatten(), FixedImpl.FP8x23)) - y = Tensor(Dtype.FP8x23, y.shape, to_fp( - y.flatten(), FixedImpl.FP8x23)) - - name = "reduce_sum_fp8x23_1D" - make_test( - [x], y, "input_0.reduce_sum(0, false)", name) - - def reduce_sum_2D(): - def default(): - x = np.array([0, 1, 2, 3]).astype(np.int64).reshape(2, 2) - y = np.array([2, 4]).astype(np.int64) - - x = Tensor(Dtype.FP8x23, x.shape, to_fp( - x.flatten(), FixedImpl.FP8x23)) - y = Tensor(Dtype.FP8x23, y.shape, to_fp( - y.flatten(), FixedImpl.FP8x23)) - - name = "reduce_sum_fp8x23_2D_default" - make_test( - [x], y, "input_0.reduce_sum(0, false)", name) - - def keepdims(): - x = np.array([0, 1, 2, 3]).astype(np.int64).reshape(2, 2) - y = np.array([2, 4]).astype(np.int64).reshape(1, 2) + def reduce_sum_default_axes_keepdims(): + keepdims = 1 - x = Tensor(Dtype.FP8x23, x.shape, to_fp( - x.flatten(), FixedImpl.FP8x23)) - y = Tensor(Dtype.FP8x23, y.shape, to_fp( - y.flatten(), FixedImpl.FP8x23)) + x = np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]], [ + [9, 10], [11, 12]]]).astype(np.uint32) + y = np.sum(x, axis=None, keepdims=keepdims == 1) - name = "reduce_sum_fp8x23_2D_keepdims" - make_test( - [x], y, "input_0.reduce_sum(0, true)", name) - - def axis_1(): - x = np.array([0, 1, 2, 3]).astype(np.int64).reshape(2, 2) - y = np.array([1, 5]).astype(np.int64) - - x = Tensor(Dtype.FP8x23, x.shape, to_fp( - x.flatten(), FixedImpl.FP8x23)) - y = Tensor(Dtype.FP8x23, y.shape, to_fp( - y.flatten(), FixedImpl.FP8x23)) - - name = "reduce_sum_fp8x23_2D_axis_1" - make_test( - [x], y, "input_0.reduce_sum(1, false)", name) - - default() - keepdims() - axis_1() - - reduce_sum_1D() - reduce_sum_2D() + x = Tensor(Dtype.U32, x.shape, x.flatten()) + y = Tensor(Dtype.U32, y.shape, y.flatten()) + name = "reduce_sum_default_axes_keepdims" + make_test( + [x], y, "input_0.reduce_sum(Option::Some(array![].span()), Option::Some(true), Option::None)", name) + @staticmethod - def reduce_sum_fp16x16(): - def reduce_sum_1D(): - x = np.array([0, 1, 2,]).astype(np.int64) - y = np.array([3]).astype(np.int64) - - x = Tensor(Dtype.FP16x16, x.shape, to_fp( - x.flatten(), FixedImpl.FP16x16)) - y = Tensor(Dtype.FP16x16, y.shape, to_fp( - y.flatten(), FixedImpl.FP16x16)) - - name = "reduce_sum_fp16x16_1D" - make_test( - [x], y, "input_0.reduce_sum(0, false)", name) + def reduce_sum_negative_axes_keepdims(): + axes = np.array([-2], dtype=np.int64) + keepdims = 1 - def reduce_sum_2D(): - def default(): - x = np.array([0, 1, 2, 3]).astype(np.int64).reshape(2, 2) - y = np.array([2, 4]).astype(np.int64) + x = np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]], [ + [9, 10], [11, 12]]]).astype(np.uint32) + y = np.sum(x, axis=tuple(axes.tolist()), keepdims=keepdims == 1) - x = Tensor(Dtype.FP16x16, x.shape, to_fp( - x.flatten(), FixedImpl.FP16x16)) - y = Tensor(Dtype.FP16x16, y.shape, to_fp( - y.flatten(), FixedImpl.FP16x16)) + x = Tensor(Dtype.U32, x.shape, x.flatten()) + y = Tensor(Dtype.U32, y.shape, y.flatten()) - name = "reduce_sum_fp16x16_2D_default" - make_test( - [x], y, "input_0.reduce_sum(0, false)", name) + name = "reduce_sum_negative_axes_keepdims" + make_test( + [x], y, "input_0.reduce_sum(Option::Some(array![-2].span()), Option::Some(true), Option::None)", name) - def keepdims(): - x = np.array([0, 1, 2, 3]).astype(np.int64).reshape(2, 2) - y = np.array([2, 4]).astype(np.int64).reshape(1, 2) - - x = Tensor(Dtype.FP16x16, x.shape, to_fp( - x.flatten(), FixedImpl.FP16x16)) - y = Tensor(Dtype.FP16x16, y.shape, to_fp( - y.flatten(), FixedImpl.FP16x16)) - - name = "reduce_sum_fp16x16_2D_keepdims" - make_test( - [x], y, "input_0.reduce_sum(0, true)", name) - - def axis_1(): - x = np.array([0, 1, 2, 3]).astype(np.int64).reshape(2, 2) - y = np.array([1, 5]).astype(np.int64) - - x = Tensor(Dtype.FP16x16, x.shape, to_fp( - x.flatten(), FixedImpl.FP16x16)) - y = Tensor(Dtype.FP16x16, y.shape, to_fp( - y.flatten(), FixedImpl.FP16x16)) - - name = "reduce_sum_fp16x16_2D_axis_1" - make_test( - [x], y, "input_0.reduce_sum(1, false)", name) + @staticmethod + def reduce_sum_empty_axes_input_noop(): + x = np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]], [ + [9, 10], [11, 12]]]).astype(np.uint32) + y = np.array(x) - default() - keepdims() - axis_1() + x = Tensor(Dtype.U32, x.shape, x.flatten()) + y = Tensor(Dtype.U32, y.shape, y.flatten()) - reduce_sum_1D() - reduce_sum_2D() + name = "reduce_sum_empty_axes_input_noop" + make_test( + [x], y, "input_0.reduce_sum(Option::None, Option::Some(true), Option::Some(true))", name) \ No newline at end of file diff --git a/nodegen/node/reshape.py b/nodegen/node/reshape.py new file mode 100644 index 000000000..417b59125 --- /dev/null +++ b/nodegen/node/reshape.py @@ -0,0 +1,136 @@ +import numpy as np +from nodegen.node import RunAll +from ..helpers import make_test, Tensor, Dtype + +original_shape = [2, 3, 4] +data = np.random.random_sample(original_shape).astype(np.int32) + + +def reshape_reference_implementation( + data: np.ndarray, shape: np.ndarray, allowzero: int = 0 +) -> np.ndarray: + # replace zeros with corresponding dim size + # we need to do this because np.reshape doesn't support 0 by default unless 'allowzero' is set + new_shape = np.copy(shape) + if allowzero == 0: + zeros_index = np.where(shape == 0) + new_shape[zeros_index] = np.array(data.shape)[zeros_index] + reshaped = np.reshape(data, new_shape) + return reshaped + + +class Reshape(RunAll): + @staticmethod + def reshape_reordered_all_dims(): + y = reshape_reference_implementation( + data, np.array([4, 2, 3], dtype=np.int64)) + + x = Tensor(Dtype.I32, data.shape, data.flatten()) + y = Tensor(Dtype.I32, y.shape, y.flatten()) + + name = "reshape_reordered_all_dims" + make_test([x], y, "input_0.reshape(array![4,2,3].span(), false)", name) + + @staticmethod + def reshape_reordered_last_dims(): + y = reshape_reference_implementation( + data, np.array([2, 4, 3], dtype=np.int64)) + + x = Tensor(Dtype.I32, data.shape, data.flatten()) + y = Tensor(Dtype.I32, y.shape, y.flatten()) + + name = "reshape_reordered_last_dims" + make_test([x], y, "input_0.reshape(array![2,4,3].span(), false)", name) + + @staticmethod + def reshape_reduced_dims(): + y = reshape_reference_implementation( + data, np.array([2, 12], dtype=np.int64)) + + x = Tensor(Dtype.I32, data.shape, data.flatten()) + y = Tensor(Dtype.I32, y.shape, y.flatten()) + + name = "reshape_reduced_dims" + make_test([x], y, "input_0.reshape(array![2,12].span(), false)", name) + + @staticmethod + def reshape_extended_dims(): + y = reshape_reference_implementation( + data, np.array([2, 3, 2, 2], dtype=np.int64)) + + x = Tensor(Dtype.I32, data.shape, data.flatten()) + y = Tensor(Dtype.I32, y.shape, y.flatten()) + + name = "reshape_extended_dims" + make_test([x], y, "input_0.reshape(array![2, 3, 2, 2].span(), false)", name) + + @staticmethod + def reshape_one_dim(): + y = reshape_reference_implementation( + data, np.array([24], dtype=np.int64)) + + x = Tensor(Dtype.I32, data.shape, data.flatten()) + y = Tensor(Dtype.I32, y.shape, y.flatten()) + + name = "reshape_one_dim" + make_test([x], y, "input_0.reshape(array![24].span(), false)", name) + + @staticmethod + def reshape_negative_dim(): + y = reshape_reference_implementation( + data, np.array([2, -1, 2], dtype=np.int64)) + + x = Tensor(Dtype.I32, data.shape, data.flatten()) + y = Tensor(Dtype.I32, y.shape, y.flatten()) + + name = "reshape_negative_dim" + make_test([x], y, "input_0.reshape(array![2, -1, 2].span(), false)", name) + + @staticmethod + def reshape_negative_extended_dims(): + y = reshape_reference_implementation( + data, np.array([-1, 2, 3, 4], dtype=np.int64)) + + x = Tensor(Dtype.I32, data.shape, data.flatten()) + y = Tensor(Dtype.I32, y.shape, y.flatten()) + + name = "reshape_negative_extended_dims" + make_test([x], y, "input_0.reshape(array![-1, 2, 3, 4].span(), false)", name) + + @staticmethod + def reshape_zero_dim(): + y = reshape_reference_implementation( + data, np.array([2, 0, 4, 1], dtype=np.int64)) + + x = Tensor(Dtype.I32, data.shape, data.flatten()) + y = Tensor(Dtype.I32, y.shape, y.flatten()) + + name = "reshape_zero_dim" + make_test([x], y, "input_0.reshape(array![2, 0, 4, 1].span(), false)", name) + + @staticmethod + def reshape_zero_and_negative_dim(): + y = reshape_reference_implementation( + data, np.array([2, 0, 1, -1], dtype=np.int64)) + + x = Tensor(Dtype.I32, data.shape, data.flatten()) + y = Tensor(Dtype.I32, y.shape, y.flatten()) + + name = "reshape_zero_and_negative_dim" + make_test([x], y, "input_0.reshape(array![2, 0, 1, -1].span(), false)", name) + + @staticmethod + def reshape_zero_and_negative_dim(): + original_shape = [0, 3, 4] + data = np.random.random_sample(original_shape).astype(np.int32) + + y = reshape_reference_implementation( + data, np.array([3, 4, 0], dtype=np.int64), allowzero=1) + + x = Tensor(Dtype.I32, data.shape, data.flatten()) + y = Tensor(Dtype.I32, y.shape, y.flatten()) + + name = "reshape_zero_and_negative_dim" + make_test([x], y, "input_0.reshape(array![3, 4, 0].span(), true)", name) + + \ No newline at end of file diff --git a/nodegen/node/softmax.py b/nodegen/node/softmax.py index 9e5ee99c1..6b59fae9b 100644 --- a/nodegen/node/softmax.py +++ b/nodegen/node/softmax.py @@ -11,33 +11,59 @@ def softmax(x: np.ndarray, axis: int = -1) -> np.ndarray: class Softmax(RunAll): + + @staticmethod + def axis_0(): + x = np.abs(np.random.randn(3, 4, 5).astype(np.float32)) + y = softmax(x, axis=0) + x = Tensor(Dtype.FP16x16, x.shape, to_fp( + x.flatten(), FixedImpl.FP16x16)) + y = Tensor(Dtype.FP16x16, y.shape, to_fp( + y.flatten(), FixedImpl.FP16x16)) + name = "softmax_axis_0" + make_test([x], y, "NNTrait::softmax(@input_0, Option::Some(0))", + name, Trait.NN) + @staticmethod - def fp8x23(): - x = np.random.uniform(-3, 3, (2, 2)).astype(np.float64) - y = softmax(x, 0) - - x = Tensor(Dtype.FP8x23, x.shape, to_fp( - x.flatten(), FixedImpl.FP8x23)) - y = Tensor(Dtype.FP8x23, y.shape, to_fp( - y.flatten(), FixedImpl.FP8x23)) + def axis_1(): + x = np.abs(np.random.randn(3, 4, 5).astype(np.float32)) + y = softmax(x, axis=1) - name = "softmax_fp8x23" - make_test([x], y, "NNTrait::softmax(@input_0, 0)", - name, Trait.NN) + x = Tensor(Dtype.FP16x16, x.shape, to_fp( + x.flatten(), FixedImpl.FP16x16)) + y = Tensor(Dtype.FP16x16, y.shape, to_fp( + y.flatten(), FixedImpl.FP16x16)) + name = "softmax_axis_1" + make_test([x], y, "NNTrait::softmax(@input_0, Option::Some(1))", + name, Trait.NN) + @staticmethod - def fp16x16(): - x = np.random.uniform(-3, 3, (2, 2)).astype(np.float64) - y = softmax(x, 1) + def axis_2(): + x = np.abs(np.random.randn(3, 4, 5).astype(np.float32)) + y = softmax(x, axis=2) x = Tensor(Dtype.FP16x16, x.shape, to_fp( x.flatten(), FixedImpl.FP16x16)) y = Tensor(Dtype.FP16x16, y.shape, to_fp( y.flatten(), FixedImpl.FP16x16)) - name = "softmax_fp16x16" - make_test([x], y, "NNTrait::softmax(@input_0, 1)", - name, Trait.NN) + name = "softmax_axis_2" + make_test([x], y, "NNTrait::softmax(@input_0, Option::Some(2))", + name, Trait.NN) + + @staticmethod + def axis_minus_1(): + x = np.abs(np.random.randn(3, 4, 5).astype(np.float32)) + y = softmax(x, axis=-1) + + x = Tensor(Dtype.FP16x16, x.shape, to_fp( + x.flatten(), FixedImpl.FP16x16)) + y = Tensor(Dtype.FP16x16, y.shape, to_fp( + y.flatten(), FixedImpl.FP16x16)) + name = "softmax_axis_minus_1" + make_test([x], y, "NNTrait::softmax(@input_0, Option::None)", + name, Trait.NN) diff --git a/src/operators/ml.cairo b/src/operators/ml.cairo index 08e9e40fb..93a0394a6 100644 --- a/src/operators/ml.cairo +++ b/src/operators/ml.cairo @@ -3,6 +3,8 @@ mod linear; mod svm; mod normalizer; +use orion::operators::ml::tree_ensemble::tree_ensemble::{TreeEnsembleTrait}; + use orion::operators::ml::tree_ensemble::core::{ TreeEnsemble, TreeEnsembleAttributes, TreeEnsembleImpl, NODE_MODES }; @@ -32,3 +34,4 @@ enum POST_TRANSFORM { SOFTMAXZERO, PROBIT, } + diff --git a/src/operators/ml/linear/linear_classifier.cairo b/src/operators/ml/linear/linear_classifier.cairo index 000179e36..003cf742b 100644 --- a/src/operators/ml/linear/linear_classifier.cairo +++ b/src/operators/ml/linear/linear_classifier.cairo @@ -185,7 +185,7 @@ impl LinearClassifierImpl< // Post Transform scores = match classifier.post_transform { POST_TRANSFORM::NONE => { scores }, - POST_TRANSFORM::SOFTMAX => { NNTrait::softmax(@scores, 1) }, + POST_TRANSFORM::SOFTMAX => { NNTrait::softmax(@scores, Option::Some(1)) }, POST_TRANSFORM::LOGISTIC => { NNTrait::sigmoid(@scores) }, POST_TRANSFORM::SOFTMAXZERO => { NNTrait::softmax_zero(@scores, 1) }, POST_TRANSFORM::PROBIT => core::panic_with_felt252('Probit not supported yet'), @@ -197,7 +197,9 @@ impl LinearClassifierImpl< let mut labels = scores.argmax(1, Option::None, Option::None); loop { match labels.data.pop_front() { - Option::Some(i) => { labels_list.append(*classlabels[*i]); }, + Option::Some(i) => { + labels_list.append(*classlabels[(*i).try_into().unwrap()]); + }, Option::None => { break; } }; }; @@ -205,48 +207,56 @@ impl LinearClassifierImpl< let mut i = 0; match classifier.post_transform { POST_TRANSFORM::NONE => { - while i != scores.data.len() { - if *scores.data.at(i) >= NumberTrait::zero() { - labels_list.append(*classlabels[0]); - } else { - labels_list.append(0); - } + while i != scores + .data + .len() { + if *scores.data.at(i) >= NumberTrait::zero() { + labels_list.append(*classlabels[0]); + } else { + labels_list.append(0); + } - i += 1; - }; + i += 1; + }; }, POST_TRANSFORM::SOFTMAX => { - while i != scores.data.len() { - if *scores.data.at(i) >= NumberTrait::half() { - labels_list.append(*classlabels[0]); - } else { - labels_list.append(0); - } + while i != scores + .data + .len() { + if *scores.data.at(i) >= NumberTrait::half() { + labels_list.append(*classlabels[0]); + } else { + labels_list.append(0); + } - i += 1; - }; + i += 1; + }; }, POST_TRANSFORM::LOGISTIC => { - while i != scores.data.len() { - if *scores.data.at(i) >= NumberTrait::half() { - labels_list.append(*classlabels[0]); - } else { - labels_list.append(0); - } + while i != scores + .data + .len() { + if *scores.data.at(i) >= NumberTrait::half() { + labels_list.append(*classlabels[0]); + } else { + labels_list.append(0); + } - i += 1; - }; + i += 1; + }; }, POST_TRANSFORM::SOFTMAXZERO => { - while i != scores.data.len() { - if *scores.data.at(i) >= NumberTrait::half() { - labels_list.append(*classlabels[0]); - } else { - labels_list.append(0); - } + while i != scores + .data + .len() { + if *scores.data.at(i) >= NumberTrait::half() { + labels_list.append(*classlabels[0]); + } else { + labels_list.append(0); + } - i += 1; - }; + i += 1; + }; }, POST_TRANSFORM::PROBIT => core::panic_with_felt252('Probit not supported yet'), }; diff --git a/src/operators/ml/linear/linear_regressor.cairo b/src/operators/ml/linear/linear_regressor.cairo index d15f55f89..cff0eeacb 100644 --- a/src/operators/ml/linear/linear_regressor.cairo +++ b/src/operators/ml/linear/linear_regressor.cairo @@ -206,7 +206,7 @@ impl LinearRegressorImpl< // Post Transform let score = match regressor.post_transform { POST_TRANSFORM::NONE => score, // No action required - POST_TRANSFORM::SOFTMAX => NNTrait::softmax(@score, 1), + POST_TRANSFORM::SOFTMAX => NNTrait::softmax(@score, Option::Some(1)), POST_TRANSFORM::LOGISTIC => NNTrait::sigmoid(@score), POST_TRANSFORM::SOFTMAXZERO => NNTrait::softmax_zero(@score, 1), POST_TRANSFORM::PROBIT => core::panic_with_felt252('Probit not supported yet'), diff --git a/src/operators/ml/svm/svm_classifier.cairo b/src/operators/ml/svm/svm_classifier.cairo index 8dacddfc0..4df3d63f6 100644 --- a/src/operators/ml/svm/svm_classifier.cairo +++ b/src/operators/ml/svm/svm_classifier.cairo @@ -680,7 +680,7 @@ fn write_scores< let new_scores = if n_classes >= 2 { let new_scores = match post_transform { POST_TRANSFORM::NONE => scores, - POST_TRANSFORM::SOFTMAX => NNTrait::softmax(@scores, 0), + POST_TRANSFORM::SOFTMAX => NNTrait::softmax(@scores, Option::Some(0)), POST_TRANSFORM::LOGISTIC => NNTrait::sigmoid(@scores), POST_TRANSFORM::SOFTMAXZERO => NNTrait::softmax_zero(@scores, 0), POST_TRANSFORM::PROBIT => core::panic_with_felt252('Probit not supported yet'), @@ -716,7 +716,7 @@ fn write_scores< @TensorTrait::new( array![2].span(), array![-*scores.data.at(0), *scores.data.at(0)].span() ), - 0 + Option::Some(0) ) } else { TensorTrait::new(array![1].span(), array![*scores.data.at(0)].span()) diff --git a/src/operators/ml/svm/svm_regressor.cairo b/src/operators/ml/svm/svm_regressor.cairo index d69e40d80..1d5858a2f 100644 --- a/src/operators/ml/svm/svm_regressor.cairo +++ b/src/operators/ml/svm/svm_regressor.cairo @@ -229,7 +229,7 @@ impl SVMRegressorImpl< score = match self.post_transform { POST_TRANSFORM::NONE => score, - POST_TRANSFORM::SOFTMAX => NNTrait::softmax(@score, 1), + POST_TRANSFORM::SOFTMAX => NNTrait::softmax(@score, Option::Some(1)), POST_TRANSFORM::LOGISTIC => NNTrait::sigmoid(@score), POST_TRANSFORM::SOFTMAXZERO => NNTrait::softmax_zero(@score, 1), POST_TRANSFORM::PROBIT => core::panic_with_felt252('Probit not supported yet'), diff --git a/src/operators/ml/tree_ensemble.cairo b/src/operators/ml/tree_ensemble.cairo index 32c96c0bd..925c1ea7e 100644 --- a/src/operators/ml/tree_ensemble.cairo +++ b/src/operators/ml/tree_ensemble.cairo @@ -1,3 +1,4 @@ mod core; mod tree_ensemble_classifier; mod tree_ensemble_regressor; +mod tree_ensemble; diff --git a/src/operators/ml/tree_ensemble/tree_ensemble.cairo b/src/operators/ml/tree_ensemble/tree_ensemble.cairo new file mode 100644 index 000000000..51e3f9ec2 --- /dev/null +++ b/src/operators/ml/tree_ensemble/tree_ensemble.cairo @@ -0,0 +1,602 @@ +use orion::operators::tensor::{Tensor, TensorTrait}; +use orion::numbers::NumberTrait; + +use orion::operators::matrix::{MutMatrix, MutMatrixImpl, MutMatrixTrait}; + +#[derive(Copy, Drop)] +enum AGGREGATE_FUNCTION { + AVERAGE, + SUM, + MIN, + MAX, +} + +#[derive(Copy, Drop)] +enum POST_TRANSFORM { + NONE, + SOFTMAX, + LOGISTIC, + SOFTMAX_ZERO, + PROBIT, +} + +#[derive(Copy, Drop)] +enum NODE_MODE { + LEQ, + LT, + GTE, + GT, + EQ, + NEQ, + MEMBER, +} + +/// Trait +/// +/// predict - Returns the regressed values for each input in a batch. +trait TreeEnsembleTrait { + /// # TreeEnsemble::predict + /// + /// ```rust + /// fn predict(X: @Tensor, + /// nodes_splits: Tensor, + /// nodes_featureids: Span, + /// nodes_modes: Span, + /// nodes_truenodeids: Span, + /// nodes_falsenodeids: Span, + /// nodes_trueleafs: Span, + /// nodes_falseleafs: Span, + /// leaf_targetids: Span, + /// leaf_weights: Tensor, + /// tree_roots: Span, + /// post_transform: POST_TRANSFORM, + /// aggregate_function: AGGREGATE_FUNCTION, + /// nodes_hitrates: Option>, + /// nodes_missing_value_tracks_true: Option>, + /// membership_values: Option>, + /// n_targets: usize + /// ) -> MutMatrix::; + /// ``` + /// + /// Tree Ensemble operator. Returns the regressed values for each input in a batch. Inputs have dimensions [N, F] where N is the input batch size and F is the number of input features. Outputs have dimensions [N, num_targets] where N is the batch size and num_targets is the number of targets, which is a configurable attribute. + /// + /// ## Args + /// + /// * `X`: Input 2D tensor. + /// * `nodes_splits`: Thresholds to do the splitting on for each node with mode that is not 'BRANCH_MEMBER'. + /// * `nodes_featureids`: Feature id for each node. + /// * `nodes_modes`: The comparison operation performed by the node. This is encoded as an enumeration of 'NODE_MODE::LEQ', 'NODE_MODE::LT', 'NODE_MODE::GTE', 'NODE_MODE::GT', 'NODE_MODE::EQ', 'NODE_MODE::NEQ', and 'NODE_MODE::MEMBER' + /// * `nodes_truenodeids`: If `nodes_trueleafs` is 0 (false) at an entry, this represents the position of the true branch node. + /// * `nodes_falsenodeids`: If `nodes_falseleafs` is 0 (false) at an entry, this represents the position of the false branch node. + /// * `nodes_trueleafs`: 1 if true branch is leaf for each node and 0 an interior node. + /// * `nodes_falseleafs`: 1 if true branch is leaf for each node and 0 an interior node. + /// * `leaf_targetids`: The index of the target that this leaf contributes to (this must be in range `[0, n_targets)`). + /// * `leaf_weights`: The weight for each leaf. + /// * `tree_roots`: Index into `nodes_*` for the root of each tree. The tree structure is derived from the branching of each node. + /// * `post_transform`: Indicates the transform to apply to the score.One of 'POST_TRANSFORM::NONE', 'POST_TRANSFORM::SOFTMAX', 'POST_TRANSFORM::LOGISTIC', 'POST_TRANSFORM::SOFTMAX_ZERO' or 'POST_TRANSFORM::PROBIT' , + /// * `aggregate_function`: Defines how to aggregate leaf values within a target. One of 'AGGREGATE_FUNCTION::AVERAGE', 'AGGREGATE_FUNCTION::SUM', 'AGGREGATE_FUNCTION::MIN', 'AGGREGATE_FUNCTION::MAX` defaults to 'AGGREGATE_FUNCTION::SUM' + /// * `nodes_hitrates`: Popularity of each node, used for performance and may be omitted. + /// * `nodes_missing_value_tracks_true`: For each node, define whether to follow the true branch (if attribute value is 1) or false branch (if attribute value is 0) in the presence of a NaN input feature. This attribute may be left undefined and the default value is false (0) for all nodes. + /// * `membership_values`: Members to test membership of for each set membership node. List all of the members to test again in the order that the 'BRANCH_MEMBER' mode appears in `node_modes`, delimited by `NaN`s. Will have the same number of sets of values as nodes with mode 'BRANCH_MEMBER'. This may be omitted if the node doesn't contain any 'BRANCH_MEMBER' nodes. + /// * `n_targets`: The total number of targets. + + /// + /// ## Returns + /// + /// * Output of shape [Batch Size, Number of targets] + /// + /// ## Type Constraints + /// + /// `T` must be fixed point + /// + /// ## Examples + /// + /// ```rust + /// use orion::numbers::FP16x16; + /// use orion::operators::tensor::{Tensor, TensorTrait, FP16x16Tensor, U32Tensor}; + /// use orion::operators::ml::{TreeEnsembleTrait,POST_TRANSFORM, AGGREGATE_FUNCTION, NODE_MODE}; + /// use orion::operators::matrix::{MutMatrix, MutMatrixImpl}; + /// use orion::numbers::NumberTrait; + /// + /// fn example_tree_ensemble_one_tree() -> MutMatrix:: { + /// let mut shape = ArrayTrait::::new(); + /// shape.append(3); + /// shape.append(2); + /// + /// let mut data = ArrayTrait::new(); + /// data.append(FP16x16 { mag: 78643, sign: false }); + /// data.append(FP16x16 { mag: 222822, sign: false }); + /// data.append(FP16x16 { mag: 7864, sign: true }); + /// data.append(FP16x16 { mag: 108789, sign: false }); + /// data.append(FP16x16 { mag: 271319, sign: false }); + /// data.append(FP16x16 { mag: 115998, sign: false }); + /// let mut X = TensorTrait::new(shape.span(), data.span()); + /// + /// let mut shape = ArrayTrait::::new(); + /// shape.append(4); + /// + /// let mut data = ArrayTrait::new(); + /// data.append(FP16x16 { mag: 342753, sign: false }); + /// data.append(FP16x16 { mag: 794296, sign: false }); + /// data.append(FP16x16 { mag: 801505, sign: true }); + /// data.append(FP16x16 { mag: 472514, sign: false }); + /// let leaf_weights = TensorTrait::new(shape.span(), data.span()); + /// + /// let mut shape = ArrayTrait::::new(); + /// shape.append(3); + /// + /// let mut data = ArrayTrait::new(); + /// data.append(FP16x16 { mag: 205783, sign: false }); + /// data.append(FP16x16 { mag: 78643, sign: false }); + /// data.append(FP16x16 { mag: 275251, sign: false }); + /// let nodes_splits = TensorTrait::new(shape.span(), data.span()); + /// + /// let membership_values = Option::None; + /// + /// let n_targets = 2; + /// let aggregate_function = AGGREGATE_FUNCTION::SUM; + /// let nodes_missing_value_tracks_true = Option::None; + /// let nodes_hitrates = Option::None; + /// let post_transform = POST_TRANSFORM::NONE; + /// + /// let tree_roots: Span = array![0].span(); + /// let nodes_modes: Span = array![MODE::LEQ, MODE::LEQ, MODE::LEQ].span(); + /// + /// let nodes_featureids: Span = array![0, 0, 0].span(); + /// let nodes_truenodeids: Span = array![1, 0, 1].span(); + /// let nodes_trueleafs: Span = array![0, 1, 1].span(); + /// let nodes_falsenodeids: Span = array![2, 2, 3].span(); + /// let nodes_falseleafs: Span = array![0, 1, 1].span(); + /// let leaf_targetids: Span = array![0, 1, 0, 1].span(); + /// + /// return TreeEnsembleTrait::predict( + /// @X, + /// nodes_splits, + /// nodes_featureids, + /// nodes_modes, + /// nodes_truenodeids, + /// nodes_falsenodeids, + /// nodes_trueleafs, + /// nodes_falseleafs, + /// leaf_targetids, + /// leaf_weights, + /// tree_roots, + /// post_transform, + /// aggregate_function, + /// nodes_hitrates, + /// nodes_missing_value_tracks_true, + /// membership_values, + /// n_targets + /// ); + /// } + /// + /// >>> [[ 5.23 0. ] + /// [ 5.23 0. ] + /// [ 0. 12.12]] + /// ``` + /// + fn predict( + X: @Tensor, + nodes_splits: Tensor, + nodes_featureids: Span, + nodes_modes: Span, + nodes_truenodeids: Span, + nodes_falsenodeids: Span, + nodes_trueleafs: Span, + nodes_falseleafs: Span, + leaf_targetids: Span, + leaf_weights: Tensor, + tree_roots: Span, + post_transform: POST_TRANSFORM, + aggregate_function: AGGREGATE_FUNCTION, + nodes_hitrates: Option>, + nodes_missing_value_tracks_true: Option>, + membership_values: Option>, + n_targets: usize + ) -> MutMatrix::; +} + + +impl TreeEnsembleImpl< + T, + MAG, + +TensorTrait, + +NumberTrait, + +Copy, + +Drop, + +PartialOrd, + +PartialEq, + +Add, + +Div, + +Mul, + +Into, + +AddEq, +> of TreeEnsembleTrait { + fn predict( + X: @Tensor, + nodes_splits: Tensor, + nodes_featureids: Span, + nodes_modes: Span, + nodes_truenodeids: Span, + nodes_falsenodeids: Span, + nodes_trueleafs: Span, + nodes_falseleafs: Span, + leaf_targetids: Span, + leaf_weights: Tensor, + tree_roots: Span, + post_transform: POST_TRANSFORM, + aggregate_function: AGGREGATE_FUNCTION, + nodes_hitrates: Option>, + nodes_missing_value_tracks_true: Option>, + membership_values: Option>, + n_targets: usize + ) -> MutMatrix:: { + let batch_size = *(*X).shape.at(0); + let n_features = *(*X).shape.at(1); + let n_trees = tree_roots.len(); + + let mut set_membership_iter = array![].span(); + let mut map_member_to_nodeid = Default::default(); + + let mut res: MutMatrix = MutMatrixImpl::new(batch_size, n_targets); + + let (nodes_missing_value_tracks_true, nodes_missing_value_tracks_true_flag) = + match nodes_missing_value_tracks_true { + Option::Some(nodes_missing_value_tracks_true) => { + (nodes_missing_value_tracks_true, true) + }, + Option::None => { (array![].span(), false) } + }; + + match membership_values { + Option::Some(membership_values) => { + set_membership_iter = membership_values.data.clone(); + + let mut tree_roots_iter = tree_roots.clone(); + loop { + match tree_roots_iter.pop_front() { + Option::Some(root_index) => { + let root_index = *root_index; + let is_leaf = (*nodes_trueleafs.at(root_index) == 1 + && *nodes_falseleafs.at(root_index) == 1 + && *nodes_truenodeids + .at(root_index) == *nodes_falsenodeids + .at(root_index)); + map_members_to_nodeids( + root_index, + is_leaf, + nodes_modes, + nodes_truenodeids, + nodes_falsenodeids, + nodes_trueleafs, + nodes_falseleafs, + ref set_membership_iter, + ref map_member_to_nodeid, + ); + }, + Option::None => { break; } + } + }; + }, + Option::None => {} + }; + + match aggregate_function { + AGGREGATE_FUNCTION::AVERAGE => { res.set(batch_size, n_targets, NumberTrait::zero()); }, + AGGREGATE_FUNCTION::SUM => { res.set(batch_size, n_targets, NumberTrait::zero()); }, + AGGREGATE_FUNCTION::MIN => { + let mut i = 0; + while i != batch_size { + let mut j = 0; + while j != n_targets { + res.set(i, j, NumberTrait::min_value()); + j += 1; + }; + i += 1; + }; + }, + AGGREGATE_FUNCTION::MAX => { + let mut i = 0; + while i != batch_size { + let mut j = 0; + while j != n_targets { + res.set(i, j, NumberTrait::max_value()); + j += 1; + }; + i += 1; + }; + }, + } + + let mut weights = ArrayTrait::new(); + let mut target_ids = ArrayTrait::new(); + + let mut tree_roots_iter = tree_roots.clone(); + loop { + match tree_roots_iter.pop_front() { + Option::Some(root_index) => { + let root_index = *root_index; + let is_leaf = (*nodes_trueleafs.at(root_index) == 1 + && *nodes_falseleafs.at(root_index) == 1 + && *nodes_truenodeids.at(root_index) == *nodes_falsenodeids.at(root_index)); + + let mut batch_num = 0; + while batch_num != batch_size { + let x_batch = SpanTrait::slice( + (*X).data, batch_num * n_features, n_features + ); + + let (weight, target) = iterate_node( + x_batch, + root_index, + is_leaf, + nodes_splits.data, + nodes_featureids, + nodes_modes, + nodes_truenodeids, + nodes_falsenodeids, + nodes_trueleafs, + nodes_falseleafs, + leaf_targetids, + leaf_weights, + nodes_hitrates, + nodes_missing_value_tracks_true, + nodes_missing_value_tracks_true_flag, + ref map_member_to_nodeid, + ); + weights.append(weight); + target_ids.append(target); + batch_num += 1; + }; + }, + Option::None => { break; } + } + }; + + let weights = weights.span(); + let target_ids = target_ids.span(); + + let mut batch_num = 0; + while batch_num != batch_size { + match aggregate_function { + AGGREGATE_FUNCTION::AVERAGE => { + let mut i = 0; + while i != n_trees { + let index = i * batch_size + batch_num; + res + .set( + batch_num, + *target_ids.at(index), + res.at(batch_num, *target_ids.at(index)) + + *weights.at(index) + / NumberTrait::new_unscaled(n_trees.into(), false) + ); + i += 1; + }; + }, + AGGREGATE_FUNCTION::SUM => { + let mut i = 0; + while i != n_trees { + let index = i * batch_size + batch_num; + res + .set( + batch_num, + *target_ids.at(index), + res.at(batch_num, *target_ids.at(index)) + *weights.at(index) + ); + i += 1; + }; + }, + AGGREGATE_FUNCTION::MIN => { + let mut i = 0; + while i != n_targets { + let val = NumberTrait::min( + res.at(batch_num, *target_ids.at(batch_num)), *weights.at(batch_num) + ); + res.set(batch_num, *target_ids.at(batch_num), val); + i += 1; + }; + }, + AGGREGATE_FUNCTION::MAX => { + let mut i = 0; + while i != n_targets { + let val = NumberTrait::max( + res.at(batch_num, *target_ids.at(batch_num)), *weights.at(batch_num) + ); + res.set(batch_num, *target_ids.at(batch_num), val); + i += 1; + }; + } + } + + batch_num += 1; + }; + + // Post Transform + let mut res = match post_transform { + POST_TRANSFORM::NONE => res, + POST_TRANSFORM::SOFTMAX => res.softmax(1), + POST_TRANSFORM::LOGISTIC => res.sigmoid(), + POST_TRANSFORM::SOFTMAX_ZERO => res.softmax_zero(1), + POST_TRANSFORM::PROBIT => core::panic_with_felt252('Probit not supported yet'), + }; + + return res; + } +} +fn iterate_node< + T, + MAG, + +TensorTrait, + +NumberTrait, + +Copy, + +Drop, + +PartialOrd, + +PartialEq, +>( + X: Span, + current_node_index: usize, + is_leaf: bool, + nodes_splits: Span, + nodes_featureids: Span, + nodes_modes: Span, + nodes_truenodeids: Span, + nodes_falsenodeids: Span, + nodes_trueleafs: Span, + nodes_falseleafs: Span, + leaf_targetids: Span, + leaf_weights: Tensor, + nodes_hitrates: Option>, + nodes_missing_value_tracks_true: Span, + nodes_missing_value_tracks_true_flag: bool, + ref map_member_to_nodeid: Felt252Dict>>, +) -> (T, usize) { + let mut current_node_index = current_node_index; + let mut is_leaf = is_leaf; + + while !is_leaf { + let nmvtt_flag = if nodes_missing_value_tracks_true_flag { + *nodes_missing_value_tracks_true.at(current_node_index) == 1 + } else { + nodes_missing_value_tracks_true_flag + }; + if compare( + *X.at(*nodes_featureids.at(current_node_index)), + current_node_index, + *nodes_splits.at(current_node_index), + *nodes_modes.at(current_node_index), + ref map_member_to_nodeid, + nmvtt_flag + ) { + is_leaf = *nodes_trueleafs.at(current_node_index) == 1; + current_node_index = *nodes_truenodeids.at(current_node_index); + } else { + is_leaf = *nodes_falseleafs.at(current_node_index) == 1; + current_node_index = *nodes_falsenodeids.at(current_node_index); + }; + }; + + return (*leaf_weights.data.at(current_node_index), *leaf_targetids.at(current_node_index)); +} + +fn map_members_to_nodeids< + T, + MAG, + +TensorTrait, + +NumberTrait, + +Copy, + +Drop, + +PartialOrd, + +PartialEq, +>( + current_node_index: usize, + is_leaf: bool, + nodes_modes: Span, + nodes_truenodeids: Span, + nodes_falsenodeids: Span, + nodes_trueleafs: Span, + nodes_falseleafs: Span, + ref set_membership_iter: Span, + ref map_member_to_nodeid: Felt252Dict>>, +) { + let mut current_node_index = current_node_index; + let mut is_leaf = is_leaf; + + if is_leaf { + return; + } + + match *nodes_modes.at(current_node_index) { + NODE_MODE::LEQ => {}, + NODE_MODE::LT => {}, + NODE_MODE::GTE => {}, + NODE_MODE::GT => {}, + NODE_MODE::EQ => {}, + NODE_MODE::NEQ => {}, + NODE_MODE::MEMBER => { + let mut subset_members = ArrayTrait::new(); + loop { + match set_membership_iter.pop_front() { + Option::Some(v) => { + if *v == NumberTrait::NaN() { + break; + } + subset_members.append(*v) + }, + Option::None => { break; } + } + }; + map_member_to_nodeid + .insert(current_node_index.into(), NullableTrait::new(subset_members.span())); + }, + } + // true branch + map_members_to_nodeids( + *nodes_truenodeids.at(current_node_index), + *nodes_trueleafs.at(current_node_index) == 1, + nodes_modes, + nodes_truenodeids, + nodes_falsenodeids, + nodes_trueleafs, + nodes_falseleafs, + ref set_membership_iter, + ref map_member_to_nodeid, + ); + + // false branch + map_members_to_nodeids( + *nodes_falsenodeids.at(current_node_index), + *nodes_falseleafs.at(current_node_index) == 1, + nodes_modes, + nodes_truenodeids, + nodes_falsenodeids, + nodes_trueleafs, + nodes_falseleafs, + ref set_membership_iter, + ref map_member_to_nodeid, + ); +} + + +fn compare< + T, MAG, +TensorTrait, +NumberTrait, +Copy, +Drop, +PartialOrd, +PartialEq +>( + x_feat: T, + current_node_index: usize, + value: T, + mode: NODE_MODE, + ref map_members_to_nodeids: Felt252Dict>>, + nodes_missing_value_tracks_true_flag: bool, +) -> bool { + match mode { + NODE_MODE::LEQ => { + (x_feat <= value && !x_feat.is_nan()) || nodes_missing_value_tracks_true_flag + }, + NODE_MODE::LT => { + (x_feat < value && !x_feat.is_nan()) || nodes_missing_value_tracks_true_flag + }, + NODE_MODE::GTE => { + (x_feat >= value && !x_feat.is_nan()) || nodes_missing_value_tracks_true_flag + }, + NODE_MODE::GT => { + (x_feat > value && !x_feat.is_nan()) || nodes_missing_value_tracks_true_flag + }, + NODE_MODE::EQ => { + (x_feat == value && !x_feat.is_nan()) || nodes_missing_value_tracks_true_flag + }, + NODE_MODE::NEQ => { + (x_feat != value && !x_feat.is_nan()) || nodes_missing_value_tracks_true_flag + }, + NODE_MODE::MEMBER => { + let mut set_members = map_members_to_nodeids.get(current_node_index.into()).deref(); + loop { + match set_members.pop_front() { + Option::Some(v) => { if x_feat == *v { + break true; + } }, + Option::None => { break false; } + } + } + }, + } +} diff --git a/src/operators/nn.cairo b/src/operators/nn.cairo index 625e63216..00e899abd 100644 --- a/src/operators/nn.cairo +++ b/src/operators/nn.cairo @@ -1,6 +1,10 @@ mod core; mod implementations; mod functional; +mod common; +mod helpers; + +use orion::operators::nn::common::{AUTO_PAD, MODE, PADDING_MODE, POOLING_TYPE}; use orion::operators::nn::core::NNTrait; diff --git a/src/operators/nn/common.cairo b/src/operators/nn/common.cairo new file mode 100644 index 000000000..2c20ff794 --- /dev/null +++ b/src/operators/nn/common.cairo @@ -0,0 +1,28 @@ +#[derive(Copy, Drop)] +enum AUTO_PAD { + NOTSET, + SAME_UPPER, + SAME_LOWER, + VALID +} + +#[derive(Copy, Drop)] +enum POOLING_TYPE { + AVG, + LPPOOL, + MAX, +} + +#[derive(Copy, Drop)] +enum MODE { + NEAREST, + LINEAR, + CUBIC, +} + +#[derive(Copy, Drop)] +enum PADDING_MODE { + ZEROS, + BORDER, + REFLECTION, +} diff --git a/src/operators/nn/core.cairo b/src/operators/nn/core.cairo index 752006164..a04a6d1f8 100644 --- a/src/operators/nn/core.cairo +++ b/src/operators/nn/core.cairo @@ -1,4 +1,5 @@ use orion::operators::tensor::core::Tensor; +use orion::operators::nn::{AUTO_PAD, MODE, PADDING_MODE}; /// Trait /// @@ -63,7 +64,7 @@ trait NNTrait { /// # NNTrait::softmax /// /// ```rust - /// fn softmax(tensor: @Tensor, axis: usize) -> Tensor; + /// fn softmax(tensor: @Tensor, axis: Option) -> Tensor; /// ``` /// /// Applies the Softmax function to an n-dimensional input Tensor rescaling them so that the elements of the n-dimensional output Tensor lie in the range \[0,1] and sum to 1. @@ -75,7 +76,7 @@ trait NNTrait { /// ## Args /// /// * `tensor`(`@Tensor`) - The input tensor. - /// * `axis`(`usize`) - The axis along which to compute the softmax. + /// * `axis`(`Option`) - Describes the dimension Softmax will be performed on. Negative value means counting dimensions from the back. Accepted range is [-r, r-1] where r = rank(input). /// /// ## Returns /// @@ -106,14 +107,14 @@ trait NNTrait { /// .span(), /// ); /// - /// return NNTrait::softmax(@tensor, 1); + /// return NNTrait::softmax(@tensor, Option::Some(1)); /// } /// >>> [[2255697,6132911],[2255697,6132911]] /// // The fixed point representation of /// // [[0.2689, 0.7311],[0.2689, 0.7311]] /// ``` /// - fn softmax(tensor: @Tensor, axis: usize) -> Tensor; + fn softmax(tensor: @Tensor, axis: Option) -> Tensor; /// # NNTrait::softmax_zero /// /// ```rust @@ -947,7 +948,7 @@ trait NNTrait { X: @Tensor, W: @Tensor, B: Option>, - auto_pad: Option, + auto_pad: Option, dilations: Option>, group: Option, kernel_shape: Option>, @@ -1087,7 +1088,7 @@ trait NNTrait { X: @Tensor, W: @Tensor, B: Option<@Tensor>, - auto_pad: Option, + auto_pad: Option, dilations: Option>, group: Option, kernel_shape: Option>, @@ -1302,8 +1303,293 @@ trait NNTrait { X: @Tensor, grid: @Tensor, align_corner: Option, - mode: Option, - padding_mode: Option, + mode: Option, + padding_mode: Option, + ) -> Tensor; + /// + /// # NNTrait::max_pool + /// + /// ```rust + /// fn max_pool( + /// X: @Tensor, + /// auto_pad: Option, + /// ceil_mode: Option, + /// dilations: Option>, + /// kernel_shape: Span, + /// pads: Option>, + /// storage_order: Option, + /// strides: Option>, + /// output_len: usize, + /// ) -> (Tensor, Option>); + /// ``` + /// + /// MaxPool consumes an input tensor X and applies max pooling across the tensor according to kernel sizes, stride sizes, and pad lengths. max pooling consisting of computing the max on all values of a subset of the input tensor according to the kernel size and downsampling the data into the output tensor Y for further processing. The output spatial shape is calculated differently depending on whether explicit padding is used, where pads is employed, or auto padding is used, where auto_pad is utilized. + /// + /// ## Args + /// + /// * `X`(`@Tensor`) - Input data tensor from the previous operator; dimensions for image case are (N x C x H x W), where N is the batch size, C is the number of channels, and H and W are the height and the width of the data. For non image case, the dimensions are in the form of (N x C x D1 x D2 ... Dn), where N is the batch size. + /// * `auto_pad`(`Option`) - Default is NOTSET, auto_pad must be either NOTSET, SAME_UPPER, SAME_LOWER or VALID. NOTSET means explicit padding is used. SAME_UPPER or SAME_LOWER mean pad the input so that `output_shape[i] = ceil(input_shape[i] / strides[i])` for each axis `i`. + /// * `ceil_mode`(`Option`) - Default is 1, Whether to use ceil or floor (default) to compute the output shape. + /// * `dilations`(`Option>`) - Dilation value along each spatial axis of the filter. If not present, the dilation defaults to 1 along each spatial axis. + /// * `kernel_shape`(`Span`) - The size of the kernel along each axis. + /// * `pads`(`Option>`) - Padding for the beginning and ending along each spatial axis, it can take any value greater than or equal to 0. The value represent the number of pixels added to the beginning and end part of the corresponding axis. `pads` format should be as follow [x1_begin, x2_begin...x1_end, x2_end,...], where xi_begin the number of pixels added at the beginning of axis `i` and xi_end, the number of pixels added at the end of axis `i`. This attribute cannot be used simultaneously with auto_pad attribute. If not present, the padding defaults to 0 along start and end of each spatial axis. + /// * `storage_order`(`Option`) - Default is 0, The storage order of the tensor. 0 is row major, and 1 is column major. + /// * `strides`(`Option>`) - Stride along each spatial axis. If not present, the stride defaults to 1 along each spatial axis. + /// * `output_len`(`Option`) - Default is 1, If set to 2, return the indices tensor. + /// + /// ## Returns + /// + /// A `Tensor` that contains the result of the max pool. + /// A `Option>` with the indices tensor from max pooling across the input tensor. The dimensions of indices are the same as output tensor. + /// ## Examples + /// + /// ```rust + /// use orion::operators::nn::NNTrait; + /// use orion::numbers::FixedTrait; + /// use orion::operators::nn::FP16x16NN; + /// use orion::numbers::FP16x16; + /// use orion::operators::tensor::{Tensor, TensorTrait, FP16x16Tensor}; + /// + /// + /// fn example_max_pool() -> (Tensor, Option>) { + /// let mut shape = ArrayTrait::::new(); + /// shape.append(1); + /// shape.append(1); + /// shape.append(5); + /// shape.append(5); + /// let mut data = ArrayTrait::new(); + /// data.append(FP16x16 { mag: 65536, sign: false }); + /// data.append(FP16x16 { mag: 131072, sign: false }); + /// data.append(FP16x16 { mag: 196608, sign: false }); + /// data.append(FP16x16 { mag: 262144, sign: false }); + /// data.append(FP16x16 { mag: 327680, sign: false }); + /// data.append(FP16x16 { mag: 393216, sign: false }); + /// data.append(FP16x16 { mag: 458752, sign: false }); + /// data.append(FP16x16 { mag: 524288, sign: false }); + /// data.append(FP16x16 { mag: 589824, sign: false }); + /// data.append(FP16x16 { mag: 655360, sign: false }); + /// data.append(FP16x16 { mag: 720896, sign: false }); + /// data.append(FP16x16 { mag: 786432, sign: false }); + /// data.append(FP16x16 { mag: 851968, sign: false }); + /// data.append(FP16x16 { mag: 917504, sign: false }); + /// data.append(FP16x16 { mag: 983040, sign: false }); + /// data.append(FP16x16 { mag: 1048576, sign: false }); + /// data.append(FP16x16 { mag: 1114112, sign: false }); + /// data.append(FP16x16 { mag: 1179648, sign: false }); + /// data.append(FP16x16 { mag: 1245184, sign: false }); + /// data.append(FP16x16 { mag: 1310720, sign: false }); + /// data.append(FP16x16 { mag: 1376256, sign: false }); + /// data.append(FP16x16 { mag: 1441792, sign: false }); + /// data.append(FP16x16 { mag: 1507328, sign: false }); + /// data.append(FP16x16 { mag: 1572864, sign: false }); + /// data.append(FP16x16 { mag: 1638400, sign: false }); + /// let mut X = TensorTrait::new(shape.span(), data.span()); + /// return NNTrait::max_pool( + /// @X, + /// Option::None, + /// Option::None, + /// Option::None, + /// array![5, 5, 5].span(), + /// Option::Some(array![2, 2, 2, 2].span()), + /// Option::None, + /// Option::None, + /// 1 + /// ); + /// + /// } + /// + /// >>> ([ + /// [ + /// [ + /// [13, 14, 15, 15, 15], + /// [18, 19, 20, 20, 20], + /// [23, 24, 25, 25, 25], + /// [23, 24, 25, 25, 25], + /// [23, 24, 25, 25, 25], + /// ] + /// ] + /// ], + /// Option::None) + /// + /// + /// ```` + /// + + fn max_pool( + X: @Tensor, + auto_pad: Option, + ceil_mode: Option, + dilations: Option>, + kernel_shape: Span, + pads: Option>, + storage_order: Option, + strides: Option>, + output_len: usize, + ) -> (Tensor, Option>); + /// # NNTrait::deform_conv + /// + /// ```rust + /// fn deform_conv( + /// X: @Tensor, + /// W: @Tensor, + /// offset: @Tensor, + /// B: Option>, + /// mask: Option>, + /// dilations: Option>, + /// group: Option, + /// kernel_shape: Option>, + /// offset_group: Option, + /// pads: Option>, + /// strides: Option>, + /// ) -> Tensor + /// ``` + /// + /// Performs deformable convolution as described in https://arxiv.org/abs/1703.06211 and https://arxiv.org/abs/1811.11168. This operator specification supports the 2-D case. + /// + /// ## Args + /// + /// X: @Tensor, + /// W: @Tensor, + /// offset: @Tensor, + /// B: Option>, + /// mask: Option>, + /// dilations: Option>, + /// group: Option, + /// kernel_shape: Option>, + /// offset_group: Option, + /// pads: Option>, + /// strides: Option>, + /// + /// * `X`(`@Tensor`) - Input data tensor. For 2D image data, it has shape (N, C, H, W) where N is the batch size, C is the number of input channels, and H and W are the height and width. + /// * `W`(`@Tensor`) - Weight tensor that will be used in the convolutions. It has shape (oC, C/group, kH, kW), where oC is the number of output channels and kH and kW are the kernel height and width. + /// * `offset`(`@Tensor`) - Offset tensor denoting the offset for the sampling locations in the convolution kernel. It has shape (N, offset_group * kH * kW * 2, oH, oW) for 2D data + /// * `B`(`Option>`) - Default is a tensor of zeros, optional 1D bias of length oC to be added to the convolution. + /// * `mask`(`Option>`) - Default is a tensor of ones, the mask tensor to be applied to each position in the convolution kernel. It has shape (N, offset_group * kH * kW, oH, oW) for 2D data. + /// * `dilations`(`Option>`) - Default is 1 along each axis, dilation value along each spatial axis of the kernel. + /// * `group`(`usize`) - Default is 1, number of groups the input and output channels, C and oC, are divided into. + /// * `kernel_shape`(`Option>`) - Shape of the convolution kernel. If not present, it is inferred from the shape of input W. + /// * `offset_group`(`Option`) - Default is 1, number of groups of offset. C must be divisible by offset_group. + /// * `pads`(`Option>`) - Default is 0 along each axis, padding for the beginning and end along each spatial axis. The values represent the number of pixels added to the beginning and end of the corresponding axis and can take any nonnegative value. + /// * `strides`(`Option>`) - Default is 1 along each axis, stride along each spatial axis. + /// + /// ## Returns + /// + /// A `Tensor` output tensor that contains the result of convolution. + /// + /// ## Examples + /// + /// ```rust + /// fn example_deform_conv() -> Tensor { + /// let mut shape = ArrayTrait::::new(); + /// shape.append(1); + /// shape.append(1); + /// shape.append(3); + /// shape.append(3); + /// + /// let mut data = ArrayTrait::new(); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 65536, sign: false }); + /// data.append(FP16x16 { mag: 131072, sign: false }); + /// data.append(FP16x16 { mag: 196608, sign: false }); + /// data.append(FP16x16 { mag: 262144, sign: false }); + /// data.append(FP16x16 { mag: 327680, sign: false }); + /// data.append(FP16x16 { mag: 393216, sign: false }); + /// data.append(FP16x16 { mag: 458752, sign: false }); + /// data.append(FP16x16 { mag: 524288, sign: false }); + /// let mut X = TensorTrait::new(shape.span(), data.span()); + /// + /// let mut shape = ArrayTrait::::new(); + /// shape.append(1); + /// shape.append(1); + /// shape.append(2); + /// shape.append(2); + /// + /// let mut data = ArrayTrait::new(); + /// data.append(FP16x16 { mag: 65536, sign: false }); + /// data.append(FP16x16 { mag: 65536, sign: false }); + /// data.append(FP16x16 { mag: 65536, sign: false }); + /// data.append(FP16x16 { mag: 65536, sign: false }); + /// let mut W = TensorTrait::new(shape.span(), data.span()); + /// + /// let mut shape = ArrayTrait::::new(); + /// shape.append(1); + /// shape.append(8); + /// shape.append(2); + /// shape.append(2); + /// + /// let mut data = ArrayTrait::new(); + /// data.append(FP16x16 { mag: 32768, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 6553, sign: true }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// data.append(FP16x16 { mag: 0, sign: false }); + /// let mut offset = TensorTrait::new(shape.span(), data.span()); + /// + /// + /// return NNTrait::deform_conv( + /// @X, + /// @W, + /// @offset, + /// Option::None, + /// Option::None, + /// Option::None, + /// Option::None, + /// Option::Some(array![2, 2].span()), + /// Option::None, + /// Option::Some(array![0, 0, 0, 0].span()), + /// Option::None, + /// ); + /// } + /// + /// >>> [ + /// [ + /// [ + /// [9.5, 11.9], + /// [20.0, 24.0], + /// ] + /// ] + /// ] + /// + /// ```` + fn deform_conv( + X: @Tensor, + W: @Tensor, + offset: @Tensor, + B: Option>, + mask: Option>, + dilations: Option>, + group: Option, + kernel_shape: Option>, + offset_group: Option, + pads: Option>, + strides: Option>, ) -> Tensor; /// # tensor.conv_integer /// diff --git a/src/operators/nn/functional.cairo b/src/operators/nn/functional.cairo index 31a1a17cc..ad7700dd3 100644 --- a/src/operators/nn/functional.cairo +++ b/src/operators/nn/functional.cairo @@ -17,3 +17,6 @@ mod depth_to_space; mod space_to_depth; mod conv; mod conv_integer; +mod max_pool; +mod common_pool; +mod deform_conv; diff --git a/src/operators/nn/functional/col2im.cairo b/src/operators/nn/functional/col2im.cairo index 824aeb7f4..87bdaae3a 100644 --- a/src/operators/nn/functional/col2im.cairo +++ b/src/operators/nn/functional/col2im.cairo @@ -1,10 +1,10 @@ use orion::numbers::NumberTrait; -use orion::operators::tensor::core::{stride}; +use orion::operators::tensor::core::{stride, unravel_index}; use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor,}; use orion::operators::vec::{NullableVec, NullableVecImpl}; +use orion::operators::nn::helpers::{is_out, prod}; -/// Cf: NNTrait::col2im docstring -fn col2im, +NumberTrait, +Copy, +Drop, +Add, +Mul,>( +fn col2im, +NumberTrait, +Copy, +Drop, +Add, +Mul, +MulEq,>( data: @Tensor, image_shape: Span, block_shape: Span, @@ -54,46 +54,56 @@ fn col2im, +NumberTrait, +Copy, +Drop, +Ad }, }; - let bl = prod(block_shape, 0); + let bl = prod(block_shape); let C = *(*data).shape.at(1) / bl; - let mut new_shape = array![*(*data).shape.at(0), C, bl]; + let mut new_shape: Array = array![ + (*(*data).shape.at(0)).try_into().unwrap(), C.try_into().unwrap(), bl.try_into().unwrap() + ]; let mut i = 2; - while i != (*data).shape.len() { - new_shape.append(*(*data).shape.at(i)); - i += 1; - }; + while i != (*data) + .shape + .len() { + new_shape.append((*(*data).shape.at(i)).try_into().unwrap()); + i += 1; + }; - let data = data.reshape(new_shape.span()); + let data = data.reshape(new_shape.span(), false); let mut res: Array = array![]; let data_stride = stride(data.shape); let mut n = 0; - while n != *data.shape.at(0) { - let mut c = 0; - while c != *data.shape.at(1) { - let data_n_c = TensorTrait::new( - SpanTrait::slice(data.shape, 2, data.shape.len() - 2), - SpanTrait::slice( - data.data, n * *data_stride.at(0) + c * *data_stride.at(1), *data_stride.at(1) - ) - ); - let mut out = col2im_naive_implementation( - @data_n_c, image_shape, block_shape, dilations, pads, strides - ); - let mut i = 0; - while i != out.len() { - res.append(out.at(i)); - i += 1; - }; + while n != *data + .shape + .at(0) { + let mut c = 0; + while c != *data + .shape + .at(1) { + let data_n_c = TensorTrait::new( + SpanTrait::slice(data.shape, 2, data.shape.len() - 2), + SpanTrait::slice( + data.data, + n * *data_stride.at(0) + c * *data_stride.at(1), + *data_stride.at(1) + ) + ); + let mut out = col2im_naive_implementation( + @data_n_c, image_shape, block_shape, dilations, pads, strides + ); + let mut i = 0; + while i != out.len() { + res.append(out.at(i)); + i += 1; + }; + + c += 1; + }; - c += 1; + n += 1; }; - n += 1; - }; - let mut new_shape = array![*data.shape.at(0), *data.shape.at(1)]; let mut i = 0; while i != image_shape.len() { @@ -149,15 +159,15 @@ fn col2im_naive_implementation< let mut data_im = NullableVecImpl::new(); data_im.set(*image_shape.at(0) * *stride_img.at(0) - 1, NumberTrait::zero()); - let kernel_size = prod(kernel_shape, 0); - let col_size = prod(dim_col, 0); + let kernel_size = prod(kernel_shape); + let col_size = prod(dim_col); let mut c_col = 0; while c_col != kernel_size { - let offset = get_indices(c_col, kernel_shape).span(); + let offset = unravel_index(c_col, kernel_shape); let mut col = 0; while col != col_size { - let ind_col = get_indices(col, dim_col).span(); + let ind_col = unravel_index(col, dim_col); let mut ind_im: Array = array![]; let mut i = 0; while i != n_dims { @@ -209,7 +219,7 @@ fn col2im_shape_check, +Copy, +Drop,>( ) { let n_input_plane = *(*X).shape.at(0); - let kernel_size = prod(kernel_shape, 0); + let kernel_size = prod(kernel_shape); assert(n_input_plane % kernel_size == 0, 'wrong input dimension'); @@ -231,7 +241,7 @@ fn col2im_shape_check, +Copy, +Drop,>( i += 1; }; - let block_size = prod(n_blocks.span(), 0); + let block_size = prod(n_blocks.span()); assert(input_length == block_size, 'input_length != block_size'); } @@ -258,36 +268,3 @@ fn get_indices(index: usize, shape: Span,) -> Array { new_res } - -fn is_out(ind: Span, shape: Span,) -> bool { - let mut n = 0; - let is_out = loop { - if n == ind.len() { - break false; - } - let s = *shape.at(n); - let i = *ind.at(n); - if i < 0 { - break true; - } - if i >= s { - break true; - } - n += 1; - }; - - is_out -} - -fn prod, +Copy, +NumberTrait, +TensorTrait, +Mul,>( - pA: Span, start: usize -) -> T { - let mut i = start; - let mut prod = NumberTrait::one(); - while i != pA.len() { - prod = prod * (*pA.at(i)); - i += 1; - }; - - prod -} diff --git a/src/operators/nn/functional/common_pool.cairo b/src/operators/nn/functional/common_pool.cairo new file mode 100644 index 000000000..70bde406a --- /dev/null +++ b/src/operators/nn/functional/common_pool.cairo @@ -0,0 +1,942 @@ +use core::clone::Clone; +use core::option::OptionTrait; +use core::array::ArrayTrait; +use orion::numbers::NumberTrait; +use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor, I32Tensor}; +use orion::operators::vec::{NullableVec, NullableVecImpl}; +use orion::operators::tensor::core::{stride}; +use core::debug::PrintTrait; +use core::traits::Into; +use orion::numbers::{U32IntoI32, I32IntoU32, I32Div, I32Number}; +use orion::numbers::FP16x16; +use orion::operators::nn::{AUTO_PAD, POOLING_TYPE}; + +fn common_pool< + T, + MAG, + +TensorTrait, + +NumberTrait, + +Copy, + +Drop, + +Add, + +Mul, + +Sub, + +Div, + +AddEq, + +PrintTrait, + +PartialOrd, + +PartialEq, + +TryInto, + +Into, + +Rem, + +Neg, + +SubEq, +>( + pooling_type: POOLING_TYPE, + count_include_pad: usize, + X: @Tensor, + auto_pad: Option, + ceil_mode: Option, + dilations: Option>, + kernel_shape: Span, + pads: Option>, + strides: Option>, + p: usize, +) -> (Tensor, Option>) { + let padding_value: T = match pooling_type { + POOLING_TYPE::AVG => { + let padding_value = if count_include_pad == 0 { + NumberTrait::min_value() + } else { + NumberTrait::zero() + }; + padding_value + }, + POOLING_TYPE::LPPOOL => { + let padding_value = if count_include_pad == 0 { + NumberTrait::min_value() + } else { + NumberTrait::zero() + }; + padding_value + }, + POOLING_TYPE::MAX => { NumberTrait::min_value() }, + }; + + let ceil_mode = match ceil_mode { + Option::Some(ceil_mode) => { ceil_mode }, + Option::None => { 0 }, + }; + + let auto_pad = match auto_pad { + Option::Some(auto_pad) => auto_pad, + Option::None => AUTO_PAD::NOTSET, + }; + + let (out_shape, pads, padded) = match auto_pad { + AUTO_PAD::NOTSET => { + let (out_shape, pads) = get_output_shape_explicit_padding( + pads, + SpanTrait::slice((*X).shape, 2, (*X).shape.len() - 2), + kernel_shape, + strides, + dilations, + ceil_mode + ); + let padded = pad_constant_value(X, padding_value, pads); + (out_shape, pads, padded) + }, + AUTO_PAD::SAME_UPPER => { + assert(ceil_mode == 0, 'ceil mode not supp with autopad'); + let out_shape = get_output_shape_auto_pad( + auto_pad, + SpanTrait::slice((*X).shape, 2, (*X).shape.len() - 2), + kernel_shape, + strides + ); + let pads_shape = get_pad_shape( + auto_pad, + SpanTrait::slice((*X).shape, 2, (*X).shape.len() - 2), + kernel_shape, + strides, + out_shape + ); + + let pads = get_pad_with_auto_pad(auto_pad, pads_shape); + + let padded = pad_constant_value(X, padding_value, pads); + (out_shape, pads, padded) + }, + AUTO_PAD::SAME_LOWER => { + assert(ceil_mode == 0, 'ceil mode not supp with autopad'); + let out_shape = get_output_shape_auto_pad( + auto_pad, + SpanTrait::slice((*X).shape, 2, (*X).shape.len() - 2), + kernel_shape, + strides + ); + let pads_shape = get_pad_shape( + auto_pad, + SpanTrait::slice((*X).shape, 2, (*X).shape.len() - 2), + kernel_shape, + strides, + out_shape + ); + + let pads = get_pad_with_auto_pad(auto_pad, pads_shape); + + let padded = pad_constant_value(X, padding_value, pads); + (out_shape, pads, padded) + }, + AUTO_PAD::VALID => { + assert(ceil_mode == 0, 'ceil mode not supp with autopad'); + let out_shape = get_output_shape_auto_pad( + auto_pad, + SpanTrait::slice((*X).shape, 2, (*X).shape.len() - 2), + kernel_shape, + strides + ); + let pads_shape = get_pad_shape( + auto_pad, + SpanTrait::slice((*X).shape, 2, (*X).shape.len() - 2), + kernel_shape, + strides, + out_shape + ); + + let pads = get_pad_with_auto_pad(auto_pad, pads_shape); + + let padded = pad_constant_value(X, padding_value, pads); + (out_shape, pads, padded) + }, + }; + + return ( + pool( + @padded, + (*X).shape, + kernel_shape, + strides, + out_shape, + pooling_type, + pads, + dilations, + count_include_pad, + p, + ), + Option::None + ); +} + + +fn pool< + T, + MAG, + +TensorTrait, + +NumberTrait, + +Copy, + +Drop, + +Add, + +Mul, + +Sub, + +Div, + +AddEq, + +PrintTrait, + +PartialOrd, + +PartialEq, + +TryInto, + +Into, + +Rem, + +Neg, + +SubEq, +>( + padded: @Tensor, + x_shape: Span, + kernel: Span, + strides: Option>, + out_shape: Span, + pooling_type: POOLING_TYPE, + pads: Span, + dilations: Option>, + count_include_pad: usize, + p: usize, +) -> Tensor { + let n_dims = x_shape.len() - 2; + let mut y = NullableVecImpl::new(); + + let dilations = match dilations { + Option::Some(dilations) => dilations, + Option::None => { + let mut dilations = ArrayTrait::new(); + let mut i = 0; + loop { + if i == n_dims { + break; + } + dilations.append(1); + i += 1; + }; + dilations.span() + }, + }; + + let strides = match strides { + Option::Some(strides) => strides, + Option::None => { + let mut strides = ArrayTrait::new(); + let mut i = 0; + loop { + if i == n_dims { + break; + } + strides.append(1); + i += 1; + }; + strides.span() + }, + }; + let mut y_shape = array![*x_shape.at(0), *x_shape.at(1)]; + let mut i = 0; + loop { + if i == n_dims { + break; + } + let a: T = NumberTrait::new_unscaled( + (*x_shape.at(i + 2) + *pads.at(i) + *pads.at(i + n_dims)).into(), false + ); + let b: T = NumberTrait::new_unscaled( + ((1 + (*kernel.at(i) - 1) * *dilations.at(i))).into(), false + ); + let c: T = NumberTrait::new_unscaled((*strides.at(i)).into(), false); + y_shape.append(NumberTrait::floor(((a - b) / c + NumberTrait::one())).try_into().unwrap()); + i += 1; + }; + let y_stride = stride(y_shape.span()); + let padded_stride = stride(*padded.shape); + let mut all_coords = get_all_coords(y_shape.span()); + + loop { + match all_coords.pop_front() { + Option::Some(coord) => { + let coord = *coord; + let window = SpanTrait::slice( + *padded.data, + *coord.at(0) * *padded_stride.at(0) + *coord.at(1) * *padded_stride.at(1), + *padded_stride.at(1) + ); + let window_stride = SpanTrait::slice(padded_stride, 2, n_dims); + let mut window_vals = ArrayTrait::new(); + + let mut all_indices = ArrayTrait::new(); + + let mut i = 0; + loop { + if i == n_dims { + break; + } + let start = *strides.at(i) * *coord.at(i + 2); + let end = start + 1 + (*kernel.at(i) - 1) * *dilations.at(i); + let step = *dilations.at(i); + + all_indices.append(arange(start, end, step)); + + i += 1; + }; + + let mut all_indices = cartesian(all_indices.span()); + + loop { + match all_indices.pop_front() { + Option::Some(index) => { + let flatten_index = flatten_index((*index), window_stride); + + window_vals.append(*window.at(flatten_index)); + }, + Option::None => { break; } + } + }; + match pooling_type { + POOLING_TYPE::AVG => { + let flatten_index = flatten_index(coord, y_stride); + + if count_include_pad == 1 { + y.set(flatten_index, average(window_vals.span())); + } else { + y.set(flatten_index, average(window_vals.span())); + } + }, + POOLING_TYPE::LPPOOL => { panic(array!['supported soon']) }, + POOLING_TYPE::MAX => { + let flatten_index = flatten_index(coord, y_stride); + + y.set(flatten_index, max(window_vals.span())); + } + } + }, + Option::None => { break; }, + } + }; + let mut y_data = ArrayTrait::new(); + let mut i = 0; + loop { + if i == y.len() { + break; + } + y_data.append(y.at(i)); + i += 1; + }; + return TensorTrait::new(y_shape.span(), y_data.span()); +} + +fn get_output_shape_auto_pad( + auto_pad: AUTO_PAD, + input_spatial_shape: Span, + kernel_spatial_shape: Span, + strides_spatial: Option>, +) -> Span { + let n_dims = input_spatial_shape.len(); + let mut out_shape = ArrayTrait::new(); + + let strides_spatial = match strides_spatial { + Option::Some(strides_spatial) => strides_spatial, + Option::None => { + let mut strides_spatial = ArrayTrait::new(); + let mut i = 0; + loop { + if i == n_dims { + break; + } + strides_spatial.append(1); + i += 1; + }; + strides_spatial.span() + }, + }; + + match auto_pad { + AUTO_PAD::NOTSET => { panic(array!['not supported!']) }, + AUTO_PAD::SAME_UPPER => { + let mut i = 0; + loop { + if i == input_spatial_shape.len() { + break; + } + out_shape.append((*input_spatial_shape.at(i) - 1) / *strides_spatial.at(i) + 1); + i += 1; + }; + out_shape.span() + }, + AUTO_PAD::SAME_LOWER => { + let mut i = 0; + loop { + if i == input_spatial_shape.len() { + break; + } + out_shape.append((*input_spatial_shape.at(i) - 1) / *strides_spatial.at(i) + 1); + i += 1; + }; + out_shape.span() + }, + AUTO_PAD::VALID => { + let mut i = 0; + loop { + if i == input_spatial_shape.len() { + break; + } + out_shape + .append( + (*input_spatial_shape.at(i) - *kernel_spatial_shape.at(i)) + / *strides_spatial.at(i) + + 1 + ); + i += 1; + }; + out_shape.span() + }, + } +} + +fn get_output_shape_explicit_padding( + pads: Option>, + input_spatial_shape: Span, + kernel_spatial_shape: Span, + strides_spatial: Option>, + dilations: Option>, + ceil_mode: usize, +) -> (Span, Span) { + let n_dims = input_spatial_shape.len(); + let pads = match pads { + Option::Some(pads) => pads, + Option::None => { + let mut pads = ArrayTrait::new(); + let mut i = 0; + loop { + if i == n_dims { + break; + } + pads.append(0); + pads.append(0); + i += 1; + }; + pads.span() + }, + }; + let dilations = match dilations { + Option::Some(dilations) => dilations, + Option::None => { + let mut dilations = ArrayTrait::new(); + let mut i = 0; + loop { + if i == n_dims { + break; + } + dilations.append(1); + i += 1; + }; + dilations.span() + }, + }; + let strides_spatial = match strides_spatial { + Option::Some(strides_spatial) => strides_spatial, + Option::None => { + let mut strides_spatial = ArrayTrait::new(); + let mut i = 0; + loop { + if i == n_dims { + break; + } + strides_spatial.append(1); + i += 1; + }; + strides_spatial.span() + }, + }; + let mut output_spatial_shape = ArrayTrait::::new(); + + let mut d = 0; + loop { + if d == n_dims { + break; + } + let dim_num: FP16x16 = NumberTrait::new_unscaled( + (*input_spatial_shape.at(d) + + *pads.at(d) + + *pads.at(d + n_dims) + - *dilations.at(d) * (*kernel_spatial_shape.at(d) - 1) + - 1) + .into(), + false + ); + let dim_den = NumberTrait::new_unscaled((*strides_spatial.at(d) + 1).into(), false); + + let dim_size = dim_num / dim_den; + + let oss = if ceil_mode == 1 { + NumberTrait::ceil(dim_size) + } else { + NumberTrait::floor(dim_size) + }; + output_spatial_shape.append(oss.try_into().unwrap()); + + d += 1; + }; + let output_spatial_shape = output_spatial_shape.span(); + + let mut pads_spatial_shape_new_1 = ArrayTrait::new(); + let mut pads_spatial_shape_new_2 = ArrayTrait::new(); + + let mut d = 0; + loop { + if d == n_dims { + break; + } + let sliding_window_size = (*kernel_spatial_shape.at(d) - 1) * *dilations.at(d) + 1; + let actual_padded_input_size = (*output_spatial_shape.at(d) - 1) * *strides_spatial.at(d) + + sliding_window_size; + let extra_pad_sub = I32Number::new( + (*input_spatial_shape.at(d) + *pads.at(d) + *pads.at(d + n_dims)).into(), false + ); + let extra_pad = I32Number::new((actual_padded_input_size).into(), false) - extra_pad_sub; + + if extra_pad > 0 { + pads_spatial_shape_new_1.append(*pads.at(d) + extra_pad.into() / 2); + pads_spatial_shape_new_2.append(*pads.at(d) + extra_pad.into() - extra_pad.into() / 2); + } else { + pads_spatial_shape_new_1.append(*pads.at(d)); + pads_spatial_shape_new_2.append(*pads.at(d + n_dims)); + }; + d += 1; + }; + + let mut pads_spatial_shape_new = ArrayTrait::new(); + pads_spatial_shape_new.append_span(pads_spatial_shape_new_1.span()); + pads_spatial_shape_new.append_span(pads_spatial_shape_new_2.span()); + + return (output_spatial_shape, pads_spatial_shape_new.span()); +} + + +fn get_pad_shape( + auto_pad: AUTO_PAD, + input_spatial_shape: Span, + kernel_spatial_shape: Span, + strides_spatial: Option>, + output_spatial_shape: Span, +) -> Span { + let spatial_dims = input_spatial_shape.len(); + let mut pad_shape = ArrayTrait::new(); + + let strides_spatial = match strides_spatial { + Option::Some(strides_spatial) => strides_spatial, + Option::None => { + let mut strides_spatial = ArrayTrait::new(); + let mut i = 0; + loop { + if i == spatial_dims { + break; + } + strides_spatial.append(1); + i += 1; + }; + strides_spatial.span() + }, + }; + + match auto_pad { + AUTO_PAD::NOTSET => { panic(array!['not supported!']) }, + AUTO_PAD::SAME_UPPER => { + let mut i = 0; + loop { + if i == spatial_dims { + break; + } + pad_shape + .append( + (*output_spatial_shape.at(i) - 1) * *strides_spatial.at(i) + + *kernel_spatial_shape.at(i) + - *input_spatial_shape.at(i) + ); + i += 1; + }; + pad_shape.span() + }, + AUTO_PAD::SAME_LOWER => { + let mut i = 0; + loop { + if i == spatial_dims { + break; + } + pad_shape + .append( + (*output_spatial_shape.at(i) - 1) * *strides_spatial.at(i) + + *kernel_spatial_shape.at(i) + - *input_spatial_shape.at(i) + ); + i += 1; + }; + pad_shape.span() + }, + AUTO_PAD::VALID => { + let mut i = 0; + loop { + if i == input_spatial_shape.len() { + break; + } + pad_shape.append(0); + i += 1; + }; + pad_shape.span() + }, + } +} + + +fn get_pad_with_auto_pad(auto_pad: AUTO_PAD, mut pad_shape: Span,) -> Span { + let spatial_dims = pad_shape.len(); + let mut pads = ArrayTrait::new(); + + match auto_pad { + AUTO_PAD::NOTSET => { array![].span() }, + AUTO_PAD::SAME_UPPER => { + let mut pads_1 = ArrayTrait::new(); + let mut pads_2 = ArrayTrait::new(); + + loop { + match pad_shape.pop_front() { + Option::Some(v) => { + pads_1.append(*v / 2); + pads_2.append(*v - *v / 2); + }, + Option::None => { + pads.append_span(pads_1.span()); + pads.append_span(pads_2.span()); + break pads.span(); + } + } + } + }, + AUTO_PAD::SAME_LOWER => { + let mut pads_1 = ArrayTrait::new(); + let mut pads_2 = ArrayTrait::new(); + + loop { + match pad_shape.pop_front() { + Option::Some(v) => { + pads_1.append(*v - *v / 2); + pads_2.append(*v / 2); + }, + Option::None => { + pads.append_span(pads_1.span()); + pads.append_span(pads_2.span()); + break pads.span(); + } + } + } + }, + AUTO_PAD::VALID => { + let mut i = 0; + loop { + if i == spatial_dims { + break; + } + pads.append(0); + pads.append(0); + i += 1; + }; + pads.span() + }, + } +} + +// X dimension : N x C x d1 x ... x dn, Padding on dimensions d1, ..., dn +fn pad_constant_value< + T, MAG, +TensorTrait, +NumberTrait, +Copy, +Drop, +PrintTrait +>( + mut X: @Tensor, constant_value: T, pads: Span +) -> Tensor { + let n_dims = pads.len() / 2; + let N = *(*X).shape.at(0); + let C = *(*X).shape.at(1); + + let mut padded_shape = array![N, C]; + + let mut i = 0; + loop { + if i == n_dims { + break; + } + padded_shape.append(*(*X).shape.at(i + 2) + *pads.at(i) + *pads.at(i + n_dims)); + i += 1; + }; + let x_stride = stride((*X).shape); + let padded_stride = stride(padded_shape.span()); + + let window_len = *x_stride.at(1); + let full_len = *padded_shape.at(0) * *padded_stride.at(0); + + let mut x_padded = full(full_len, constant_value); + + let total_channel = N * C; + + let mut c = 0; + loop { + if c == total_channel { + break; + } + + let mut i = 0; + loop { + if i == window_len { + break; + } + let mut padded_index = c * *padded_stride.at(1); + let mut flatten_index = i; + + let mut n = 0; + loop { + if n == n_dims { + break; + } + let (ind, rem) = DivRem::div_rem( + flatten_index, (*x_stride.at(2 + n)).try_into().unwrap() + ); + flatten_index = rem; + padded_index += (ind + *pads.at(n)) * *padded_stride.at(2 + n); + n += 1; + }; + + x_padded.set(padded_index, *(*X).data.at(c * window_len + i)); + i += 1; + }; + c += 1; + }; + + let mut padded = ArrayTrait::new(); + let mut i = 0; + loop { + if i == x_padded.len() { + break; + } + padded.append(x_padded.at(i)); + i += 1; + }; + return TensorTrait::new(padded_shape.span(), padded.span()); +} + + +// return a span of len ceil((end - start) / step) +fn full, +NumberTrait, +Copy, +Drop,>( + len: usize, fill_value: T +) -> NullableVec { + let mut full = NullableVecImpl::new(); + let mut i = 0; + loop { + if i == len { + break; + } + full.set(i, fill_value); + i += 1; + }; + return full; +} + + +fn flatten_index(index: Span, stride: Span) -> usize { + let mut flatten_index = 0; + let n = index.len(); + + let mut i = 0; + loop { + if i == n { + break; + } + flatten_index += *index.at(i) * *stride.at(i); + i += 1; + }; + + return flatten_index; +} + + +fn get_all_coords(shape: Span) -> Span> { + let mut all_indices = ArrayTrait::new(); + + let mut i = 0; + loop { + if i == shape.len() { + break; + } + all_indices.append(arange(0, *shape.at(i), 1)); + i += 1; + }; + + return cartesian(all_indices.span()); +} + +fn cartesian(mut arrays: Span>,) -> Span> { + let mut n = 1; + let mut i = arrays.len() - 1; + loop { + n = n * (*(arrays.at(i))).len(); + if i == 0 { + break; + } + i -= 1; + }; + + let mut i = 0; + let mut size_arrays = ArrayTrait::new(); + loop { + if i == arrays.len() { + break; + } + size_arrays.append((*(arrays.at(i))).len()); + + i += 1; + }; + let size_arrays = size_arrays.span(); + let mut output_arrays = ArrayTrait::>::new(); + let mut m = n; + + let mut i = 0; + loop { + if i == arrays.len() { + break; + } + m = m / (*(arrays.at(i))).len(); + let mut out = repeat(*(arrays.at(i)), m); + out = repeat_2(out, size_arrays, i); + + output_arrays.append(out); + i += 1; + }; + let output_arrays = output_arrays.span(); + + let mut i = 0; + let mut ret = ArrayTrait::new(); + loop { + if i == n { + break; + } + let mut j = 0; + let mut x = ArrayTrait::new(); + loop { + if j == arrays.len() { + break; + } + + x.append(*(output_arrays.at(j)).at(i)); + j += 1; + }; + ret.append(x.span()); + i += 1; + }; + + return ret.span(); +} + + +fn repeat_2(mut array: Array, size_array: Span, index: usize) -> Array { + let mut size = array.len(); + let mut i = 0; + loop { + if i == index { + break; + } + let mut j = 1; + loop { + if j == *size_array.at(index - 1 - i) { + break; + } + let mut k = 0; + loop { + if k == size { + break; + } + array.append(*array.at(k)); + k += 1; + }; + j += 1; + }; + size = size * *size_array.at(index - 1 - i); + i += 1; + }; + array +} + +fn repeat(array: Span, m: usize,) -> Array { + let mut out = ArrayTrait::new(); + let mut j = 0; + loop { + if j == array.len() { + break; + } + let mut k = 0; + loop { + if k == m { + break; + } + out.append(*array.at(j)); + k += 1; + }; + j += 1; + }; + + out +} + + +fn arange(start: usize, end: usize, step: usize) -> Span { + let mut arr = ArrayTrait::new(); + let mut i = start; + loop { + if i >= end { + break; + } + arr.append(i); + i += step; + }; + return arr.span(); +} + + +fn max, +Drop, +Copy, +PartialOrd,>(mut a: Span) -> T { + assert(a.len() > 0, 'span cannot be empty'); + + let mut max = *a.at(0); + loop { + match a.pop_front() { + Option::Some(v) => { if *v > max { + max = *v; + }; }, + Option::None => { break max; } + }; + } +} + + +fn average< + T, + MAG, + +NumberTrait, + +Into, + +AddEq, + +Drop, + +Copy, + +PartialOrd, + +Div +>( + mut a: Span +) -> T { + assert(a.len() > 0, 'span cannot be empty'); + + let mut sum = *a.at(0); + let n = NumberTrait::new_unscaled((a.len()).into(), false); + loop { + match a.pop_front() { + Option::Some(v) => { sum += *v; }, + Option::None => { break sum / n; } + }; + } +} + diff --git a/src/operators/nn/functional/conv.cairo b/src/operators/nn/functional/conv.cairo index 95a330e8e..23883f77f 100644 --- a/src/operators/nn/functional/conv.cairo +++ b/src/operators/nn/functional/conv.cairo @@ -1,31 +1,15 @@ -use core::debug::PrintTrait; - use orion::numbers::NumberTrait; use orion::numbers::{U32IntoI32, I32IntoU32, I32Div, I32Number}; use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor,}; use orion::operators::vec::{NullableVec, NullableVecImpl}; use orion::operators::tensor::core::{stride}; +use orion::operators::nn::helpers::{cartesian, arange, max_in_tensor, min_in_tensor, dot}; +use orion::operators::nn::AUTO_PAD; -#[derive(Copy, Drop)] -enum AUTO_PAD { - NOTSET, - SAME_UPPER, - SAME_LOWER, - VALID -} /// Cf: NNTrait::conv docstring fn conv< - T, - MAG, - +TensorTrait, - +NumberTrait, - +Copy, - +Drop, - +Add, - +Mul, - +AddEq, - +PrintTrait, + T, MAG, +TensorTrait, +NumberTrait, +Copy, +Drop, +Add, +Mul, +AddEq, >( X: @Tensor, W: @Tensor, @@ -246,7 +230,8 @@ fn conv< } // group == 1 - if *dilations.at(0) != 1 || min(dilations.clone()) != max(dilations.clone()) { + if *dilations.at(0) != 1 + || min_in_tensor(dilations.clone()) != min_in_tensor(dilations.clone()) { // computation of the dilated kernel let nd = dilations.len(); let mut new_kernel_shape: Array = array![]; @@ -1229,161 +1214,3 @@ fn r_index_check(r_index: Span, shape_out: Span) -> bool { flag } -fn prod, +Copy, +NumberTrait, +TensorTrait, +Mul,>( - pA: Span, start: usize -) -> T { - let mut i = start; - let mut prod = NumberTrait::one(); - while i != pA.len() { - prod = prod * (*pA.at(i)); - i += 1; - }; - - prod -} - -fn min(mut a: Span) -> usize { - assert(a.len() > 0, 'span cannot be empty'); - - let mut min = *a.at(0); - loop { - match a.pop_front() { - Option::Some(v) => { if *v < min { - min = *v; - }; }, - Option::None => { break min; } - }; - } -} - -fn max(mut a: Span) -> usize { - assert(a.len() > 0, 'span cannot be empty'); - - let mut max = *a.at(0); - loop { - match a.pop_front() { - Option::Some(v) => { if *v > max { - max = *v; - }; }, - Option::None => { break max; } - }; - } -} - -fn arange(start: usize, end: usize, step: usize) -> Span { - assert((end - start) % step == 0, 'incompatible step value'); - - let mut arr: Array = array![]; - let mut i = start; - while i < end { - arr.append(i); - i += step; - }; - - arr.span() -} - - -fn cartesian(mut arrays: Span>,) -> Span> { - let mut n = 1; - let mut i = arrays.len() - 1; - loop { - n = n * (*(arrays.at(i))).len(); - if i == 0 { - break; - } - i -= 1; - }; - - let mut i = 0; - let mut size_arrays: Array = array![]; - while i != arrays.len() { - size_arrays.append((*(arrays.at(i))).len()); - i += 1; - }; - - let size_arrays = size_arrays.span(); - let mut output_arrays = array![]; - let mut m = n; - - let mut i = 0; - while i != arrays.len() { - m = m / (*(arrays.at(i))).len(); - let mut out = repeat(*(arrays.at(i)), m); - out = repeat_2(out, size_arrays, i); - - output_arrays.append(out); - i += 1; - }; - - let output_arrays = output_arrays.span(); - - let mut i = 0; - let mut ret = ArrayTrait::new(); - while i != n { - let mut j = 0; - let mut x: Array = array![]; - while j != arrays.len() { - x.append(*(output_arrays.at(j)).at(i)); - j += 1; - }; - - ret.append(x.span()); - i += 1; - }; - - ret.span() -} - -fn repeat_2(mut array: Array, size_array: Span, index: usize) -> Array { - let mut size = array.len(); - let mut i = 0; - while i != index { - let mut j = 1; - while j != *size_array.at(index - 1 - i) { - let mut k = 0; - while k != size { - array.append(*array.at(k)); - k += 1; - }; - - j += 1; - }; - - size = size * *size_array.at(index - 1 - i); - i += 1; - }; - - array -} - -fn repeat(array: Span, m: usize,) -> Array { - let mut out: Array = array![]; - let mut j = 0; - while j != array.len() { - let mut k = 0; - while k != m { - out.append(*array.at(j)); - k += 1; - }; - - j += 1; - }; - - out -} - -fn dot< - T, MAG, +Drop, +Copy, +NumberTrait, +Add, +TensorTrait, +AddEq, +Mul, ->( - a: Span, b: Span -) -> T { - let mut i = 0; - let mut sum = NumberTrait::zero(); - while i != a.len() { - sum = sum + *a.at(i) * *b.at(i); - i += 1; - }; - - sum -} diff --git a/src/operators/nn/functional/conv_transpose.cairo b/src/operators/nn/functional/conv_transpose.cairo index 259dc5915..20999c9e8 100644 --- a/src/operators/nn/functional/conv_transpose.cairo +++ b/src/operators/nn/functional/conv_transpose.cairo @@ -2,14 +2,12 @@ use orion::numbers::NumberTrait; use orion::operators::tensor::core::{stride}; use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor,}; use orion::operators::vec::{NullableVec, NullableVecImpl}; +use orion::operators::nn::helpers::{is_out, prod, prod_on_subset}; +use orion::operators::nn::functional::col2im::{ + get_image, col2im_naive_implementation, col2im_shape_check +}; +use orion::operators::nn::AUTO_PAD; -#[derive(Copy, Drop)] -enum AUTO_PAD { - NOTSET, - SAME_UPPER, - SAME_LOWER, - VALID -} /// Cf: NNTrait::conv_transpose docstring fn conv_transpose< @@ -62,11 +60,13 @@ fn conv_transpose< Option::None => { let mut output_padding: Array = array![]; let mut i = 2; - while i != (*X).shape.len() { - output_padding.append(0); - output_padding.append(0); - i += 1; - }; + while i != (*X) + .shape + .len() { + output_padding.append(0); + output_padding.append(0); + i += 1; + }; output_padding.span() }, @@ -152,10 +152,11 @@ fn conv_transpose< Option::None => { let mut output_shape: Array = array![]; let mut i = 0; - while i != strides.len() { - output_shape.append(*(*X).shape.at(i + 2) * *strides.at(i)); - i += 1; - }; + while i != strides + .len() { + output_shape.append(*(*X).shape.at(i + 2) * *strides.at(i)); + i += 1; + }; output_shape.span() }, @@ -163,16 +164,17 @@ fn conv_transpose< let mut total_padding: Array = array![]; let mut i = 0; - while i != output_shape.len() { - total_padding - .append( - (*(*X).shape.at(i + 2) - 1) * *strides.at(i) - + *output_padding.at(i) - + ((*kernel_shape.at(i) - 1) * *dilations.at(i) + 1) - - *output_shape.at(i) - ); - i += 1; - }; + while i != output_shape + .len() { + total_padding + .append( + (*(*X).shape.at(i + 2) - 1) * *strides.at(i) + + *output_padding.at(i) + + ((*kernel_shape.at(i) - 1) * *dilations.at(i) + 1) + - *output_shape.at(i) + ); + i += 1; + }; let total_padding = total_padding.span(); @@ -185,10 +187,11 @@ fn conv_transpose< }; let mut i = 0; - while i != output_shape.len() { - pads.append(*total_padding.at(i) - (*total_padding.at(i) / 2)); - i += 1; - }; + while i != output_shape + .len() { + pads.append(*total_padding.at(i) - (*total_padding.at(i) / 2)); + i += 1; + }; (pads.span(), pads.len() / 2, output_shape) }, @@ -198,10 +201,11 @@ fn conv_transpose< Option::None => { let mut output_shape: Array = array![]; let mut i = 0; - while i != strides.len() { - output_shape.append(*(*X).shape.at(i + 2) * *strides.at(i)); - i += 1; - }; + while i != strides + .len() { + output_shape.append(*(*X).shape.at(i + 2) * *strides.at(i)); + i += 1; + }; output_shape.span() }, @@ -209,26 +213,28 @@ fn conv_transpose< let mut total_padding: Array = array![]; let mut i = 0; - while i != output_shape.len() { - total_padding - .append( - (*(*X).shape.at(i + 2) - 1) * *strides.at(i) - + *output_padding.at(i) - + ((*kernel_shape.at(i) - 1) * *dilations.at(i) + 1) - - *output_shape.at(i) - ); - i += 1; - }; + while i != output_shape + .len() { + total_padding + .append( + (*(*X).shape.at(i + 2) - 1) * *strides.at(i) + + *output_padding.at(i) + + ((*kernel_shape.at(i) - 1) * *dilations.at(i) + 1) + - *output_shape.at(i) + ); + i += 1; + }; let total_padding = total_padding.span(); let mut pads: Array = array![]; let mut i = 0; - while i != output_shape.len() { - pads.append(*total_padding.at(i) - *total_padding.at(i) / 2); - i += 1; - }; + while i != output_shape + .len() { + pads.append(*total_padding.at(i) - *total_padding.at(i) / 2); + i += 1; + }; let mut i = 0; while i != output_shape.len() { @@ -289,64 +295,77 @@ fn conv_transpose< }; let kernel_shape = kernel_shape.span(); - let kernel_size = prod(kernel_shape, 0); + let kernel_size = prod(kernel_shape); let mut num_output_channels = *(*W).shape.at(1) * group; let mut kernel_dim = (num_output_channels / group) * kernel_size; let C = *(*X).shape.at(1); let m = kernel_dim; - let n = prod((*X).shape, 2); + let n = prod_on_subset((*X).shape, 2); let k = C / group; let mut final: Array = array![]; if group == 1 { let mut image_id = 0; - while image_id != *(*X).shape.at(0) { - let w_t = TensorTrait::new(array![k, m].span(), (*W).data) - .transpose(array![1, 0].span()); - - let image = SpanTrait::slice((*X).data, image_id * k * n, k * n); - let gemm = w_t.matmul(@TensorTrait::new(array![k, n].span(), image)); - - let gemmc = gemm - .reshape(array![num_output_channels, m / num_output_channels, n].span()); - let mut c = 0; - while c != num_output_channels { - let gemmc_c = TensorTrait::new( - array![m / num_output_channels, n].span(), - SpanTrait::slice( - gemmc.data, (m / num_output_channels) * n * c, (m / num_output_channels) * n - ) - ); - - let mut res = col2im_naive_implementation( - @gemmc_c, output_shape, kernel_shape, dilations, pads, strides - ); - - match B { - Option::Some(B) => { - let mut i = 0; - while i != res.len() { - res.set(i, res.at(i) + *(*B).data.at(c)); - i += 1; - }; - }, - Option::None => {}, - } + while image_id != *(*X) + .shape + .at(0) { + let w_t = TensorTrait::new(array![k, m].span(), (*W).data) + .transpose(array![1, 0].span()); + + let image = SpanTrait::slice((*X).data, image_id * k * n, k * n); + let gemm = w_t.matmul(@TensorTrait::new(array![k, n].span(), image)); + + let gemmc = gemm + .reshape( + array![ + num_output_channels.try_into().unwrap(), + (m / num_output_channels).try_into().unwrap(), + n.try_into().unwrap() + ] + .span(), + false + ); + let mut c = 0; + while c != num_output_channels { + let gemmc_c = TensorTrait::new( + array![m / num_output_channels, n].span(), + SpanTrait::slice( + gemmc.data, + (m / num_output_channels) * n * c, + (m / num_output_channels) * n + ) + ); + + let mut res = col2im_naive_implementation( + @gemmc_c, output_shape, kernel_shape, dilations, pads, strides + ); + + match B { + Option::Some(B) => { + let mut i = 0; + while i != res + .len() { + res.set(i, res.at(i) + *(*B).data.at(c)); + i += 1; + }; + }, + Option::None => {}, + } - c += 1; + c += 1; - let mut i = 0; - while i != res.len() { - final.append(res.at(i)); - i += 1; + let mut i = 0; + while i != res.len() { + final.append(res.at(i)); + i += 1; + }; }; - }; - image_id += 1; - }; + image_id += 1; + }; } else { let mut output_array: Array> = array![]; @@ -364,19 +383,21 @@ fn conv_transpose< let mut group_W: Array = array![]; let mut image_id = 0; - while image_id != *(*X).shape.at(0) { - let start = image_id * n * C + (group_id * C / group) * n; - let end = image_id * n * C + ((group_id + 1) * C / group) * n; + while image_id != *(*X) + .shape + .at(0) { + let start = image_id * n * C + (group_id * C / group) * n; + let end = image_id * n * C + ((group_id + 1) * C / group) * n; + + let mut i = start; + while i != end { + group_X.append(*(*X).data.at(i)); + i += 1; + }; - let mut i = start; - while i != end { - group_X.append(*(*X).data.at(i)); - i += 1; + image_id += 1; }; - image_id += 1; - }; - let start = (group_id * C / group) * *(*W).shape.at(1) * kernel_size; let end = (group_id + 1) * C / group * *(*W).shape.at(1) * kernel_size; let mut i = start; @@ -434,22 +455,26 @@ fn conv_transpose< // Sorting result per item of the batch // output size : N (batch size) x num_output_channels x output_shape let mut image_id = 0; - while image_id != *(*X).shape.at(0) { - let mut group_id = 0; - while group_id != group { - let group_output = *output_array.at(group_id); - let mut i = image_id * output_size * (num_output_channels / group); - - while i != (image_id + 1) * output_size * (num_output_channels / group) { - final.append(*group_output.at(i)); - i += 1; + while image_id != *(*X) + .shape + .at(0) { + let mut group_id = 0; + while group_id != group { + let group_output = *output_array.at(group_id); + let mut i = image_id * output_size * (num_output_channels / group); + + while i != (image_id + 1) + * output_size + * (num_output_channels / group) { + final.append(*group_output.at(i)); + i += 1; + }; + + group_id += 1; }; - group_id += 1; + image_id += 1; }; - - image_id += 1; - }; } let mut shape = array![*(*X).shape.at(0), num_output_channels]; @@ -462,193 +487,3 @@ fn conv_transpose< TensorTrait::new(shape.span(), final.span()) } - -fn get_image, +Copy>(self: @Tensor, row: usize) -> Span { - assert((*self).shape.len() == 2, 'Expected a 2D tensor'); - - let row_length = *self.shape[1]; - let start = row * row_length; - - (*self).data.slice(start, row_length) -} - -fn col2im_naive_implementation< - T, MAG, +TensorTrait, +NumberTrait, +Copy, +Drop, +Add, ->( - data: @Tensor, - image_shape: Span, - kernel_shape: Span, - dilations: Span, - pads: Span, - strides: Span, -) -> NullableVec { - let n_dims = pads.len() / 2; - - col2im_shape_check(data, image_shape, kernel_shape, dilations, pads, strides); - - let mut dim_col: Array = array![]; - let mut i = 0; - while i != n_dims { - dim_col - .append( - (*image_shape.at(i) - + (*pads.at(i) + *pads.at(i + n_dims)) - - (*dilations.at(i) * (*kernel_shape.at(i) - 1) + 1)) - / *strides.at(i) - + 1 - ); - - i += 1; - }; - - let dim_col = dim_col.span(); - - let stride_img = stride(image_shape); - - let mut data_im = NullableVecImpl::new(); - data_im.set(*image_shape.at(0) * *stride_img.at(0) - 1, NumberTrait::zero()); - - let kernel_size = prod(kernel_shape, 0); - let col_size = prod(dim_col, 0); - let mut c_col = 0; - while c_col != kernel_size { - let offset = get_indices(c_col, kernel_shape).span(); - - let mut col = 0; - while col != col_size { - let ind_col = get_indices(col, dim_col).span(); - let mut ind_im: Array = array![]; - let mut i = 0; - while i != n_dims { - if (*ind_col.at(i) * *strides.at(i) + *offset.at(i) * *dilations.at(i)) < *pads - .at(i) { - let neg_index = *pads.at(i) - - (*ind_col.at(i) * *strides.at(i) + *offset.at(i) * *dilations.at(i)); - ind_im.append(*image_shape.at(i) + neg_index); - } else { - ind_im - .append( - *ind_col.at(i) * *strides.at(i) - + *offset.at(i) * *dilations.at(i) - - *pads.at(i) - ); - } - - i += 1; - }; - - let ind_im = ind_im.span(); - if !is_out(ind_im, image_shape) { - let mut index = 0; - let mut i = 0; - while i != image_shape.len() { - index += *stride_img.at(i) * *ind_im.at(i); - i += 1; - }; - - data_im.set(index, data_im.at(index) + *(*data).data.at(c_col * col_size + col)); - } - - col += 1; - }; - - c_col += 1; - }; - - data_im -} - -fn col2im_shape_check, +Copy, +Drop,>( - X: @Tensor, - output_shape: Span, - kernel_shape: Span, - dilations: Span, - pads: Span, - strides: Span, -) { - let n_input_plane = *(*X).shape.at(0); - - let kernel_size = prod(kernel_shape, 0); - - assert(n_input_plane % kernel_size == 0, 'wrong input dimension'); - - let input_length = *(*X).shape.at(1); - let n_dims = output_shape.len(); - let mut n_blocks: Array = array![]; - - let mut i = 0; - while i != n_dims { - n_blocks - .append( - (*output_shape.at(i) - + (*pads.at(i) + *pads.at(i + n_dims)) - - *dilations.at(i) * (*kernel_shape.at(i) - 1) - - 1) - / *strides.at(i) - + 1 - ); - i += 1; - }; - - let block_size = prod(n_blocks.span(), 0); - - assert(input_length == block_size, 'input_length != block_size'); -} - - -fn get_indices(index: usize, shape: Span,) -> Array { - let mut i = index; - let mut res: Array = array![]; - let mut k = shape.len() - 1; - while k != 0 { - let m = i % *shape.at(k); - res.append(m); - i -= m; - i /= *shape.at(k); - k -= 1; - }; - - let mut new_res: Array = array![]; - new_res.append(i); - let mut i = shape.len() - 1; - while i != 0 { - new_res.append(*res.at(i - 1)); - i -= 1; - }; - - new_res -} - -fn is_out(ind: Span, shape: Span,) -> bool { - let mut n = 0; - let is_out = loop { - if n == ind.len() { - break false; - } - let s = *shape.at(n); - let i = *ind.at(n); - if i < 0 { - break true; - } - if i >= s { - break true; - } - n += 1; - }; - - is_out -} - -fn prod, +Copy, +NumberTrait, +TensorTrait, +Mul,>( - pA: Span, start: usize -) -> T { - let mut i = start; - let mut prod = NumberTrait::one(); - while i != pA.len() { - prod = prod * (*pA.at(i)); - i += 1; - }; - - prod -} - diff --git a/src/operators/nn/functional/deform_conv.cairo b/src/operators/nn/functional/deform_conv.cairo new file mode 100644 index 000000000..bb04b11c8 --- /dev/null +++ b/src/operators/nn/functional/deform_conv.cairo @@ -0,0 +1,548 @@ +use core::array::ArrayTrait; +use orion::numbers::NumberTrait; +use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor,}; +use orion::operators::vec::{NullableVec, NullableVecImpl}; +use orion::operators::tensor::core::{stride}; +use core::debug::PrintTrait; +use core::traits::Into; +use orion::numbers::{U32IntoI32, I32IntoU32, I32Div, I32Number}; + + +use orion::operators::nn::functional::grid_sample::{grid_sample}; + + +/// Cf: NNTrait::deform_conv docstring +fn deform_conv< + T, + MAG, + +TensorTrait, + +NumberTrait, + +Copy, + +Drop, + +Add, + +Mul, + +Sub, + +Div, + +AddEq, + +PrintTrait, + +PartialOrd, + +PartialEq, + +TryInto, + +Into, + +Rem, + +Neg, + +SubEq, + +Mul>, +>( + X: @Tensor, + W: @Tensor, + offset: @Tensor, + B: Option>, + mask: Option>, + dilations: Option>, + group: Option, + kernel_shape: Option>, + offset_group: Option, + pads: Option>, + strides: Option>, +) -> Tensor { + assert((*X).shape.len() >= 3, 'X must have at least 3 dim'); + assert((*W).shape.len() >= 3, 'X must have at least 3 dim'); + + let dilations = match dilations { + Option::Some(dilations) => dilations, + Option::None => { + let mut dilations = ArrayTrait::new(); + let mut i = 2; + while i != (*X).shape.len() { + dilations.append(1); + i += 1; + }; + dilations.span() + }, + }; + let kernel_shape = match kernel_shape { + Option::Some(kernel_shape) => kernel_shape, + Option::None => { + let mut kernel_shape = ArrayTrait::new(); + let mut i = 2; + while i != (*W).shape.len() { + kernel_shape.append(*(*W).shape.at(i)); + i += 1; + }; + kernel_shape.span() + }, + }; + let pads = match pads { + Option::Some(pads) => pads, + Option::None => { + let mut pads = ArrayTrait::new(); + let mut i = 2; + while i != (*X).shape.len() { + pads.append(0); + pads.append(0); + i += 1; + }; + pads.span() + }, + }; + let strides = match strides { + Option::Some(strides) => strides, + Option::None => { + let mut strides = ArrayTrait::new(); + let mut i = 2; + while i != (*X).shape.len() { + strides.append(1); + i += 1; + }; + strides.span() + }, + }; + let group = match group { + Option::Some(group) => group, + Option::None => { 1 }, + }; + + let offset_group = match offset_group { + Option::Some(offset_group) => offset_group, + Option::None => { 1 }, + }; + + let n = *(*X).shape.at(0); + let ic = *(*X).shape.at(1); + let oc = *(*W).shape.at(0); + let output_shape = SpanTrait::slice((*offset).shape, 2, (*offset).shape.len() - 2); + + assert(ic == *(*W).shape.at(1) * group, 'shape inconsistencies'); + assert(oc % group == 0, 'shape inconsistencies'); + + let ics_per_group = *(*W).shape.at(1); + let ocs_per_group = oc / group; + + assert(ic % offset_group == 0, 'offset_group inconsistencies'); + + let ics_per_offset_group = ic / offset_group; + + assert( + offset_group * prod(kernel_shape, 0) * kernel_shape.len() == *(*offset).shape.at(1), + 'offset_group inconsistencies' + ); + + let mut offset_shape = array![n.into(), offset_group.into()]; + offset_shape.append_span(span_U32_to_span_I32(kernel_shape.clone())); + offset_shape.append(kernel_shape.len().into()); + offset_shape.append_span(span_U32_to_span_I32(output_shape.clone())); + + let offset = offset.reshape(offset_shape.span(), false); + + let mask = match mask { + Option::Some(mask) => mask, + Option::None => { + let mut mask = ArrayTrait::::new(); + let mask_end = n * offset_group * prod(kernel_shape, 0) * prod(output_shape, 0); + let mut i = 0; + while i != mask_end { + mask.append(NumberTrait::::one()); + i += 1; + }; + let mut mask_shape = array![n, offset_group * prod(kernel_shape, 0)]; + mask_shape.append_span(output_shape); + TensorTrait::new(mask_shape.span(), mask.span()) + }, + }; + + let mut mask_shape = array![n.into(), offset_group.into()]; + mask_shape.append_span(span_U32_to_span_I32(kernel_shape.clone())); + mask_shape.append_span(span_U32_to_span_I32(output_shape.clone())); + let mask = mask.reshape(mask_shape.span(), false); + + if (*X).shape.len() == 4 { + let ih: T = NumberTrait::new_unscaled((*(*X).shape.at(2)).into(), false); + let iw: T = NumberTrait::new_unscaled((*(*X).shape.at(3)).into(), false); + + let x_stride = stride((*X).shape); + let w_stride = stride((*W).shape); + let offset_stride = stride(offset.shape); + let mask_stride = stride(mask.shape); + + let mut x_subset_shape = array![1, 1]; + x_subset_shape.append_span(SpanTrait::slice(*(X).shape, 2, (*(X).shape).len() - 2)); + let x_subset_shape = x_subset_shape.span(); + + let mut w_subset_shape = array![1, 1]; + w_subset_shape.append_span(SpanTrait::slice(*(W).shape, 2, (*(W).shape).len() - 2)); + let w_subset_shape = w_subset_shape.span(); + + let oh = *offset.shape.at(offset_shape.len() - 2); + let ow = *offset.shape.at(offset_shape.len() - 1); + + let kh = *kernel_shape.at(0); + let kw = *kernel_shape.at(1); + + let sth: T = NumberTrait::new_unscaled((*strides.at(0)).into(), false); + let stw: T = NumberTrait::new_unscaled((*strides.at(1)).into(), false); + + let dh = *dilations.at(0); + let dw = *dilations.at(1); + + let kh_new = (kh - 1) * dh + 1; + let kw_new = (kw - 1) * dw + 1; + + let bh: T = NumberTrait::new_unscaled((*pads.at(0)).into(), true); + let bw: T = NumberTrait::new_unscaled((*pads.at(1)).into(), true); + + assert( + oh == (((*(*X).shape.at(2) - kh_new + *pads.at(0) + *pads.at(2)) / *strides.at(0)) + 1), + 'incompatible shapes' + ); + assert( + ow == (((*(*X).shape.at(3) - kw_new + *pads.at(1) + *pads.at(3)) / *strides.at(1)) + 1), + 'incompatible shapes' + ); + + let mut res = NullableVecImpl::new(); + let res_shape = array![n, oc, oh, ow].span(); + let res_stride = stride(res_shape); + res.set(n * *res_stride.at(0) - 1, NumberTrait::zero()); + + match B { + Option::Some(B) => { + let mut i = 0; + while i != n { + let mut j = 0; + while j != oc { + let b_j = *B.at(j); + let mut k = 0; + while k != oh { + let mut l = 0; + while l != ow { + res + .set( + i * *res_stride.at(0) + + j * *res_stride.at(1) + + k * *res_stride.at(2) + + l, + b_j + ); + l += 1; + }; + k += 1; + }; + j += 1; + }; + i += 1; + }; + }, + Option::None => {}, + } + + let (kernel_pos_w, kernel_pos_h) = meshgrid(arange(0, kw_new, dw), arange(0, kh_new, dh)); + let kernel_pos_wrt_first_elem = stack(kernel_pos_h, kernel_pos_w); + + let dh: T = NumberTrait::new_unscaled(dh.into(), false); + let dw: T = NumberTrait::new_unscaled(dw.into(), false); + + let kh_new: T = NumberTrait::new_unscaled(kh_new.into(), false); + let kw_new: T = NumberTrait::new_unscaled(kw_new.into(), false); + + // dimension of kernel_pos_wrt_first_elem is ks0 x ks1 + let ks0 = NumberTrait::ceil(kh_new / dh).try_into().unwrap(); + let ks1 = NumberTrait::ceil(kw_new / dw).try_into().unwrap(); + + let one: T = NumberTrait::one(); + let two: T = NumberTrait::one() + NumberTrait::one(); + + let mut batch_idx = 0; + while batch_idx != n { + let mut oc_idx = 0; + while oc_idx != oc { + let mut ic_idx = 0; + while ic_idx != ic { + if (ic_idx / ics_per_group) == (oc_idx / ocs_per_group) { + let offset_group_idx = ic_idx / ics_per_offset_group; + + let mut i = 0; + while i != oh { + let index = NumberTrait::new_unscaled(i.into(), false); + let h_coord = bh + sth * index; + let mut j = 0; + while j != ow { + let jndex = NumberTrait::new_unscaled(j.into(), false); + let w_coord = bw + stw * jndex; + + let mut kernel = copy_to_vec(kernel_pos_wrt_first_elem); + let mut mask_subset = ArrayTrait::new(); + let mut kernel_test = ArrayTrait::new(); + let mut offset_TEST = ArrayTrait::new(); + + let mut hi = 0; + while hi != ks0 { + let mut wi = 0; + while wi != ks1 { + let elem1 = h_coord + + *offset + .data + .at( + batch_idx * *offset_stride.at(0) + + offset_group_idx * *offset_stride.at(1) + + hi * *offset_stride.at(2) + + wi * *offset_stride.at(3) + + 0 * *offset_stride.at(4) + + i * *offset_stride.at(5) + + j + ); + let elem2 = w_coord + + *offset + .data + .at( + batch_idx * *offset_stride.at(0) + + offset_group_idx * *offset_stride.at(1) + + hi * *offset_stride.at(2) + + wi * *offset_stride.at(3) + + 1 * *offset_stride.at(4) + + i * *offset_stride.at(5) + + j + ); + + mask_subset + .append( + *mask + .data + .at( + batch_idx * *mask_stride.at(0) + + offset_group_idx * *mask_stride.at(1) + + hi * *mask_stride.at(2) + + wi * *mask_stride.at(3) + + i * *mask_stride.at(4) + + j + ) + ); + kernel_test.append(kernel.at(hi * (ks1 * 2) + wi * 2)); + offset_TEST + .append( + *offset + .data + .at( + batch_idx * *offset_stride.at(0) + + offset_group_idx + * *offset_stride.at(1) + + hi * *offset_stride.at(2) + + wi * *offset_stride.at(3) + + 0 * *offset_stride.at(4) + + i * *offset_stride.at(5) + + j + ) + ); + kernel + .set( + hi * (ks1 * 2) + wi * 2, + (kernel.at(hi * (ks1 * 2) + wi * 2) + elem1) + / (ih - one) + * two + - one + ); + kernel + .set( + hi * (ks1 * 2) + wi * 2 + 1, + (kernel.at(hi * (ks1 * 2) + wi * 2 + 1) + elem2) + / (iw - one) + * two + - one + ); + wi += 1; + }; + hi += 1; + }; + let kernel = flip_mod_2(ref kernel); + + let subset_x = TensorTrait::new( + x_subset_shape, + SpanTrait::slice( + (*X).data, + batch_idx * *x_stride.at(0) + ic_idx * *x_stride.at(1), + *x_stride.at(1) + ) + ); + let subset_w = TensorTrait::new( + w_subset_shape, + SpanTrait::slice( + (*W).data, + oc_idx * *w_stride.at(0) + + (ic_idx % ics_per_group) * *w_stride.at(1), + *w_stride.at(1) + ) + ); + let mask_subset = TensorTrait::new( + array![1, 1, ks0, ks1].span(), mask_subset.span() + ); + let kernel = TensorTrait::new( + array![1, ks0, ks1, 2].span(), kernel + ); + + let grid_sample_output = grid_sample( + @subset_x, @kernel, Option::Some(1), Option::None, Option::None + ); + + // broadcasted multiply + let conv_value = (grid_sample_output * subset_w); + let conv_value = (conv_value * mask_subset); + + res + .set( + batch_idx * *res_stride.at(0) + + oc_idx * *res_stride.at(1) + + i * *res_stride.at(2) + + j, + res + .at( + batch_idx * *res_stride.at(0) + + oc_idx * *res_stride.at(1) + + i * *res_stride.at(2) + + j + ) + + sum(conv_value.data, 0) + ); + j += 1; + }; + i += 1; + }; + } + ic_idx += 1; + }; + oc_idx += 1; + }; + batch_idx += 1; + }; + + let mut res_data = ArrayTrait::new(); + let mut i = 0; + while i != res.len() { + res_data.append(res.at(i)); + i += 1; + }; + return TensorTrait::new(res_shape, res_data.span()); + } + + panic(array!['not supported yet!']) +} + + +fn meshgrid(x: Span, y: Span) -> (Span, Span) { + let mut xv = ArrayTrait::new(); + let mut yv = ArrayTrait::new(); + + let mut i = 0; + while i != y.len() { + + xv.append_span(x); + let mut j = 0; + while j != x.len() { + yv.append(*y.at(i)); + j += 1; + }; + i += 1; + }; + return (xv.span(), yv.span()); +} + +fn stack(x: Span, y: Span) -> Span { + let mut stack = ArrayTrait::new(); + + let mut i = 0; + while i != x.len() { + stack.append(*x.at(i)); + stack.append(*y.at(i)); + i += 1; + }; + + return stack.span(); +} + + +fn flip_mod_2, impl TCopy: Copy, +NumberTrait>( + ref x: NullableVec +) -> Span { + let mut i = 0; + let mut res = ArrayTrait::new(); + while i != x.len / 2 { + res.append(x.at(i * 2 + 1)); + res.append(x.at(i * 2)); + i += 1; + }; + + return res.span(); +} + +fn copy_to_vec< + T, MAG, +Drop, +Copy, +NumberTrait, +TryInto, +Into, +>( + x: Span +) -> NullableVec { + let mut res = NullableVecImpl::new(); + + let mut i = 0; + while i != x.len() { + res.set(i, NumberTrait::new_unscaled((*x.at(i)).into(), false)); + i += 1; + }; + + return res; +} + +// return a span of len ceil((end - start) / step) +fn arange(start: usize, end: usize, step: usize) -> Span { + let mut arr = ArrayTrait::new(); + let mut i = start; + while i != end { + arr.append(i); + i += step; + }; + return arr.span(); +} + + +fn prod, +Copy, +NumberTrait, +TensorTrait, +Mul,>( + a: Span, start: usize +) -> T { + assert(a.len() > start, 'wrong input dim'); + let mut prod = NumberTrait::one(); + let mut i = start; + while i != a.len() { + prod = prod * (*a.at(i)); + i += 1; + }; + return prod; +} + + + +fn sum, +Copy, +NumberTrait, +TensorTrait, +AddEq,>( + a: Span, start: usize +) -> T { + assert(a.len() > start, 'wrong input dim'); + let mut sum = NumberTrait::zero(); + let mut i = start; + while i != a.len() { + sum += (*a.at(i)); + i += 1; + }; + return sum; +} + + +fn span_U32_to_span_I32( + mut x: Span +) -> Span { + let mut res = ArrayTrait::new(); + + loop { + match x.pop_front() { + Option::Some(v) => { + res.append((*v).into()); + }, + Option::None => { break; } + }; + }; + + return res.span(); +} \ No newline at end of file diff --git a/src/operators/nn/functional/depth_to_space.cairo b/src/operators/nn/functional/depth_to_space.cairo index 161ea46ad..c34bd1439 100644 --- a/src/operators/nn/functional/depth_to_space.cairo +++ b/src/operators/nn/functional/depth_to_space.cairo @@ -20,24 +20,35 @@ fn depth_to_space< ) -> Tensor { assert((tensor.shape).len() == 4, 'Unexpected shape 4.'); - let b = (tensor.shape).at(0); - let C = (tensor.shape).at(1); - let H = (tensor.shape).at(2); - let W = (tensor.shape).at(3); - let finalshape = array![*b, *C / (blocksize * blocksize), *H * blocksize, *W * blocksize]; + let blocksize_i32: i32 = blocksize.try_into().unwrap(); + + let b: i32 = (*(tensor.shape).at(0)).try_into().unwrap(); + let C: u32 = (*(tensor.shape).at(1)).try_into().unwrap(); + let H: i32 = (*(tensor.shape).at(2)).try_into().unwrap(); + let W: i32 = (*(tensor.shape).at(3)).try_into().unwrap(); + let finalshape: Array = array![ + b, + (C / (blocksize * blocksize)).try_into().unwrap(), + (H * blocksize_i32), + (W * blocksize_i32) + ]; if mode == 'DCR' { - let tmpshape = array![*b, blocksize, blocksize, *C / (blocksize * blocksize), *H, *W]; - let reshaped = (tensor).reshape(target_shape: tmpshape.span()); + let tmpshape: Array = array![ + b, blocksize_i32, blocksize_i32, (C / (blocksize * blocksize)).try_into().unwrap(), H, W + ]; + let reshaped = (tensor).reshape(target_shape: tmpshape.span(), allowzero: false); let transposed = reshaped.transpose(axes: array![0, 3, 4, 1, 5, 2].span()); - transposed.reshape(target_shape: finalshape.span()) + transposed.reshape(target_shape: finalshape.span(), allowzero: false) } else { // assert mode == "CRD" - let tmpshape = array![*b, *C / (blocksize * blocksize), blocksize, blocksize, *H, *W]; - let reshaped = (tensor).reshape(target_shape: tmpshape.span()); + let tmpshape: Array = array![ + b, (C / (blocksize * blocksize)).try_into().unwrap(), blocksize_i32, blocksize_i32, H, W + ]; + let reshaped = (tensor).reshape(target_shape: tmpshape.span(), allowzero: false); let transposed = reshaped.transpose(axes: array![0, 1, 4, 2, 5, 3].span()); - transposed.reshape(target_shape: finalshape.span()) + transposed.reshape(target_shape: finalshape.span(), allowzero: false) } } diff --git a/src/operators/nn/functional/grid_sample.cairo b/src/operators/nn/functional/grid_sample.cairo index 1729a59f3..4762daea3 100644 --- a/src/operators/nn/functional/grid_sample.cairo +++ b/src/operators/nn/functional/grid_sample.cairo @@ -1,24 +1,10 @@ -use core::debug::PrintTrait; - use orion::numbers::FP16x16; use orion::numbers::NumberTrait; use orion::operators::tensor::core::{stride}; use orion::operators::tensor::{FP16x16Tensor, TensorTrait, Tensor, U32Tensor,}; use orion::operators::vec::{NullableVec, NullableVecImpl}; - -#[derive(Copy, Drop)] -enum MODE { - NEAREST, - LINEAR, - CUBIC, -} - -#[derive(Copy, Drop)] -enum PADDING_MODE { - ZEROS, - BORDER, - REFLECTION, -} +use orion::operators::nn::{MODE, PADDING_MODE}; +use orion::operators::nn::helpers::{dot, get_all_coord, prod, zeros, rint, reverse}; /// Cf: NNTrait::grid_sample docstring fn grid_sample< @@ -33,7 +19,6 @@ fn grid_sample< +Sub, +Div, +AddEq, - +PrintTrait, +PartialOrd, +PartialEq, +TryInto, @@ -80,7 +65,7 @@ fn grid_sample< y_dims.append_span(SpanTrait::slice(grid_dims, 1, grid_dims.len() - 2)); let y_dims = y_dims.span(); - if prod(y_dims, 0) == 0 { + if prod(y_dims) == 0 { return TensorTrait::new(array![].span(), array![].span()); } @@ -97,12 +82,12 @@ fn grid_sample< (*X).data, n * *x_stride.at(0) + c * *x_stride.at(1), *x_stride.at(1) ); let X_data_stride = SpanTrait::slice(x_stride, 2, grid_stride.len() - 2); - let all_coords = get_all_coords(SpanTrait::slice(grid_dims, 1, grid_dims.len() - 2)); + let all_coords = get_all_coord(SpanTrait::slice(grid_dims, 1, grid_dims.len() - 2)); let mut ix = 0; while ix != all_coords.len() { let ox = *all_coords.at(ix); - let nx = get_sub(grid_data, grid_data_stride, ox); + let nx = get_grid_data_subset(grid_data, grid_data_stride, ox); let nx = reverse(nx); let x = gs_denormalize_coordinates(nx, dims, align_corner); @@ -188,7 +173,6 @@ fn gs_cubic_interpolation_1d_with_x< +PartialOrd, +PartialEq, +Rem, - +PrintTrait, >( data: Span, x: T, border: Span, padding_mode: PADDING_MODE ) -> T { @@ -267,7 +251,6 @@ fn gs_cubic_interpolation_nd_with_x< +PartialOrd, +PartialEq, +Rem, - +PrintTrait, >( data: Span, data_dims: Span, @@ -339,7 +322,7 @@ fn gs_linear_interpolation_1d_with_x< +PartialOrd, +PartialEq, +Rem, - +PrintTrait + +AddEq, >( data: Span, x: T, border: Span, padding_mode: PADDING_MODE ) -> T { @@ -356,21 +339,6 @@ fn gs_linear_interpolation_1d_with_x< dot(coeffs, v) } -fn dot, +Copy, +NumberTrait, +Add, +TensorTrait, +Mul,>( - a: Span, b: Span -) -> T { - assert(a.len() == b.len(), 'dot: wrong len'); - - let mut i = 0; - let mut sum = NumberTrait::zero(); - while i != a.len() { - sum = sum + *a.at(i) * *b.at(i); - i += 1; - }; - - sum -} - fn gs_linear_interpolation_nd_with_x< T, MAG, @@ -387,7 +355,7 @@ fn gs_linear_interpolation_nd_with_x< +PartialOrd, +PartialEq, +Rem, - +PrintTrait + +AddEq >( data: Span, data_dims: Span, @@ -451,7 +419,6 @@ fn pixel_at_ndarray< +PartialOrd, +PartialEq, +Rem, - +PrintTrait, >( ndarray: Span, ndarray_dims: Span, @@ -526,7 +493,6 @@ fn pixel_at_array< +PartialOrd, +PartialEq, +Rem, - +PrintTrait, >( array: Span, i: T, border: Span, padding_mode: PADDING_MODE ) -> T { @@ -556,68 +522,6 @@ fn pixel_at_array< pixel } -fn zeros, +Copy, +NumberTrait>(n: usize) -> Span { - let mut zeros: Array = array![]; - let mut i = 0; - while i != n { - zeros.append(NumberTrait::zero()); - i += 1; - }; - - zeros.span() -} - -fn rint< - T, - MAG, - +Drop, - +Copy, - +NumberTrait, - +SubEq, - +Rem, - +PartialEq, - +PartialOrd, - +Add, - +Sub ->( - data: Span -) -> Span { - // round to nearest if ties rounds to the nearest even value. - let mut rint: Array = array![]; - let two: T = NumberTrait::one() + NumberTrait::one(); - - let mut i = 0; - while i != data.len() { - let x = *data.at(i); - let mut round = NumberTrait::round(x); - - let diff = round - x; - if diff == NumberTrait::half() { - if round % two != NumberTrait::zero() { - round -= NumberTrait::one() - } - } - - rint.append(round); - i += 1; - }; - - rint.span() -} - -fn clamp, +Copy, +NumberTrait, +PartialOrd>( - val: T, low: T, high: T -) -> T { - if val < low { - return low; - } - - if val > high { - return high; - } - - val -} fn gs_reflect< T, @@ -632,7 +536,6 @@ fn gs_reflect< +Div, +Mul, +Rem, - +PrintTrait, >( x: T, x_min: T, x_max: T ) -> T { @@ -668,18 +571,8 @@ fn gs_reflect< fx } -fn reverse, +Drop,>(data: Span) -> Span { - let mut rev: Array = array![]; - let mut i = data.len(); - while i != 0 { - rev.append(*data.at(i - 1)); - i -= 1; - }; - - rev.span() -} -fn get_sub, +Drop,>( +fn get_grid_data_subset, +Drop,>( data: Span, stride_data: Span, index: Span, ) -> Span { let mut acc_indices = 0; @@ -692,18 +585,6 @@ fn get_sub, +Drop,>( SpanTrait::slice(data, acc_indices, *stride_data.at(index.len() - 1)) } -fn prod, +Copy, +NumberTrait, +TensorTrait, +Mul,>( - pA: Span, start: usize -) -> T { - let mut i = start; - let mut prod = NumberTrait::one(); - while i != pA.len() { - prod = prod * (*pA.at(i)); - i += 1; - }; - - prod -} fn prepare_border< T, @@ -750,17 +631,6 @@ fn prepare_border< borders1.span() } -fn arange(start: usize, end: usize, step: usize) -> Span { - assert((end - start) % step == 0, 'incompatible step value'); - let mut arr: Array = array![]; - let mut i = start; - while i != end { - arr.append(i); - i += step; - }; - - arr.span() -} fn gs_denormalize_coordinates< T, @@ -817,103 +687,17 @@ fn gs_denormalize< x } -fn get_all_coords(shape: Span) -> Span> { - let mut all_indices = array![]; - - let mut i = 0; - while i != shape.len() { - all_indices.append(arange(0, *shape.at(i), 1)); - i += 1; - }; - - cartesian(all_indices.span()) -} - -fn cartesian(mut arrays: Span>,) -> Span> { - let mut n = 1; - let mut i = arrays.len() - 1; - loop { - n = n * (*(arrays.at(i))).len(); - if i == 0 { - break; - } - i -= 1; - }; - - let mut i = 0; - let mut size_arrays: Array = array![]; - while i != arrays.len() { - size_arrays.append((*(arrays.at(i))).len()); - i += 1; - }; - - let size_arrays = size_arrays.span(); - let mut output_arrays = ArrayTrait::>::new(); - let mut m = n; - - let mut i = 0; - while i != arrays.len() { - m = m / (*(arrays.at(i))).len(); - let mut out = repeat(*(arrays.at(i)), m); - out = repeat_2(out, size_arrays, i); - - output_arrays.append(out); - i += 1; - }; - - let output_arrays = output_arrays.span(); - - let mut i = 0; - let mut ret = array![]; - while i != n { - let mut j = 0; - let mut x = ArrayTrait::new(); - while j != arrays.len() { - x.append(*(output_arrays.at(j)).at(i)); - j += 1; - }; - - ret.append(x.span()); - i += 1; - }; - - ret.span() -} - -fn repeat_2(mut array: Array, size_array: Span, index: usize) -> Array { - let mut size = array.len(); - let mut i = 0; - while i != index { - let mut j = 1; - while j != *size_array.at(index - 1 - i) { - let mut k = 0; - while k != size { - array.append(*array.at(k)); - k += 1; - }; - - j += 1; - }; - - size = size * *size_array.at(index - 1 - i); - i += 1; - }; - array -} - -fn repeat(array: Span, m: usize,) -> Array { - let mut out: Array = array![]; - let mut j = 0; - while j != array.len() { - let mut k = 0; - while k != m { - out.append(*array.at(j)); - k += 1; - }; +fn clamp, +Copy, +NumberTrait, +PartialOrd>( + val: T, low: T, high: T +) -> T { + if val < low { + return low; + } - j += 1; - }; + if val > high { + return high; + } - out + val } diff --git a/src/operators/nn/functional/logsoftmax.cairo b/src/operators/nn/functional/logsoftmax.cairo index fdf89c43d..82283844f 100644 --- a/src/operators/nn/functional/logsoftmax.cairo +++ b/src/operators/nn/functional/logsoftmax.cairo @@ -10,7 +10,12 @@ fn logsoftmax< z: @Tensor, axis: usize ) -> Tensor { let exp_tensor = z.exp(); - let sum = exp_tensor.reduce_sum(axis, true); + let sum = exp_tensor + .reduce_sum( + Option::Some(array![axis.try_into().unwrap()].span()), + Option::Some(true), + Option::Some(false) + ); let softmax = exp_tensor / sum; let logsoftmax = softmax.log(); @@ -38,7 +43,12 @@ fn logsoftmaxWide< z: @Tensor, axis: usize ) -> Tensor { let exp_tensor: Tensor = exp_upcast(*z); - let sum = exp_tensor.reduce_sum(axis, true); + let sum = exp_tensor + .reduce_sum( + Option::Some(array![axis.try_into().unwrap()].span()), + Option::Some(true), + Option::Some(false) + ); let softmax = div_downcast(@exp_tensor, @sum); softmax.log() diff --git a/src/operators/nn/functional/max_pool.cairo b/src/operators/nn/functional/max_pool.cairo new file mode 100644 index 000000000..624cc2775 --- /dev/null +++ b/src/operators/nn/functional/max_pool.cairo @@ -0,0 +1,998 @@ +use core::clone::Clone; +use core::option::OptionTrait; +use core::array::ArrayTrait; +use orion::numbers::NumberTrait; +use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor, I32Tensor}; +use orion::operators::vec::{NullableVec, NullableVecImpl}; +use orion::operators::tensor::core::{stride}; +use core::debug::PrintTrait; +use core::traits::Into; +use orion::numbers::{U32IntoI32, I32IntoU32, I32Div, I32Number}; + +use orion::operators::nn::functional::common_pool::{common_pool}; +use orion::operators::nn::{AUTO_PAD, POOLING_TYPE}; + +/// Cf: NNTrait::max_pool docstring +fn max_pool< + T, + MAG, + +TensorTrait, + +NumberTrait, + +Copy, + +Drop, + +Add, + +Mul, + +Sub, + +Div, + +AddEq, + +PrintTrait, + +PartialOrd, + +PartialEq, + +TryInto, + +Into, + +Rem, + +Neg, + +SubEq, +>( + X: @Tensor, + auto_pad: Option, + ceil_mode: Option, + dilations: Option>, + kernel_shape: Span, + pads: Option>, + storage_order: Option, + strides: Option>, + output_len: usize, +) -> (Tensor, Option>) { + match dilations { + Option::Some(dilations) => { + if (min(dilations) != max(dilations) || min(dilations) != 1) { + max_pool_implementation( + X, + auto_pad, + ceil_mode, + Option::Some(dilations), + kernel_shape, + pads, + storage_order, + strides, + output_len, + ) + } else { + match strides { + Option::Some(strides) => { + if (min(strides) != max(strides) || min(strides) != 1) { + max_pool_implementation( + X, + auto_pad, + ceil_mode, + Option::Some(dilations), + kernel_shape, + pads, + storage_order, + Option::Some(strides), + output_len, + ) + } else { + common_pool( + POOLING_TYPE::MAX, + 0, + X, + auto_pad, + ceil_mode, + Option::Some(dilations), + kernel_shape, + pads, + Option::Some(strides), + 1, + ) + } + }, + Option::None => { + common_pool( + POOLING_TYPE::MAX, + 0, + X, + auto_pad, + ceil_mode, + Option::Some(dilations), + kernel_shape, + pads, + Option::None, + 1, + ) + }, + } + } + }, + Option::None => { + match strides { + Option::Some(strides) => { + if (min(strides) != max(strides) || min(strides) != 1) { + max_pool_implementation( + X, + auto_pad, + ceil_mode, + Option::None, + kernel_shape, + pads, + storage_order, + Option::Some(strides), + output_len, + ) + } else { + common_pool( + POOLING_TYPE::MAX, + 0, + X, + auto_pad, + ceil_mode, + Option::None, + kernel_shape, + pads, + Option::Some(strides), + 1, + ) + } + }, + Option::None => { + common_pool( + POOLING_TYPE::MAX, + 0, + X, + auto_pad, + ceil_mode, + Option::None, + kernel_shape, + pads, + Option::None, + 1, + ) + }, + } + } + } +} + + +fn max_pool_implementation< + T, + MAG, + +TensorTrait, + +NumberTrait, + +Copy, + +Drop, + +Add, + +Mul, + +Sub, + +Div, + +AddEq, + +PrintTrait, + +PartialOrd, + +PartialEq, + +TryInto, + +Into, + +Rem, + +Neg, + +SubEq, +>( + X: @Tensor, + auto_pad: Option, + ceil_mode: Option, + dilations: Option>, + kernel_shape: Span, + pads: Option>, + storage_order: Option, + strides: Option>, + output_len: usize, +) -> (Tensor, Option>) { + assert((*X).shape.len() >= 3, 'X must have at least 3 dim'); + let n_dims = kernel_shape.len(); + + let pads = match pads { + Option::Some(pads) => pads, + Option::None => { + let mut pads = ArrayTrait::new(); + let mut i = 0; + while i != n_dims { + pads.append(0); + pads.append(0); + i += 1; + }; + pads.span() + }, + }; + let dilations = match dilations { + Option::Some(dilations) => dilations, + Option::None => { + let mut dilations = ArrayTrait::new(); + let mut i = 0; + while i != n_dims { + dilations.append(1); + i += 1; + }; + dilations.span() + }, + }; + let strides = match strides { + Option::Some(strides) => strides, + Option::None => { + let mut strides = ArrayTrait::new(); + let mut i = 0; + while i != n_dims { + strides.append(1); + i += 1; + }; + strides.span() + }, + }; + + let auto_pad = match auto_pad { + Option::Some(auto_pad) => auto_pad, + Option::None => AUTO_PAD::NOTSET, + }; + + let storage_order = match storage_order { + Option::Some(storage_order) => storage_order, + Option::None => 0, + }; + + let input_spatial_shape = SpanTrait::slice((*X).shape, 2, (*X).shape.len() - 2); + + let ceil_mode = match ceil_mode { + Option::Some(ceil_mode) => ceil_mode, + Option::None => 0, + }; + + let output_spatial_shape = if ceil_mode == 1 { + let mut output_spatial_shape = ArrayTrait::::new(); + let mut i = 0; + while i != input_spatial_shape.len() { + let oss: T = NumberTrait::ceil( + (NumberTrait::new_unscaled( + (*input_spatial_shape.at(i) + *pads.at(i) + *pads.at(i + n_dims)).into(), false + ) + - NumberTrait::new_unscaled( + ((*kernel_shape.at(i) - 1) * *dilations.at(i) + 1).into(), false + )) + / NumberTrait::new_unscaled((*strides.at(i)).into(), false) + + NumberTrait::one() + ); + + let need_to_reduce_out_size_in_ceil_mode = (oss.try_into().unwrap() - 1) + * *strides.at(i) >= *input_spatial_shape.at(i) + + *pads.at(i); + if need_to_reduce_out_size_in_ceil_mode { + output_spatial_shape.append(oss.try_into().unwrap() - 1); + } else { + output_spatial_shape.append(oss.try_into().unwrap()); + }; + i += 1; + }; + + output_spatial_shape.span() + } else { + let mut output_spatial_shape = ArrayTrait::::new(); + let mut i = 0; + while i != input_spatial_shape.len() { + let oss: T = NumberTrait::floor( + (NumberTrait::new_unscaled( + (*input_spatial_shape.at(i) + *pads.at(i) + *pads.at(i + n_dims)).into(), false + ) + - NumberTrait::new_unscaled( + ((*kernel_shape.at(i) - 1) * *dilations.at(i) + 1).into(), false + )) + / NumberTrait::new_unscaled((*strides.at(i)).into(), false) + + NumberTrait::one() + ); + output_spatial_shape.append(oss.try_into().unwrap()); + i += 1; + }; + output_spatial_shape.span() + }; + + let (pads, output_spatial_shape) = match auto_pad { + AUTO_PAD::NOTSET => { (pads, output_spatial_shape) }, + AUTO_PAD::SAME_UPPER => { + let mut output_spatial_shape = ArrayTrait::::new(); + let mut pad_1 = ArrayTrait::new(); + let mut pad_2 = ArrayTrait::new(); + let mut pads = ArrayTrait::new(); + + let mut i = 0; + while i != input_spatial_shape.len() { + let oss: T = NumberTrait::ceil( + NumberTrait::new_unscaled((*input_spatial_shape.at(i)).into(), false) + / NumberTrait::new_unscaled((*strides.at(i)).into(), false) + ); + output_spatial_shape.append(oss.try_into().unwrap()); + + let pad_i = (*output_spatial_shape[i] - 1) * *strides[i] + + ((*kernel_shape[i] - 1) * *dilations[i] + 1) + - *input_spatial_shape[i]; + + pad_1.append(pad_i / 2); + pad_2.append(pad_i - (pad_i / 2)); + + i += 1; + }; + + pads.append_span(pad_1.span()); + pads.append_span(pad_2.span()); + + (pads.span(), output_spatial_shape.span()) + }, + AUTO_PAD::SAME_LOWER => { + let mut output_spatial_shape = ArrayTrait::::new(); + let mut pad_1 = ArrayTrait::new(); + let mut pad_2 = ArrayTrait::new(); + let mut pads = ArrayTrait::new(); + + let mut i = 0; + while i != input_spatial_shape.len() { + + let oss: T = NumberTrait::floor( + NumberTrait::new_unscaled((*input_spatial_shape.at(i)).into(), false) + / NumberTrait::new_unscaled((*strides.at(i)).into(), false) + ); + output_spatial_shape.append(oss.try_into().unwrap()); + + let pad_i = (*output_spatial_shape[i] - 1) * *strides[i] + + ((*kernel_shape[i] - 1) * *dilations[i] + 1) + - *input_spatial_shape[i]; + + pad_1.append(pad_i / 2); + pad_2.append(pad_i - (pad_i / 2)); + + i += 1; + }; + + pads.append_span(pad_1.span()); + pads.append_span(pad_2.span()); + + (pads.span(), output_spatial_shape.span()) + }, + AUTO_PAD::VALID => { + let mut output_spatial_shape = ArrayTrait::::new(); + let mut i = 0; + while i != input_spatial_shape.len() { + let oss: T = NumberTrait::ceil( + (NumberTrait::new_unscaled((*input_spatial_shape.at(i)).into(), false) + - NumberTrait::new_unscaled( + ((*kernel_shape.at(i) - 1) * *dilations.at(i) + 1).into(), false + ) + + NumberTrait::one()) + / NumberTrait::new_unscaled((*strides.at(i)).into(), false) + ); + output_spatial_shape.append(oss.try_into().unwrap()); + + i += 1; + }; + + (pads, output_spatial_shape.span()) + }, + }; + + let nd = input_spatial_shape.len(); + if nd == 1 { + return max_pool_1d( + X, + auto_pad, + ceil_mode, + dilations, + kernel_shape, + pads, + storage_order, + strides, + output_spatial_shape, + output_len + ); + } + if nd == 2 { + return max_pool_2d( + X, + auto_pad, + ceil_mode, + dilations, + kernel_shape, + pads, + storage_order, + strides, + output_spatial_shape, + output_len + ); + } + if nd == 3 { + return max_pool_3d( + X, + auto_pad, + ceil_mode, + dilations, + kernel_shape, + pads, + storage_order, + strides, + output_spatial_shape, + output_len + ); + } + + return max_pool_nd( + X, + auto_pad, + ceil_mode, + dilations, + kernel_shape, + pads, + storage_order, + strides, + output_spatial_shape, + output_len + ); +} + + +fn max_pool_1d, +NumberTrait, +Copy, +Drop, +PartialOrd,>( + X: @Tensor, + auto_pad: AUTO_PAD, + ceil_mode: usize, + dilations: Span, + kernel_shape: Span, + pads: Span, + storage_order: usize, + strides: Span, + output_spatial_shape: Span, + output_len: usize, +) -> (Tensor, Option>) { + let mut y_dims = ArrayTrait::new(); + y_dims.append_span(SpanTrait::slice((*X).shape, 0, 2)); + y_dims.append_span(output_spatial_shape); + + let N = *(*X).shape.at(0); + let C = *(*X).shape.at(1); + + let x_step = *(*X).shape.at(2); + let y_step = *y_dims.at(2); + + let total_channels = N * C; + + let stride_h = I32Number::new((*strides.at(0)).into(), false); + let dilation_h = I32Number::new((*dilations.at(0)).into(), false); + let ks_h = I32Number::new((*kernel_shape.at(0)).into(), false); + let pad_h = I32Number::new((*pads.at(0)).into(), false); + + let mut Y_data = ArrayTrait::new(); + let mut I_data = ArrayTrait::new(); + + let mut c = 0; + while c != total_channels { + let x_d = c * x_step; + + let mut ph = 0; + while ph != y_step { + let hstart = I32Number::new((ph).into(), false) * stride_h - pad_h; + let hend = hstart + ks_h * dilation_h; + + let mut h_index = I32Number::new(1, true); + let mut Yh: T = NumberTrait::min_value(); + + let mut h = hstart; + while h != hend { + if h >= 0 && h < x_step.into() { + if *(*X).data.at(x_d + h.into()) > Yh { + h_index = h.into(); + Yh = (*(*X).data.at(x_d + h.into())); + } + } + h += dilation_h; + }; + + Y_data.append(Yh); + I_data.append((c * x_step) + h_index.into()); + + ph += 1; + }; + c += 1; + }; + if output_len == 1 { + return (TensorTrait::new(y_dims.span(), Y_data.span()), Option::>::None); + } + return ( + TensorTrait::new(y_dims.span(), Y_data.span()), + Option::Some(TensorTrait::new(y_dims.span(), I_data.span())) + ); +} + +fn max_pool_2d< + T, + MAG, + +TensorTrait, + +NumberTrait, + +Copy, + +Drop, + +PartialOrd, + +PartialEq, + +PrintTrait +>( + X: @Tensor, + auto_pad: AUTO_PAD, + ceil_mode: usize, + dilations: Span, + kernel_shape: Span, + pads: Span, + storage_order: usize, + strides: Span, + output_spatial_shape: Span, + output_len: usize, +) -> (Tensor, Option>) { + let mut y_dims = ArrayTrait::new(); + y_dims.append_span(SpanTrait::slice((*X).shape, 0, 2)); + y_dims.append_span(output_spatial_shape); + + let N = *(*X).shape.at(0); + let C = *(*X).shape.at(1); + let H = *(*X).shape.at(2); + let W = *(*X).shape.at(3); + + let pooled_H = *y_dims.at(2); + let pooled_W = *y_dims.at(3); + + let x_step = H * W; + + let total_channels = N * C; + + let stride_h = I32Number::new((*strides.at(0)).into(), false); + let stride_w = I32Number::new((*strides.at(1)).into(), false); + + let dilation_h = I32Number::new((*dilations.at(0)).into(), false); + let dilation_w = I32Number::new((*dilations.at(1)).into(), false); + + let ks_h = I32Number::new((*kernel_shape.at(0)).into(), false); + let ks_w = I32Number::new((*kernel_shape.at(1)).into(), false); + + let pad_h = I32Number::new((*pads.at(0)).into(), false); + let pad_w = I32Number::new((*pads.at(1)).into(), false); + + let mut Y_data = ArrayTrait::new(); + let mut I_data = ArrayTrait::new(); + + let X_len = (*X).data.len(); + + let mut c = 0; + while c != total_channels { + let x_d = c * x_step; + + let mut ph = 0; + while ph != pooled_H { + let hstart = I32Number::new((ph).into(), false) * stride_h - pad_h; + let hend = hstart + ks_h * dilation_h; + + let mut pw = 0; + while pw != pooled_W { + let wstart = I32Number::new((pw).into(), false) * stride_w - pad_w; + let wend = wstart + ks_w * dilation_w; + + let mut h_index = I32Number::new(1, true); + let mut w_index = I32Number::new(1, true); + + let mut Yh: T = NumberTrait::min_value(); + + let mut h = hstart; + while h != hend { + if h >= 0 && h < H.into() { + let mut w = wstart; + while w != wend { + if w >= 0 && w < W.into() { + let input_index = h * W.into() + w; + if input_index >= 0 && input_index < X_len.into() { + if *(*X).data.at(x_d + input_index.into()) > Yh { + h_index = h.into(); + w_index = w.into(); + Yh = (*(*X).data.at(x_d + input_index.into())); + } + } + } + w += dilation_w; + }; + }; + h += dilation_h; + }; + + if Yh != NumberTrait::::min_value() { + Y_data.append(Yh); + if storage_order == 0 { + I_data.append((c * x_step) + h_index.into() * W + w_index.into()); + } else { + I_data.append((c * x_step) + h_index.into() + w_index.into() * H); + } + } + pw += 1; + }; + ph += 1; + }; + c += 1; + }; + + if output_len == 1 { + return (TensorTrait::new(y_dims.span(), Y_data.span()), Option::>::None); + } + return ( + TensorTrait::new(y_dims.span(), Y_data.span()), + Option::Some(TensorTrait::new(y_dims.span(), I_data.span())) + ); +} + +fn max_pool_3d< + T, + MAG, + +TensorTrait, + +NumberTrait, + +Copy, + +Drop, + +PartialOrd, + +PartialEq, + +PrintTrait +>( + X: @Tensor, + auto_pad: AUTO_PAD, + ceil_mode: usize, + dilations: Span, + kernel_shape: Span, + pads: Span, + storage_order: usize, + strides: Span, + output_spatial_shape: Span, + output_len: usize, +) -> (Tensor, Option>) { + let mut y_dims = ArrayTrait::new(); + y_dims.append_span(SpanTrait::slice((*X).shape, 0, 2)); + y_dims.append_span(output_spatial_shape); + + let N = *(*X).shape.at(0); + let C = *(*X).shape.at(1); + let H = *(*X).shape.at(2); + let W = *(*X).shape.at(3); + let D = *(*X).shape.at(4); + + let pooled_H = *y_dims.at(2); + let pooled_W = *y_dims.at(3); + let pooled_D = *y_dims.at(4); + + let x_step = H * W * D; + + let total_channels = N * C; + + let stride_h = I32Number::new((*strides.at(0)).into(), false); + let stride_w = I32Number::new((*strides.at(1)).into(), false); + let stride_d = I32Number::new((*strides.at(2)).into(), false); + + let dilation_h = I32Number::new((*dilations.at(0)).into(), false); + let dilation_w = I32Number::new((*dilations.at(1)).into(), false); + let dilation_d = I32Number::new((*dilations.at(2)).into(), false); + + let ks_h = I32Number::new((*kernel_shape.at(0)).into(), false); + let ks_w = I32Number::new((*kernel_shape.at(1)).into(), false); + let ks_d = I32Number::new((*kernel_shape.at(2)).into(), false); + + let pad_h = I32Number::new((*pads.at(0)).into(), false); + let pad_w = I32Number::new((*pads.at(1)).into(), false); + let pad_d = I32Number::new((*pads.at(2)).into(), false); + + let mut Y_data = ArrayTrait::new(); + let mut I_data = ArrayTrait::new(); + + let X_len = (*X).data.len(); + + let mut c = 0; + + while c != total_channels { + let x_d = c * x_step; + + let mut ph = 0; + while ph != pooled_H { + let hstart = I32Number::new((ph).into(), false) * stride_h - pad_h; + let hend = hstart + ks_h * dilation_h; + + let mut pw = 0; + while pw != pooled_W { + let wstart = I32Number::new((pw).into(), false) * stride_w - pad_w; + let wend = wstart + ks_w * dilation_w; + + let mut pd = 0; + while pd != pooled_D { + let dstart = I32Number::new((pd).into(), false) * stride_d - pad_d; + let dend = dstart + ks_d * dilation_d; + + let mut h_index = I32Number::new(1, true); + let mut w_index = I32Number::new(1, true); + let mut d_index = I32Number::new(1, true); + + let mut Yh: T = NumberTrait::min_value(); + + let mut h = hstart; + while h != hend { + if h >= 0 && h < H.into() { + let mut w = wstart; + while w != wend { + if w >= 0 && w < W.into() { + let mut d = dstart; + while d != dend { + if d >= 0 && d < D.into() { + let input_index = h * W.into() * D.into() + + w * D.into() + + d; + if input_index >= 0 && input_index < X_len.into() { + if *(*X).data.at(x_d + input_index.into()) > Yh { + h_index = h.into(); + w_index = w.into(); + d_index = d.into(); + Yh = (*(*X).data.at(x_d + input_index.into())); + } + } + } + d += dilation_d; + }; + }; + w += dilation_w; + }; + }; + h += dilation_h; + }; + Y_data.append(Yh); + + if storage_order == 0 { + I_data + .append( + (c * x_step) + + h_index.into() * W * D + + w_index.into() * D + + d_index.into() + ); + } else { + I_data + .append( + (c * x_step) + + h_index.into() + + w_index.into() * H + + d_index.into() * H * W + ); + } + pd += 1; + }; + pw += 1; + }; + ph += 1; + }; + c += 1; + }; + + if output_len == 1 { + return (TensorTrait::new(y_dims.span(), Y_data.span()), Option::>::None); + } + return ( + TensorTrait::new(y_dims.span(), Y_data.span()), + Option::Some(TensorTrait::new(y_dims.span(), I_data.span())) + ); +} + + +fn max_pool_nd< + T, + MAG, + +TensorTrait, + +NumberTrait, + +Copy, + +Drop, + +PartialOrd, + +PartialEq, + +PrintTrait, + +TryInto, + +Into, + +Div +>( + X: @Tensor, + auto_pad: AUTO_PAD, + ceil_mode: usize, + dilations: Span, + kernel_shape: Span, + pads: Span, + storage_order: usize, + strides: Span, + output_spatial_shape: Span, + output_len: usize, +) -> (Tensor, Option>) { + let nd = (*X).shape.len() - 2; + + let mut y_dims = ArrayTrait::new(); + y_dims.append_span(SpanTrait::slice((*X).shape, 0, 2)); + y_dims.append_span(output_spatial_shape); + + let N = *(*X).shape.at(0); + let C = *(*X).shape.at(1); + + let x_stride = stride((*X).shape); + let y_stride = stride(y_dims.span()); + + let i_stride_storage_order_1 = if storage_order == 1 { + let i_stride_storage_order_1 = reverse_stride(SpanTrait::slice((*X).shape, 2, nd)); + i_stride_storage_order_1 + } else { + array![].span() + }; + + let x_step = *x_stride.at(1); + let y_step = *y_stride.at(1); + + let total_channels = N * C; + + let stride_n: Span = u32_span_into_i32_span(strides); + let dilation_n: Span = u32_span_into_i32_span(dilations); + let ks_n: Span = u32_span_into_i32_span(kernel_shape); + let pad_n: Span = u32_span_into_i32_span(pads); + + let mut Y_data = ArrayTrait::new(); + let mut I_data = ArrayTrait::new(); + + let X_len = (*X).data.len(); + + let mut c = 0; + while c != total_channels { + let x_d = c * x_step; + + let mut p = 0; + while p != y_step { + + let mut flatten_index = p; + + let mut nstart = ArrayTrait::new(); + let mut nend = ArrayTrait::new(); + let mut nstep = ArrayTrait::::new(); + + let mut n = 0; + while n != nd { + let (pn, rem) = DivRem::div_rem( + flatten_index, (*y_stride.at(2 + n)).try_into().unwrap() + ); + flatten_index = rem; + + let ns = pn.into() * *stride_n.at(n) - *pad_n.at(n); + nstart.append(ns); + nend.append(ns + *ks_n.at(n) * *dilation_n.at(n)); + + let a: T = NumberTrait::new_unscaled( + (*kernel_shape.at(n) * *dilations.at(n)).into(), false + ); + let b: T = NumberTrait::new_unscaled((*dilations.at(n)).into(), false); + nstep.append(NumberTrait::ceil(a / b).try_into().unwrap()); + n += 1; + }; + + let nstart = nstart.span(); + let nstride = stride(nstep.span()); + let max_iter = *nstep.at(0) * *nstride.at(0); + + let mut n_index = array![I32Number::new(1, true)].span(); + + let mut Yh: T = NumberTrait::min_value(); + + let mut i = 0; + while i != max_iter { + let mut flatten_index = i; + let mut is_outside = false; + let mut i_index = ArrayTrait::new(); + let mut input_index = I32Number::zero(); + + let mut n = 0; + while n != nd { + let (item, rem) = DivRem::div_rem( + flatten_index, (*nstride.at(n)).try_into().unwrap() + ); + flatten_index = rem; + + let item_ = item.into() * *dilation_n.at(n) + *nstart.at(n); + if item_ < 0 || item_ >= (*(*X).shape.at(2 + n)).into() { + is_outside = true; + }; + i_index.append(item_); + input_index += item_ * (*x_stride.at(2 + n)).into(); + + n += 1; + }; + + if !is_outside { + if input_index >= 0 && input_index < X_len.into() { + if *(*X).data.at(x_d + input_index.into()) > Yh { + n_index = i_index.span().clone(); + Yh = (*(*X).data.at(x_d + input_index.into())); + }; + }; + }; + i += 1; + }; + Y_data.append(Yh); + + if storage_order == 0 { + let mut index = 0; + let mut n = 0; + while n != nd { + index += *n_index.at(n) * (*x_stride.at(2 + n)).into(); + n += 1; + }; + I_data.append((c * x_step) + index.into()); + } else { + let mut index = 0; + let mut n = nd; + while n != 0 { + index += *n_index.at(n - 1) * (*i_stride_storage_order_1.at(nd - n)).into(); + n -= 1; + }; + I_data.append((c * x_step) + index.into()); + } + p += 1; + }; + c += 1; + }; + if output_len == 1 { + return (TensorTrait::new(y_dims.span(), Y_data.span()), Option::>::None); + } + return ( + TensorTrait::new(y_dims.span(), Y_data.span()), + Option::Some(TensorTrait::new(y_dims.span(), I_data.span())) + ); +} + + +fn u32_span_into_i32_span(mut x: Span) -> Span { + let mut res = ArrayTrait::new(); + + loop { + match x.pop_front() { + Option::Some(v) => { res.append((*v).into()); }, + Option::None => { break res.span(); } + }; + } +} + +fn reverse_stride(mut a: Span) -> Span { + let mut prod = 1; + let mut arr = ArrayTrait::new(); + loop { + match a.pop_front() { + Option::Some(v) => { + prod *= *v; + arr.append(prod); + }, + Option::None => { break arr.span(); } + }; + } +} + + +fn min(mut a: Span) -> usize { + assert(a.len() > 0, 'span cannot be empty'); + + let mut min = *a.at(0); + loop { + match a.pop_front() { + Option::Some(v) => { if *v < min { + min = *v; + }; }, + Option::None => { break min; } + }; + } +} + + +fn max(mut a: Span) -> usize { + assert(a.len() > 0, 'span cannot be empty'); + + let mut max = *a.at(0); + loop { + match a.pop_front() { + Option::Some(v) => { if *v > max { + max = *v; + }; }, + Option::None => { break max; } + }; + } +} diff --git a/src/operators/nn/functional/softmax.cairo b/src/operators/nn/functional/softmax.cairo index 10602bde7..108b1292f 100644 --- a/src/operators/nn/functional/softmax.cairo +++ b/src/operators/nn/functional/softmax.cairo @@ -10,10 +10,16 @@ fn softmax< impl TCopy: Copy, impl TDrop: Drop, >( - z: @Tensor, axis: usize + z: @Tensor, axis: Option ) -> Tensor { + let axis = match axis { + Option::Some(val) => val, + Option::None => -1 + }; + let exp_tensor = z.exp(); - let sum = exp_tensor.reduce_sum(axis, true); + let sum = exp_tensor + .reduce_sum(Option::Some(array![axis].span()), Option::Some(true), Option::Some(false)); exp_tensor / sum } @@ -36,10 +42,16 @@ fn softmaxWide< impl TFixed: FixedTrait, impl WFixed: FixedTrait, >( - z: @Tensor, axis: usize + z: @Tensor, axis: Option ) -> Tensor { + let axis = match axis { + Option::Some(val) => val, + Option::None => -1 + }; + let exp_tensor: Tensor = exp_upcast(*z); - let sum = exp_tensor.reduce_sum(axis, true); + let sum = exp_tensor + .reduce_sum(Option::Some(array![axis].span()), Option::Some(true), Option::Some(false)); div_downcast(@exp_tensor, @sum) } diff --git a/src/operators/nn/functional/space_to_depth.cairo b/src/operators/nn/functional/space_to_depth.cairo index d8e8089cb..bfaf61774 100644 --- a/src/operators/nn/functional/space_to_depth.cairo +++ b/src/operators/nn/functional/space_to_depth.cairo @@ -1,3 +1,4 @@ +use core::option::OptionTrait; use orion::numbers::fixed_point::core::FixedTrait; use orion::numbers::NumberTrait; use orion::operators::tensor::core::{Tensor, TensorTrait}; @@ -20,14 +21,28 @@ fn space_to_depth< ) -> Tensor { assert((tensor.shape).len() == 4, 'Unexpected shape 4.'); - let b = (tensor.shape).at(0); - let C = (tensor.shape).at(1); - let H = (tensor.shape).at(2); - let W = (tensor.shape).at(3); - let tmpshape = array![*b, *C, *H / blocksize, blocksize, *W / blocksize, blocksize]; - let reshaped = (tensor).reshape(target_shape: tmpshape.span()); + let blocksize_i32: i32 = blocksize.try_into().unwrap(); + + let b: i32 = (*(tensor.shape).at(0)).try_into().unwrap(); + let C: i32 = (*(tensor.shape).at(1)).try_into().unwrap(); + let H: u32 = (*(tensor.shape).at(2)); + let W: u32 = (*(tensor.shape).at(3)); + let tmpshape = array![ + b, + C, + (H / blocksize).try_into().unwrap(), + blocksize_i32, + (W / blocksize).try_into().unwrap(), + blocksize_i32 + ]; + let reshaped = (tensor).reshape(target_shape: tmpshape.span(), allowzero: false); let transposed = reshaped.transpose(axes: array![0, 3, 5, 1, 2, 4].span()); - let finalshape = array![*b, *C * blocksize * blocksize, *H / blocksize, *W / blocksize]; + let finalshape = array![ + b, + C * blocksize_i32 * blocksize_i32, + (H / blocksize).try_into().unwrap(), + (W / blocksize).try_into().unwrap() + ]; - transposed.reshape(target_shape: finalshape.span()) + transposed.reshape(target_shape: finalshape.span(), allowzero: false) } diff --git a/src/operators/nn/helpers.cairo b/src/operators/nn/helpers.cairo new file mode 100644 index 000000000..92d7656c9 --- /dev/null +++ b/src/operators/nn/helpers.cairo @@ -0,0 +1,310 @@ +use orion::numbers::NumberTrait; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::core::{stride, unravel_index}; +use orion::operators::tensor::math::max_in_tensor::max_in_tensor; +use orion::operators::tensor::math::min_in_tensor::min_in_tensor; + + +/// Computes the Cartesian product of multiple arrays. +/// +/// # Arguments +/// * `arrays` - `Span>`, Span containing N spans of usize elements. +/// +/// # Example +// cartesian([1, 2, 3], [4, 5], [6, 7]) +/// +/// >>> [ +/// [1, 4, 6], +/// [1, 4, 7], +/// [1, 5, 6], +/// [1, 5, 7], +/// [2, 4, 6], +/// [2, 4, 7], +/// [2, 5, 6], +/// [2, 5, 7], +/// [3, 4, 6], +/// [3, 4, 7], +/// [3, 5, 6], +/// [3, 5, 7] +/// ] +/// +/// # Returns +/// * A `Span>` containing the result of the Cartesian product. +fn cartesian(mut arrays: Span>,) -> Span> { + let n_array = arrays.len(); + let mut res = ArrayTrait::new(); + let mut n_item = 1; + let mut size_arrays = ArrayTrait::new(); + let mut iter = arrays.clone(); + loop { + match iter.pop_front() { + Option::Some(array) => { + let dim = (*array).len(); + n_item *= dim; + size_arrays.append(dim); + }, + Option::None => { break; } + } + }; + let stride = stride(size_arrays.span()); + + let mut i = 0; + loop { + if i == n_item { + break; + } + let mut flatten_index = i; + let mut item = ArrayTrait::new(); + + let mut n = 0; + loop { + if n == n_array { + break; + } + let (n_index, rem) = DivRem::div_rem( + flatten_index, (*stride.at(n)).try_into().unwrap() + ); + flatten_index = rem; + item.append(*(*arrays.at(n)).at(n_index)); + n += 1; + }; + res.append(item.span()); + i += 1; + }; + + return res.span(); +} + + +/// Computes all coordinates given the shape of a tensor. +/// +/// # Arguments +/// * `shape` - `Span`, A span containing the shape of the tensor as usize elements. +/// +/// # Returns +/// * A span of spans representing all possible coordinates of the tensor. +fn get_all_coord(mut shape: Span) -> Span> { + let mut res = ArrayTrait::new(); + + let stride = stride(shape); + let n_item = *stride.at(0) * *shape.at(0); + let dim = shape.len(); + + let mut i = 0; + loop { + if i == n_item { + break; + } + let mut flatten_index = i; + let mut indices = ArrayTrait::new(); + + let mut n = 0; + loop { + if n == dim { + break; + } + let (n_index, rem) = DivRem::div_rem( + flatten_index, (*stride.at(n)).try_into().unwrap() + ); + flatten_index = rem; + indices.append(n_index); + n += 1; + }; + res.append(indices.span()); + i += 1; + }; + + return res.span(); +} + +/// Checks if an index is out of bounds given the shape of a tensor. +/// +/// # Arguments +/// * `ind` - `Span` - A span containing the index of the tensor as usize elements. +/// * `shape` - `Span` - A span containing the shape of the tensor as usize elements. +/// +/// # Returns +/// * `true` if the index is out of bounds, otherwise `false`. +fn is_out(ind: Span, shape: Span,) -> bool { + let mut n = 0; + let is_out = loop { + if n == ind.len() { + break false; + } + let s = *shape.at(n); + let i = *ind.at(n); + if i < 0 { + break true; + } + if i >= s { + break true; + } + n += 1; + }; + return is_out; +} + +/// Computes the product of all the elements of the input span +/// +/// # Arguments +/// * `a` - `Span`, input span. +/// +/// # Returns +/// * `prod` - `T`, result of the product. +fn prod, +Copy, +NumberTrait, +TensorTrait, +MulEq,>( + mut a: Span +) -> T { + let mut prod = NumberTrait::one(); + loop { + match a.pop_front() { + Option::Some(v) => { prod *= *v; }, + Option::None => { break prod; } + }; + } +} + + +/// Computes the product of all the elements of the input span +/// +/// # Arguments +/// * `a` - `Span`, input span. +/// * `start` - usize. +/// +/// # Returns +/// * `prod` - `T`, result of the product. +fn prod_on_subset, +Copy, +NumberTrait, +TensorTrait, +Mul,>( + a: Span, start: usize +) -> T { + let mut i = start; + let mut prod = NumberTrait::one(); + while i != a.len() { + prod = prod * (*a.at(i)); + i += 1; + }; + + prod +} + +/// Computes the dot product of the inputs span +/// +/// # Arguments +/// * `a` - `Span`, input span. +/// * `b` - `Span`, input span. +/// +/// # Returns +/// * `acc` - `T`, result of the dot product. +fn dot, +Copy, +NumberTrait, +TensorTrait, +AddEq, +Mul,>( + a: Span, b: Span +) -> T { + let mut i = 0; + let mut acc = NumberTrait::zero(); + while i != a.len() { + acc += *a.at(i) * *b.at(i); + i += 1; + }; + + acc +} + + +/// Return evenly spaced values within a given interval. +/// Values are generated within the half-open interval [0, end) (in other words, the interval including start but excluding stop). +/// +/// # Arguments +/// * `start` - usize +/// * `end` - usize +/// * `step` - usize +/// +/// # Returns +//// returns a span of len ceil((end - start) / step), containing the values from `start` to the closest integer to `end` in the interval [0, end) with interval `step`. +fn arange(start: usize, end: usize, step: usize) -> Span { + let mut arr: Array = array![]; + let mut i = start; + while i < end { + arr.append(i); + i += step; + }; + + arr.span() +} + +/// Return a span containing `n` zeros of type `T` +/// +/// # Arguments +/// * `n` - usize +/// +fn zeros, +Copy, +NumberTrait>(n: usize) -> Span { + let mut zeros: Array = array![]; + let mut i = 0; + while i != n { + zeros.append(NumberTrait::zero()); + i += 1; + }; + + zeros.span() +} + + +/// Round elements of the span to the nearest integer. For values exactly halfway between rounded decimal valuesrounds to the nearest even value. +/// +/// # Arguments +/// * `data` - `Span` +/// +/// # Returns +//// a `Span` countaining the rounded values. +fn rint< + T, + MAG, + +Drop, + +Copy, + +NumberTrait, + +SubEq, + +Rem, + +PartialEq, + +PartialOrd, + +Add, + +Sub +>( + data: Span +) -> Span { + let mut rint: Array = array![]; + let two: T = NumberTrait::one() + NumberTrait::one(); + + let mut i = 0; + while i != data.len() { + let x = *data.at(i); + let mut round = NumberTrait::round(x); + + let diff = round - x; + if diff == NumberTrait::half() { + if round % two != NumberTrait::zero() { + round -= NumberTrait::one() + } + } + + rint.append(round); + i += 1; + }; + + rint.span() +} + + +/// Reverse the span input +/// +/// # Arguments +/// * `data` - `Span` +/// +/// # Returns +//// a `Span` countaining the reversed values. +fn reverse, +Drop,>(data: Span) -> Span { + let mut rev: Array = array![]; + let mut i = data.len(); + while i != 0 { + rev.append(*data.at(i - 1)); + i -= 1; + }; + + rev.span() +} + diff --git a/src/operators/nn/implementations/nn_fp16x16.cairo b/src/operators/nn/implementations/nn_fp16x16.cairo index 2bf9b033d..6f5911a99 100644 --- a/src/operators/nn/implementations/nn_fp16x16.cairo +++ b/src/operators/nn/implementations/nn_fp16x16.cairo @@ -3,14 +3,15 @@ use orion::operators::nn::core::NNTrait; use orion::operators::nn::functional; use orion::numbers::fixed_point::implementations::fp16x16::core::FP16x16; use orion::operators::tensor::implementations::tensor_fp16x16::{ - FP16x16Tensor, FP16x16TensorDiv, FP16x16TensorAdd + FP16x16Tensor, FP16x16TensorDiv, FP16x16TensorAdd, FP16x16TensorMul }; use orion::numbers::fixed_point::implementations::fp16x16wide::core::{ FP16x16WImpl, FP16x16WTryIntoFP16x16, FP16x16W, FP16x16IntoFP16x16W }; use orion::operators::tensor::implementations::tensor_fp16x16wide::{ - FP16x16WTensor, FP16x16WTensorDiv, FP16x16WTensorAdd + FP16x16WTensor, FP16x16WTensorDiv, FP16x16WTensorAdd, FP16x16WTensorMul }; +use orion::operators::nn::{AUTO_PAD, MODE, PADDING_MODE}; impl FP16x16NN of NNTrait { fn relu(tensor: @Tensor) -> Tensor { @@ -21,7 +22,7 @@ impl FP16x16NN of NNTrait { functional::sigmoid::sigmoid(*tensor) } - fn softmax(tensor: @Tensor, axis: usize) -> Tensor { + fn softmax(tensor: @Tensor, axis: Option) -> Tensor { functional::softmax::softmaxWide::(tensor, axis) } @@ -85,8 +86,8 @@ impl FP16x16NN of NNTrait { X: @Tensor, grid: @Tensor, align_corner: Option, - mode: Option, - padding_mode: Option, + mode: Option, + padding_mode: Option, ) -> Tensor { functional::grid_sample::grid_sample(X, grid, align_corner, mode, padding_mode) } @@ -134,7 +135,7 @@ impl FP16x16NN of NNTrait { X: @Tensor, W: @Tensor, B: Option>, - auto_pad: Option, + auto_pad: Option, dilations: Option>, group: Option, kernel_shape: Option>, @@ -158,4 +159,44 @@ impl FP16x16NN of NNTrait { ) -> Tensor { panic(array!['not supported!']) } + + fn max_pool( + X: @Tensor, + auto_pad: Option, + ceil_mode: Option, + dilations: Option>, + kernel_shape: Span, + pads: Option>, + storage_order: Option, + strides: Option>, + output_len: usize, + ) -> (Tensor, Option>) { + functional::max_pool::max_pool( + X, + auto_pad, + ceil_mode, + dilations, + kernel_shape, + pads, + storage_order, + strides, + output_len) + } + fn deform_conv( + X: @Tensor, + W: @Tensor, + offset: @Tensor, + B: Option>, + mask: Option>, + dilations: Option>, + group: Option, + kernel_shape: Option>, + offset_group: Option, + pads: Option>, + strides: Option>, + ) -> Tensor { + functional::deform_conv::deform_conv( + X, W, offset, B, mask, dilations, group, kernel_shape, offset_group, pads, strides, + ) + } } diff --git a/src/operators/nn/implementations/nn_fp32x32.cairo b/src/operators/nn/implementations/nn_fp32x32.cairo index 1816a3311..c97f48f70 100644 --- a/src/operators/nn/implementations/nn_fp32x32.cairo +++ b/src/operators/nn/implementations/nn_fp32x32.cairo @@ -3,8 +3,9 @@ use orion::operators::nn::core::NNTrait; use orion::operators::nn::functional; use orion::numbers::fixed_point::implementations::fp32x32::core::{FP32x32, FP32x32Impl}; use orion::operators::tensor::implementations::tensor_fp32x32::{ - FP32x32Tensor, FP32x32TensorDiv, FP32x32TensorAdd + FP32x32Tensor, FP32x32TensorDiv, FP32x32TensorAdd, FP32x32TensorMul }; +use orion::operators::nn::{AUTO_PAD, MODE, PADDING_MODE}; impl FP32x32NN of NNTrait { fn relu(tensor: @Tensor) -> Tensor { @@ -15,7 +16,7 @@ impl FP32x32NN of NNTrait { functional::sigmoid::sigmoid(*tensor) } - fn softmax(tensor: @Tensor, axis: usize) -> Tensor { + fn softmax(tensor: @Tensor, axis: Option) -> Tensor { functional::softmax::softmax(tensor, axis) } @@ -79,8 +80,8 @@ impl FP32x32NN of NNTrait { X: @Tensor, grid: @Tensor, align_corner: Option, - mode: Option, - padding_mode: Option, + mode: Option, + padding_mode: Option, ) -> Tensor { functional::grid_sample::grid_sample(X, grid, align_corner, mode, padding_mode) } @@ -128,7 +129,7 @@ impl FP32x32NN of NNTrait { X: @Tensor, W: @Tensor, B: Option>, - auto_pad: Option, + auto_pad: Option, dilations: Option>, group: Option, kernel_shape: Option>, @@ -152,4 +153,44 @@ impl FP32x32NN of NNTrait { ) -> Tensor { panic(array!['not supported!']) } + + fn max_pool( + X: @Tensor, + auto_pad: Option, + ceil_mode: Option, + dilations: Option>, + kernel_shape: Span, + pads: Option>, + storage_order: Option, + strides: Option>, + output_len: usize, + ) -> (Tensor, Option>) { + functional::max_pool::max_pool( + X, + auto_pad, + ceil_mode, + dilations, + kernel_shape, + pads, + storage_order, + strides, + output_len) + } + fn deform_conv( + X: @Tensor, + W: @Tensor, + offset: @Tensor, + B: Option>, + mask: Option>, + dilations: Option>, + group: Option, + kernel_shape: Option>, + offset_group: Option, + pads: Option>, + strides: Option>, + ) -> Tensor { + functional::deform_conv::deform_conv( + X, W, offset, B, mask, dilations, group, kernel_shape, offset_group, pads, strides, + ) + } } diff --git a/src/operators/nn/implementations/nn_fp64x64.cairo b/src/operators/nn/implementations/nn_fp64x64.cairo index 3b1200ac0..18b78c62f 100644 --- a/src/operators/nn/implementations/nn_fp64x64.cairo +++ b/src/operators/nn/implementations/nn_fp64x64.cairo @@ -3,8 +3,9 @@ use orion::operators::nn::core::NNTrait; use orion::operators::nn::functional; use orion::numbers::fixed_point::implementations::fp64x64::core::{FP64x64, FP64x64Impl}; use orion::operators::tensor::implementations::tensor_fp64x64::{ - FP64x64Tensor, FP64x64TensorDiv, FP64x64TensorAdd + FP64x64Tensor, FP64x64TensorDiv, FP64x64TensorAdd, FP64x64TensorMul }; +use orion::operators::nn::{AUTO_PAD, MODE, PADDING_MODE}; impl FP64x64NN of NNTrait { fn relu(tensor: @Tensor) -> Tensor { @@ -15,7 +16,7 @@ impl FP64x64NN of NNTrait { functional::sigmoid::sigmoid(*tensor) } - fn softmax(tensor: @Tensor, axis: usize) -> Tensor { + fn softmax(tensor: @Tensor, axis: Option) -> Tensor { functional::softmax::softmax(tensor, axis) } @@ -79,8 +80,8 @@ impl FP64x64NN of NNTrait { X: @Tensor, grid: @Tensor, align_corner: Option, - mode: Option, - padding_mode: Option, + mode: Option, + padding_mode: Option, ) -> Tensor { functional::grid_sample::grid_sample(X, grid, align_corner, mode, padding_mode) } @@ -128,7 +129,7 @@ impl FP64x64NN of NNTrait { X: @Tensor, W: @Tensor, B: Option>, - auto_pad: Option, + auto_pad: Option, dilations: Option>, group: Option, kernel_shape: Option>, @@ -152,4 +153,44 @@ impl FP64x64NN of NNTrait { ) -> Tensor { panic(array!['not supported!']) } + + fn max_pool( + X: @Tensor, + auto_pad: Option, + ceil_mode: Option, + dilations: Option>, + kernel_shape: Span, + pads: Option>, + storage_order: Option, + strides: Option>, + output_len: usize, + ) -> (Tensor, Option>) { + functional::max_pool::max_pool( + X, + auto_pad, + ceil_mode, + dilations, + kernel_shape, + pads, + storage_order, + strides, + output_len) + } + fn deform_conv( + X: @Tensor, + W: @Tensor, + offset: @Tensor, + B: Option>, + mask: Option>, + dilations: Option>, + group: Option, + kernel_shape: Option>, + offset_group: Option, + pads: Option>, + strides: Option>, + ) -> Tensor { + functional::deform_conv::deform_conv( + X, W, offset, B, mask, dilations, group, kernel_shape, offset_group, pads, strides, + ) + } } diff --git a/src/operators/nn/implementations/nn_fp8x23.cairo b/src/operators/nn/implementations/nn_fp8x23.cairo index 041ce10e3..f2a08f542 100644 --- a/src/operators/nn/implementations/nn_fp8x23.cairo +++ b/src/operators/nn/implementations/nn_fp8x23.cairo @@ -3,12 +3,13 @@ use orion::operators::nn::core::NNTrait; use orion::operators::nn::functional; use orion::numbers::fixed_point::implementations::fp8x23::core::FP8x23; use orion::operators::tensor::implementations::tensor_fp8x23::{ - FP8x23Tensor, FP8x23TensorDiv, FP8x23TensorAdd + FP8x23Tensor, FP8x23TensorDiv, FP8x23TensorAdd, FP8x23TensorMul }; use orion::numbers::fixed_point::implementations::fp8x23wide::core::{ FP8x23WImpl, FP8x23WTryIntoFP8x23, FP8x23W, FP8x23IntoFP8x23W }; use orion::operators::tensor::implementations::tensor_fp8x23wide::{FP8x23WTensor}; +use orion::operators::nn::{AUTO_PAD, MODE, PADDING_MODE}; impl FP8x23NN of NNTrait { fn relu(tensor: @Tensor) -> Tensor { @@ -19,7 +20,7 @@ impl FP8x23NN of NNTrait { functional::sigmoid::sigmoid(*tensor) } - fn softmax(tensor: @Tensor, axis: usize) -> Tensor { + fn softmax(tensor: @Tensor, axis: Option) -> Tensor { functional::softmax::softmaxWide::(tensor, axis) } @@ -81,8 +82,8 @@ impl FP8x23NN of NNTrait { X: @Tensor, grid: @Tensor, align_corner: Option, - mode: Option, - padding_mode: Option, + mode: Option, + padding_mode: Option, ) -> Tensor { functional::grid_sample::grid_sample(X, grid, align_corner, mode, padding_mode) } @@ -102,7 +103,7 @@ impl FP8x23NN of NNTrait { X: @Tensor, W: @Tensor, B: Option<@Tensor>, - auto_pad: Option, + auto_pad: Option, dilations: Option>, group: Option, kernel_shape: Option>, @@ -130,7 +131,7 @@ impl FP8x23NN of NNTrait { X: @Tensor, W: @Tensor, B: Option>, - auto_pad: Option, + auto_pad: Option, dilations: Option>, group: Option, kernel_shape: Option>, @@ -154,4 +155,44 @@ impl FP8x23NN of NNTrait { ) -> Tensor { panic(array!['not supported!']) } + + fn max_pool( + X: @Tensor, + auto_pad: Option, + ceil_mode: Option, + dilations: Option>, + kernel_shape: Span, + pads: Option>, + storage_order: Option, + strides: Option>, + output_len: usize, + ) -> (Tensor, Option>) { + functional::max_pool::max_pool( + X, + auto_pad, + ceil_mode, + dilations, + kernel_shape, + pads, + storage_order, + strides, + output_len) + } + fn deform_conv( + X: @Tensor, + W: @Tensor, + offset: @Tensor, + B: Option>, + mask: Option>, + dilations: Option>, + group: Option, + kernel_shape: Option>, + offset_group: Option, + pads: Option>, + strides: Option>, + ) -> Tensor { + functional::deform_conv::deform_conv( + X, W, offset, B, mask, dilations, group, kernel_shape, offset_group, pads, strides, + ) + } } diff --git a/src/operators/nn/implementations/nn_i32.cairo b/src/operators/nn/implementations/nn_i32.cairo index 6eafa99e8..5dd98d2fb 100644 --- a/src/operators/nn/implementations/nn_i32.cairo +++ b/src/operators/nn/implementations/nn_i32.cairo @@ -6,6 +6,7 @@ use orion::operators::tensor::implementations::tensor_i32::{ }; use orion::numbers::{I32Div}; use orion::operators::tensor::implementations::tensor_i32::{I32TensorTryIntoU32Tensor}; +use orion::operators::nn::{AUTO_PAD, MODE, PADDING_MODE}; impl I32NN of NNTrait { fn relu(tensor: @Tensor) -> Tensor { @@ -16,7 +17,7 @@ impl I32NN of NNTrait { panic(array!['not supported!']) } - fn softmax(tensor: @Tensor, axis: usize) -> Tensor { + fn softmax(tensor: @Tensor, axis: Option) -> Tensor { panic(array!['not supported!']) } @@ -76,8 +77,8 @@ impl I32NN of NNTrait { X: @Tensor, grid: @Tensor, align_corner: Option, - mode: Option, - padding_mode: Option, + mode: Option, + padding_mode: Option, ) -> Tensor { panic(array!['not supported!']) } @@ -125,7 +126,7 @@ impl I32NN of NNTrait { X: @Tensor, W: @Tensor, B: Option>, - auto_pad: Option, + auto_pad: Option, dilations: Option>, group: Option, kernel_shape: Option>, @@ -160,4 +161,33 @@ impl I32NN of NNTrait { strides, ) } + + fn max_pool( + X: @Tensor, + auto_pad: Option, + ceil_mode: Option, + dilations: Option>, + kernel_shape: Span, + pads: Option>, + storage_order: Option, + strides: Option>, + output_len: usize, + ) -> (Tensor, Option>) { + panic(array!['not supported!']) + } + fn deform_conv( + X: @Tensor, + W: @Tensor, + offset: @Tensor, + B: Option>, + mask: Option>, + dilations: Option>, + group: Option, + kernel_shape: Option>, + offset_group: Option, + pads: Option>, + strides: Option>, + ) -> Tensor { + panic(array!['not supported!']) + } } diff --git a/src/operators/nn/implementations/nn_i8.cairo b/src/operators/nn/implementations/nn_i8.cairo index 55851018b..d22411a6f 100644 --- a/src/operators/nn/implementations/nn_i8.cairo +++ b/src/operators/nn/implementations/nn_i8.cairo @@ -6,6 +6,8 @@ use orion::operators::tensor::implementations::tensor_i8::{ }; use orion::numbers::{I8Div}; use orion::operators::tensor::implementations::tensor_i8::{I8TensorTryIntoU32Tensor}; +use orion::operators::nn::{AUTO_PAD, MODE, PADDING_MODE}; + impl I8NN of NNTrait { fn relu(tensor: @Tensor) -> Tensor { @@ -16,7 +18,7 @@ impl I8NN of NNTrait { panic(array!['not supported!']) } - fn softmax(tensor: @Tensor, axis: usize) -> Tensor { + fn softmax(tensor: @Tensor, axis: Option) -> Tensor { panic(array!['not supported!']) } @@ -76,8 +78,8 @@ impl I8NN of NNTrait { X: @Tensor, grid: @Tensor, align_corner: Option, - mode: Option, - padding_mode: Option, + mode: Option, + padding_mode: Option, ) -> Tensor { panic(array!['not supported!']) } @@ -125,7 +127,7 @@ impl I8NN of NNTrait { X: @Tensor, W: @Tensor, B: Option>, - auto_pad: Option, + auto_pad: Option, dilations: Option>, group: Option, kernel_shape: Option>, @@ -160,4 +162,33 @@ impl I8NN of NNTrait { strides, ) } + + fn max_pool( + X: @Tensor, + auto_pad: Option, + ceil_mode: Option, + dilations: Option>, + kernel_shape: Span, + pads: Option>, + storage_order: Option, + strides: Option>, + output_len: usize, + ) -> (Tensor, Option>) { + panic(array!['not supported!']) + } + fn deform_conv( + X: @Tensor, + W: @Tensor, + offset: @Tensor, + B: Option>, + mask: Option>, + dilations: Option>, + group: Option, + kernel_shape: Option>, + offset_group: Option, + pads: Option>, + strides: Option>, + ) -> Tensor { + panic(array!['not supported!']) + } } diff --git a/src/operators/nn/implementations/nn_u32.cairo b/src/operators/nn/implementations/nn_u32.cairo index 8d8ec4f88..e636cbf05 100644 --- a/src/operators/nn/implementations/nn_u32.cairo +++ b/src/operators/nn/implementations/nn_u32.cairo @@ -4,6 +4,8 @@ use orion::operators::nn::functional; use orion::operators::tensor::implementations::tensor_u32::{ U32Tensor, U32TensorAdd, U32TensorMul, U32TensorSub, U32TensorDiv }; +use orion::operators::nn::{AUTO_PAD, MODE, PADDING_MODE}; + impl U32NN of NNTrait { fn relu(tensor: @Tensor) -> Tensor { @@ -14,7 +16,7 @@ impl U32NN of NNTrait { panic(array!['not supported!']) } - fn softmax(tensor: @Tensor, axis: usize) -> Tensor { + fn softmax(tensor: @Tensor, axis: Option) -> Tensor { panic(array!['not supported!']) } @@ -74,8 +76,8 @@ impl U32NN of NNTrait { X: @Tensor, grid: @Tensor, align_corner: Option, - mode: Option, - padding_mode: Option, + mode: Option, + padding_mode: Option, ) -> Tensor { panic(array!['not supported!']) } @@ -123,7 +125,7 @@ impl U32NN of NNTrait { X: @Tensor, W: @Tensor, B: Option>, - auto_pad: Option, + auto_pad: Option, dilations: Option>, group: Option, kernel_shape: Option>, @@ -158,4 +160,33 @@ impl U32NN of NNTrait { strides, ) } + + fn max_pool( + X: @Tensor, + auto_pad: Option, + ceil_mode: Option, + dilations: Option>, + kernel_shape: Span, + pads: Option>, + storage_order: Option, + strides: Option>, + output_len: usize, + ) -> (Tensor, Option>) { + panic(array!['not supported!']) + } + fn deform_conv( + X: @Tensor, + W: @Tensor, + offset: @Tensor, + B: Option>, + mask: Option>, + dilations: Option>, + group: Option, + kernel_shape: Option>, + offset_group: Option, + pads: Option>, + strides: Option>, + ) -> Tensor { + panic(array!['not supported!']) + } } diff --git a/src/operators/tensor/core.cairo b/src/operators/tensor/core.cairo index 0d21a4de3..7fbecd10c 100644 --- a/src/operators/tensor/core.cairo +++ b/src/operators/tensor/core.cairo @@ -9,12 +9,16 @@ use alexandria_data_structures::array_ext::{SpanTraitExt}; use orion::operators::tensor::helpers::{len_from_shape, check_shape}; use orion::numbers::{NumberTrait, I32IntoU32, U32IntoI32}; +use orion::operators::nn::AUTO_PAD; + #[derive(Copy, Drop)] struct Tensor { shape: Span, data: Span, } + + //Implement TensorSerde impl TensorSerde, impl TDrop: Drop> of Serde> { fn serialize(self: @Tensor, ref output: Array) { @@ -84,6 +88,7 @@ impl TensorSerde, impl TDrop: Drop> of Serde, impl TDrop: Drop> of Serde8Bit conversion of FP32 Input data. /// scatter_nd - The output of the operation is produced by creating a copy of the input data, and then updating its value to values specified by updates at specific index positions specified by indices. Its output shape is the same as the shape of data +/// center_crop_pad - Center crop or pad an input to given dimensions. /// label_encoder - Maps each element in the input tensor to another value. + + trait TensorTrait { /// # tensor.new /// @@ -558,15 +566,21 @@ trait TensorTrait { /// # tensor.reshape /// /// ```rust - /// fn reshape(self: @Tensor, target_shape: Span) -> Tensor; + /// fn reshape(self: @Tensor, target_shape: Span, allowzero: bool) -> Tensor; /// ``` /// - /// Returns a new tensor with the specified target shape and the same data as the input tensor. + /// Reshape the input tensor similar to numpy.reshape. First input is the data tensor, second + /// input is a shape tensor which specifies the output shape. It outputs the reshaped tensor. + /// At most one dimension of the new shape can be -1. In this case, the value is inferred from + /// the size of the tensor and the remaining dimensions. A dimension could also be 0, in which case + /// the actual dimension value is unchanged (i.e. taken from the input tensor). If 'allowzero' is set, + /// and the new shape includes 0, the dimension will be set explicitly to zero (i.e. not taken from input tensor) /// /// ## Args /// /// * `self`(`@Tensor`) - The input tensor. - /// * `target_shape`(Span) - A span containing the target shape of the tensor. + /// * `target_shape`(Span) - A span containing the target shape of the tensor. + /// * `allowzero`(`bool`) - Indicates that if any value in the 'shape' input is set to zero, the zero value is honored, similar to NumPy. /// /// ## Panics /// @@ -589,12 +603,12 @@ trait TensorTrait { /// ); /// /// // We can call `reshape` function as follows. - /// return tensor.reshape(target_shape: array![2, 4].span()); + /// return tensor.reshape(target_shape: array![2, 4].span(), false); /// } /// >>> [[0,1,2,3], [4,5,6,7]] /// ``` /// - fn reshape(self: @Tensor, target_shape: Span) -> Tensor; + fn reshape(self: @Tensor, target_shape: Span, allowzero: bool) -> Tensor; /// # tensor.transpose /// /// ```rust @@ -638,7 +652,7 @@ trait TensorTrait { /// ## tensor.reduce_sum /// /// ```rust - /// fn reduce_sum(self: @Tensor, axis: usize, keepdims: bool) -> Tensor; + /// fn reduce_sum(self: @Tensor, axes: Option>, keepdims: Option, noop_with_empty_axes: Option) -> Tensor; /// ``` /// /// Reduces a tensor by summing its elements along a specified axis. @@ -646,16 +660,13 @@ trait TensorTrait { /// ## Args /// /// * `self`(`@Tensor`) - The input tensor. - /// * `axis`(`usize`) - The dimension to reduce. - /// * `keepdims`(`bool`) - If true, retains reduced dimensions with length 1. - /// - /// ## Panics - /// - /// * Panics if axis is not in the range of the input tensor's dimensions. + /// * `axes`(`Option>`) - Optional input list of integers, along which to reduce. The default is to reduce over all the dimensions of the input tensor if 'noop_with_empty_axes' is false, else act as an Identity op when 'noop_with_empty_axes' is true. + /// * `keepdims`(`Option`) - Keep the reduced dimension or not, default 1 means keep reduced dimension. + /// * `noop_with_empty_axes`(`Option`) - Defines behavior if 'axes' is empty. Default behavior with 'false' is to reduce all axes. When axes is empty and this attribute is set to true, input tensor will not be reduced,and the output tensor would be equivalent to input tensor. /// /// ## Returns /// - /// A new `Tensor` instance with the specified axis reduced by summing its elements. + /// Reduced output tensor. /// /// ## Examples /// @@ -670,16 +681,21 @@ trait TensorTrait { /// ); /// /// // We can call `reduce_sum` function as follows. - /// return tensor.reduce_sum(axis: 0, keepdims: false); + /// return tensor.reduce_sum(axes: Option::None, keepdims: false); /// } /// >>> [[4,6],[8,10]] /// ``` /// - fn reduce_sum(self: @Tensor, axis: usize, keepdims: bool) -> Tensor; + fn reduce_sum( + self: @Tensor, + axes: Option>, + keepdims: Option, + noop_with_empty_axes: Option + ) -> Tensor; /// # tensor.argmax /// /// ```rust - /// fn argmax(self: @Tensor, axis: usize, keepdims: Option, select_last_index: Option) -> Tensor; + /// fn argmax(self: @Tensor, axis: i32, keepdims: Option, select_last_index: Option) -> Tensor; /// ``` /// /// Returns the index of the maximum value along the specified axis. @@ -687,7 +703,7 @@ trait TensorTrait { /// ## Args /// /// * `self`(`@Tensor`) - The input tensor. - /// * `axis`(`usize`) - The axis along which to compute the argmax. + /// * `axis`(`i32`) - The axis along which to compute the argmax. /// * `keepdims`(`Option`) - If true, retains reduced dimensions with length 1. Defaults to true. /// * `select_last_index`(`Option`) - If true, the index of the last occurrence of the maximum value is returned. Defaults to false. /// @@ -757,8 +773,8 @@ trait TensorTrait { /// ``` /// fn argmax( - self: @Tensor, axis: usize, keepdims: Option, select_last_index: Option - ) -> Tensor; + self: @Tensor, axis: i32, keepdims: Option, select_last_index: Option + ) -> Tensor; /// # tensor.argmin /// /// ```rust @@ -1244,7 +1260,7 @@ trait TensorTrait { /// #tensor.less /// /// ```rust - /// fn less(self: @Tensor, other: @Tensor) -> Tensor; + /// fn less(self: @Tensor, other: @Tensor) -> Tensor; /// ``` /// /// Check if each element of the first tensor is less than the corresponding element of the second tensor. @@ -1263,7 +1279,7 @@ trait TensorTrait { /// /// ## Returns /// - /// A new `Tensor` of booleans (0 or 1) with the same shape as the broadcasted inputs. + /// A new `Tensor` of booleans with the same shape as the broadcasted inputs. /// /// ## Examples /// @@ -1274,7 +1290,7 @@ trait TensorTrait { /// /// use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor}; /// - /// fn less_example() -> Tensor { + /// fn less_example() -> Tensor { /// let tensor_1 = TensorTrait::::new( /// shape: array![3, 3, 3].span(), data: array![0, 1, 2, 3, 4, 5, 6, 7, 8].span(), /// ); @@ -1296,7 +1312,7 @@ trait TensorTrait { /// /// use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor}; /// - /// fn less_example() -> Tensor { + /// fn less_example() -> Tensor { /// let tensor_1 = TensorTrait::::new( /// shape: array![3, 3, 3].span(), data: array![0, 1, 2, 3, 4, 5, 6, 7, 8].span(), /// ); @@ -1309,11 +1325,11 @@ trait TensorTrait { /// >>> [0,0,0,0,0,0,0,1,1] /// ``` /// - fn less(self: @Tensor, other: @Tensor) -> Tensor; + fn less(self: @Tensor, other: @Tensor) -> Tensor; /// #tensor.less_equal /// /// ```rust - /// fn less_equal(self: @Tensor, other: @Tensor) -> Tensor; + /// fn less_equal(self: @Tensor, other: @Tensor) -> Tensor; /// ``` /// /// Check if each element of the first tensor is less than or equal to the corresponding element of the second tensor. @@ -1332,7 +1348,7 @@ trait TensorTrait { /// /// ## Returns /// - /// A new `Tensor` of booleans (0 or 1) with the same shape as the broadcasted inputs. + /// A new `Tensor` of booleans (0 or 1) with the same shape as the broadcasted inputs. /// /// ## Examples /// @@ -1343,7 +1359,7 @@ trait TensorTrait { /// /// use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor}; /// - /// fn less_equal_example() -> Tensor { + /// fn less_equal_example() -> Tensor { /// let tensor_1 = TensorTrait::::new( /// shape: array![3, 3, 3].span(), data: array![0, 1, 2, 3, 4, 5, 6, 7, 8].span(), /// ); @@ -1365,7 +1381,7 @@ trait TensorTrait { /// /// use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor}; /// - /// fn less_equal_example() -> Tensor { + /// fn less_equal_example() -> Tensor { /// let tensor_1 = TensorTrait::::new( /// shape: array![3, 3, 3].span(), data: array![0, 1, 2, 3, 4, 5, 6, 7, 8].span(), /// ); @@ -1378,7 +1394,7 @@ trait TensorTrait { /// >>> [1,1,1,0,0,0,1,1,1] /// ``` /// - fn less_equal(self: @Tensor, other: @Tensor) -> Tensor; + fn less_equal(self: @Tensor, other: @Tensor) -> Tensor; /// #tensor.abs /// /// ```rust @@ -3070,6 +3086,183 @@ trait TensorTrait { fn qlinear_leakyrelu( self: @Tensor, a_scale: @Tensor, a_zero_point: @Tensor, alpha: T ) -> Tensor::; + /// # tensor.qlinear_conv + /// + /// ```rust + /// + /// qlinear_conv( + /// self: @Tensor, + /// X_scale: @Tensor, + /// X_zero_point: @Tensor, + /// W: @Tensor, + /// W_scale: @Tensor, + /// W_zero_point: @Tensor, + /// B: Option>, + /// auto_pad: Option, + /// dilations: Option>, + /// group: Option, + /// kernel_shape: Option>, + /// pads: Option>, + /// strides: Option>, + /// y_scale: @Tensor, + /// y_zero_point: @Tensor, + /// ) -> Tensor + /// ``` + /// + /// Performs convolution on quantized Tensors + /// + /// The convolution operator consumes a quantized input tensor, its scale and zero point, a quantized filter, its scale and zero point, + /// and output's scale and zero point, and computes the quantized output. Each scale and zero-point pair must have same shape. + /// It means they must be either scalars (per tensor) or 1-D tensors (per output channel). Each input or output and its related zero point must have same type. + /// + /// ## Args + /// + /// * `self`(`@Tensor`) - Quantized input data tensor, has size (N x C x H x W), where N is the batch size, C is the number of channels, and H and W are the height and width. Note that this is for the 2D image. Otherwise the size is (N x C x D1 x D2 ... x Dn). + /// * `X_scale`(`@Tensor`) - Scale for input `X`. + /// * `X_zero_point`(`@Tensor`) - Zero point for input `X`. + /// * `W`(`@Tensor`) - Quantized weight tensor that will be used in the convolutions; has size (M x C/group x kH x kW), where C is the number of channels, and kH and kW are the height and width of the kernel, and M is the number of feature maps. For more than 2 dimensions, the kernel shape will be (M x C/group x k1 x k2 x ... x kn), where (k1 x k2 x ... kn) is the dimension of the kernel. + /// * `W_scale`(`@Tensor`) - Scale for input `W`. + /// * `W_zero_point`(`@Tensor`) - Zero point for input `W`. + /// * `B`(`Option<@Tensor>`) - Optional 1D bias to be added to the convolution, has size of M. Bias must be quantized using scale = x_scale * w_scale and zero_point = 0. + /// * `auto_pad`(`Option`) - Default is NOTSET, auto_pad must be either NOTSET, SAME_UPPER, SAME_LOWER or VALID. NOTSET means explicit padding is used. SAME_UPPER or SAME_LOWER mean pad the input so that `output_shape[i] = ceil(input_shape[i] / strides[i])` for each axis `i`. + /// * `dilations`(`Option>`) - Dilation value along each spatial axis of the filter. If not present, the dilation defaults to 1 along each spatial axis. + /// * `group`(`Option`) - Default is 1, number of groups input channels and output channels are divided into. + /// * `kernel_shape`(`Option>`) - The shape of the convolution kernel. If not present, should be inferred from input W. + /// * `pads`(`Option>`) - Padding for the beginning and ending along each spatial axis, it can take any value greater than or equal to 0. The value represent the number of pixels added to the beginning and end part of the corresponding axis. `pads` format should be as follow [x1_begin, x2_begin...x1_end, x2_end,...], where xi_begin the number of pixels added at the beginning of axis `i` and xi_end, the number of pixels added at the end of axis `i`. This attribute cannot be used simultaneously with auto_pad attribute. If not present, the padding defaults to 0 along start and end of each spatial axis. + /// * `strides`(`Option>`) - Stride along each spatial axis. If not present, the stride defaults to 1 along each spatial axis. + /// * `y_scale`(`@Tensor`) - Scale for output. + /// * `y_zero_point`(`@Tensor`) - Zero point for output. + /// + /// ## Returns + /// + /// A new `Tensor`, containing the quantized result of the convolution of the dequantized inputs. + /// + /// ## Type Constraints + /// + /// u32 tensor, not supported. + /// fp8x23wide tensor, not supported. + /// fp16x16wide tensor, not supported. + /// + /// ## Example + /// + /// ```rust + /// use orion::operators::tensor::{TensorTrait, Tensor}; + /// use orion::operators::tensor::I8TensorPartialEq; + /// use orion::utils::{assert_eq, assert_seq_eq}; + /// use orion::operators::tensor::{I8Tensor, I8TensorAdd}; + /// use orion::operators::tensor::FP16x16TensorPartialEq; + /// use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; + /// use core::array::{ArrayTrait, SpanTrait}; + /// use orion::operators::tensor::implementations::tensor_fp16x16::{TensorI8IntoTensorFP16x16, FP16x16TensorSub,FP16x16TensorDiv,FP16x16TensorMul}; + /// use orion::numbers::{FP16x16, I8IntoFP16x16}; + /// + /// fn qlinear_conv_example() -> Tensor { + /// let mut shape = ArrayTrait::::new(); + /// shape.append(1); + /// shape.append(1); + /// shape.append(3); + /// shape.append(3); + /// + /// let mut data = ArrayTrait::new(); + /// data.append(1); + /// data.append(2); + /// data.append(3); + /// data.append(4); + /// data.append(5); + /// data.append(6); + /// data.append(7); + /// data.append(8); + /// data.append(9); + /// let mut X = TensorTrait::new(shape.span(), data.span()); + /// + /// let mut shape = ArrayTrait::::new(); + /// shape.append(1); + /// shape.append(1); + /// shape.append(1); + /// shape.append(1); + /// + /// let mut data = ArrayTrait::new(); + /// data.append(0_i8); + /// let mut W = TensorTrait::new(shape.span(), data.span()); + /// + /// let mut shape = ArrayTrait::::new(); + /// shape.append(6); + /// + /// let mut data = ArrayTrait::new(); + /// data.append(FP16x16 { mag: 32768, sign: false }); + /// data.append(FP16x16 { mag: 131072, sign: false }); + /// data.append(FP16x16 { mag: 26214, sign: false }); + /// data.append(FP16x16 { mag: 196608, sign: false }); + /// data.append(FP16x16 { mag: 13107, sign: false }); + /// data.append(FP16x16 { mag: 262144, sign: false }); + /// let mut param = TensorTrait::new(shape.span(), data.span()); + /// + /// let X_scale = TensorTrait::new( + /// shape: array![1].span(), data: array![*param.data.at(0)].span(), + /// ); + /// let X_zero_point = TensorTrait::new( + /// shape: array![1].span(), data: array![*param.data.at(1)].span(), + /// ); + /// let W_scale = TensorTrait::new( + /// shape: array![1].span(), data: array![*param.data.at(2)].span(), + /// ); + /// let W_zero_point = TensorTrait::new( + /// shape: array![1].span(), data: array![*param.data.at(3)].span(), + /// ); + /// let y_scale = TensorTrait::new( + /// shape: array![1].span(), data: array![*param.data.at(4)].span(), + /// ); + /// let y_zero_point = TensorTrait::new( + /// shape: array![1].span(), data: array![*param.data.at(5)].span(), + /// ); + /// + /// return X + /// .qlinear_conv( + /// @X_scale, + /// @X_zero_point, + /// @W, + /// @W_scale, + /// @W_zero_point, + /// Option::None, + /// Option::None, + /// Option::None, + /// Option::None, + /// Option::None, + /// Option::None, + /// Option::None, + /// @y_scale, + /// @y_zero_point, + /// ); + /// } + /// + /// >>> [ + /// [ + /// [ + /// [ 7, 4, 1], + /// [ -2, -5, -8], + /// [-11, -14, -17], + /// ] + /// ] + /// ] + /// ``` + /// + fn qlinear_conv( + self: @Tensor, + X_scale: @Tensor, + X_zero_point: @Tensor, + W: @Tensor, + W_scale: @Tensor, + W_zero_point: @Tensor, + B: Option>, + auto_pad: Option, + dilations: Option>, + group: Option, + kernel_shape: Option>, + pads: Option>, + strides: Option>, + y_scale: @Tensor, + y_zero_point: @Tensor, + ) -> Tensor; /// # tensor.slice /// /// ```rust @@ -3120,6 +3313,7 @@ trait TensorTrait { /// [6 7]] /// ``` /// + fn slice( self: @Tensor, starts: Span, @@ -3166,7 +3360,7 @@ trait TensorTrait { /// # tensor.gather /// /// ```rust - /// fn gather(self: @Tensor, indices: Tensor, axis: Option) -> Tensor; + /// fn gather(self: @Tensor, indices: Tensor, axis: Option) -> Tensor; /// ``` /// /// Gather entries of the axis dimension of data. @@ -3174,8 +3368,8 @@ trait TensorTrait { /// ## Args /// /// * `self`(`@Tensor`) - The input tensor. - /// * `indices`(`Tensor`) - Tensor of indices. - /// * `axis`(`Option`) - Axis to gather on. Default: axis=0. + /// * `indices`(`Tensor`) - Tensor of indices. + /// * `axis`(`Option`) - Axis to gather on. Default: axis=0. /// /// ## Panics /// @@ -3197,7 +3391,7 @@ trait TensorTrait { /// shape: array![2, 3].span(), /// data: array![[ 1, 2, 3],[4, 5, 6]].span(), /// ); - /// let indices = TensorTrait::::new( + /// let indices = TensorTrait::::new( /// shape: array![1, 1].span(), /// data: array![1, 0].span(), /// ); @@ -3211,7 +3405,7 @@ trait TensorTrait { /// [1. 2. 3.]] /// ``` /// - fn gather(self: @Tensor, indices: Tensor, axis: Option) -> Tensor; + fn gather(self: @Tensor, indices: Tensor, axis: Option) -> Tensor; /// # tensor.unsqueeze /// /// ```rust @@ -4224,7 +4418,7 @@ trait TensorTrait { /// # tensor.gather_elements /// /// ```rust - /// fn gather_elements(self: @Tensor, indices: Tensor, axis: Option) -> Tensor; + /// fn gather_elements(self: @Tensor, indices: Tensor, axis: Option) -> Tensor; /// ``` /// /// GatherElements is an indexing operation that produces its output by indexing into the input data tensor at index positions determined by elements of the indices tensor. @@ -4232,8 +4426,8 @@ trait TensorTrait { /// ## Args /// /// * `self`(`@Tensor`) - The input tensor. - /// * `indices`(`Tensor`) - Tensor of indices. - /// * `axis`(`Option`) - Axis to gather_elements on. Default: axis=0. + /// * `indices`(`Tensor`) - Tensor of indices. + /// * `axis`(`Option`) - Axis to gather_elements on. Default: axis=0. /// /// ## Panics /// @@ -4255,7 +4449,7 @@ trait TensorTrait { /// shape: array![3, 3].span(), /// data: array![[ 1, 2, 3],[4, 5, 6], [7, 8, 9]].span(), /// ); - /// let indices = TensorTrait::::new( + /// let indices = TensorTrait::::new( /// shape: array![1, 2, 0].span(), /// data: array![2, 0, 0].span(), /// ); @@ -4269,7 +4463,7 @@ trait TensorTrait { /// [7. 2. 3.]] /// ``` /// - fn gather_elements(self: @Tensor, indices: Tensor, axis: Option) -> Tensor; + fn gather_elements(self: @Tensor, indices: Tensor, axis: Option) -> Tensor; /// # tensor.binarizer /// /// ```rust @@ -5730,6 +5924,52 @@ trait TensorTrait { fn random_uniform_like( tensor: @Tensor, high: Option, low: Option, seed: Option ) -> Tensor; + /// # tensor.center_crop_pad + /// + /// ```rust + /// fn center_crop_pad( + /// self: @Tensor, shape: Tensor, axes: Option>, zero: T + /// ) -> Tensor + /// ``` + /// + /// Center crop or pad an input to given dimensions. + /// + /// ## Args + /// + /// * `self`(`@Tensor`) - Input to extract the centered crop from. + /// * `shape`(Tensor) - 1-D tensor representing the cropping window dimensions. + /// * `axes`(Option) - If provided, it specifies a subset of axes that ‘shape’ refer to. + /// + /// ## Panics + /// + /// * Panics if axes is a negative number, axis+rank (self) is less than 0. + /// + /// ## Returns + /// + /// Output data of tensors after crop/pad. + /// + /// ## Examples + /// + /// ```rust + /// use core::array::{ArrayTrait, SpanTrait}; + /// use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor}; + /// use core::option::OptionTrait; + /// fn center_crop_pad_example() -> Tensor { + /// let tensor: Tensor = TensorTrait::::new( + /// shape: array![5,4,1].span(), + /// data: array![ + /// 1, 2, 3, 4, 5, 6, 7,8,9,10,11,12,13,14,15,16,17,18,19,20 + /// ].span(), + /// ); + /// // We can call `center_crop_pad` function as follows. + /// return tensor.center_crop_pad(TensorTrait::new(array![3].span(), array![5,2,1].span()), Option::None(())); + /// } + /// >>> [[2,3],[6,7],[10,11],[14,15],[18,19]] + /// ``` + /// + fn center_crop_pad( + self: @Tensor, shape: Tensor, axes: Option> + ) -> Tensor; /// # tensor.label_encoder /// /// ```rust @@ -5945,8 +6185,83 @@ fn stride(mut shape: Span) -> Span { /// Cf: TensorTrait::reshape docstring -fn reshape(self: @Tensor, target_shape: Span) -> Tensor { - new_tensor(target_shape, *self.data) +fn reshape>>( + self: @Tensor, target_shape: Span, allowzero: bool +) -> Tensor { + // Calculate the total number of elements in the original tensor + let mut total_elements = 1; + let mut shape = *self.shape; + loop { + match shape.pop_front() { + Option::Some(val) => total_elements *= *val, + Option::None => { break; } + }; + }; + + // Calculate 'elements_so_far' and find 'inferred_index' + let mut elements_so_far = 1; + let mut inferred_index = Option::None; + let mut target_shape_clone = target_shape.clone(); + let mut i: usize = 0; + loop { + match target_shape_clone.pop_front() { + Option::Some(dim) => { + if *dim == -1 { + if inferred_index.is_none() { + inferred_index = Option::Some(i); + } else { + panic!("Only one dimension can be inferred"); + } + } else if *dim == 0 && allowzero == false { + // When allowzero is not set, copy the dimension size from the original tensor + if i >= (*self.shape).len() { + panic!("Dimension out of bounds for using original dimension value"); + } + elements_so_far *= *(*self).shape.at(i); + } else if *dim >= 0 { + elements_so_far *= (*dim).try_into().unwrap(); + } else { + panic!("Invalid dimension size"); + }; + }, + Option::None => { break; } + }; + i += 1; + }; + + let mut target_shape_clone = target_shape.clone(); + let mut inferred_shape = ArrayTrait::::new(); + i = 0; // Reset the index for the next loop + loop { + match target_shape_clone.pop_front() { + Option::Some(dim) => { + if *dim == -1 { + inferred_shape.append(total_elements / elements_so_far) // Inferred dimension + } else if *dim == 0 { + if allowzero == true { + inferred_shape + .append( + 0 + ) // Explicitly set the dimension to zero when allowzero is enabled + } else if i < (*self.shape).len() { + inferred_shape + .append( + *(*self).shape.at(i) + ) // Dimension unchanged from original when allowzero is not enabled + } else { + panic!("Dimension out of bounds for using original dimension value"); + } + } else { + inferred_shape + .append((*dim).try_into().unwrap()) // Directly specified dimension + }; + }, + Option::None => { break; } + } + i += 1; + }; + + new_tensor(inferred_shape.span(), *self.data) } /// Cf: TensorTrait::at docstring diff --git a/src/operators/tensor/implementations/tensor_bool.cairo b/src/operators/tensor/implementations/tensor_bool.cairo index 612a397cc..d1a79459b 100644 --- a/src/operators/tensor/implementations/tensor_bool.cairo +++ b/src/operators/tensor/implementations/tensor_bool.cairo @@ -6,6 +6,7 @@ use orion::operators::tensor::core::{ use orion::operators::tensor::{math, linalg, quantization, core as core_ops, ml, manipulation}; use orion::numbers::{NumberTrait}; use orion::operators::tensor::implementations::tensor_u32::U32Tensor; +use orion::operators::nn::AUTO_PAD; impl BoolTensor of TensorTrait { fn new(shape: Span, data: Span) -> Tensor { @@ -60,11 +61,16 @@ impl BoolTensor of TensorTrait { unravel_index(index, *self.shape) } - fn reshape(self: @Tensor, target_shape: Span) -> Tensor { - reshape(self, target_shape) + fn reshape(self: @Tensor, target_shape: Span, allowzero: bool) -> Tensor { + reshape(self, target_shape, allowzero) } - fn reduce_sum(self: @Tensor, axis: usize, keepdims: bool) -> Tensor { + fn reduce_sum( + self: @Tensor, + axes: Option>, + keepdims: Option, + noop_with_empty_axes: Option + ) -> Tensor { panic(array!['not supported!']) } @@ -73,8 +79,8 @@ impl BoolTensor of TensorTrait { } fn argmax( - self: @Tensor, axis: usize, keepdims: Option, select_last_index: Option - ) -> Tensor { + self: @Tensor, axis: i32, keepdims: Option, select_last_index: Option + ) -> Tensor { panic(array!['not supported!']) } @@ -112,11 +118,11 @@ impl BoolTensor of TensorTrait { panic(array!['not supported!']) } - fn less(self: @Tensor, other: @Tensor) -> Tensor { + fn less(self: @Tensor, other: @Tensor) -> Tensor { panic(array!['not supported!']) } - fn less_equal(self: @Tensor, other: @Tensor) -> Tensor { + fn less_equal(self: @Tensor, other: @Tensor) -> Tensor { panic(array!['not supported!']) } @@ -226,7 +232,7 @@ impl BoolTensor of TensorTrait { core_ops::slice::(self, starts, ends, axes, steps) } - fn gather(self: @Tensor, indices: Tensor, axis: Option) -> Tensor { + fn gather(self: @Tensor, indices: Tensor, axis: Option) -> Tensor { math::gather::gather(self, indices, axis) } @@ -322,6 +328,26 @@ impl BoolTensor of TensorTrait { panic(array!['not supported!']) } + fn qlinear_conv( + self: @Tensor, + X_scale: @Tensor, + X_zero_point: @Tensor, + W: @Tensor, + W_scale: @Tensor, + W_zero_point: @Tensor, + B: Option>, + auto_pad: Option, + dilations: Option>, + group: Option, + kernel_shape: Option>, + pads: Option>, + strides: Option>, + y_scale: @Tensor, + y_zero_point: @Tensor, + ) -> Tensor { + panic(array!['not supported!']) + } + fn round(self: @Tensor) -> Tensor { panic(array!['not supported!']) } @@ -369,7 +395,7 @@ impl BoolTensor of TensorTrait { } fn gather_elements( - self: @Tensor, indices: Tensor, axis: Option + self: @Tensor, indices: Tensor, axis: Option ) -> Tensor { math::gather_elements::gather_elements(self, indices, axis) } @@ -536,6 +562,13 @@ impl BoolTensor of TensorTrait { panic(array!['not supported!']) } + fn center_crop_pad( + self: @Tensor, shape: Tensor, axes: Option> + ) -> Tensor { + let zero = false; + manipulation::center_crop_pad::center_crop_pad(self, shape, axes, zero) + } + fn label_encoder( self: @Tensor, default_list: Option>, @@ -570,17 +603,19 @@ impl BoolTryIntobool of TryInto { fn tensor_eq(mut lhs: Tensor, mut rhs: Tensor,) -> bool { let mut is_eq = true; - while lhs.shape.len() != 0 && is_eq { - is_eq = lhs.shape.pop_front().unwrap() == rhs.shape.pop_front().unwrap(); - }; + while lhs.shape.len() != 0 + && is_eq { + is_eq = lhs.shape.pop_front().unwrap() == rhs.shape.pop_front().unwrap(); + }; if !is_eq { return false; } - while lhs.data.len() != 0 && is_eq { - is_eq = lhs.data.pop_front().unwrap() == rhs.data.pop_front().unwrap(); - }; + while lhs.data.len() != 0 + && is_eq { + is_eq = lhs.data.pop_front().unwrap() == rhs.data.pop_front().unwrap(); + }; is_eq } diff --git a/src/operators/tensor/implementations/tensor_complex64.cairo b/src/operators/tensor/implementations/tensor_complex64.cairo index c9c31ae23..b087508f4 100644 --- a/src/operators/tensor/implementations/tensor_complex64.cairo +++ b/src/operators/tensor/implementations/tensor_complex64.cairo @@ -12,6 +12,8 @@ use orion::operators::tensor::implementations::{ use orion::numbers::complex_number::complex_trait::ComplexTrait; use orion::numbers::complex_number::complex64::{Complex64Impl, complex64}; +use orion::operators::nn::AUTO_PAD; + impl Complex64Tensor of TensorTrait { fn new(shape: Span, data: Span) -> Tensor { new_tensor(shape, data) @@ -69,12 +71,19 @@ impl Complex64Tensor of TensorTrait { unravel_index(index, *self.shape) } - fn reshape(self: @Tensor, target_shape: Span) -> Tensor { - reshape(self, target_shape) + fn reshape( + self: @Tensor, target_shape: Span, allowzero: bool + ) -> Tensor { + reshape(self, target_shape, allowzero) } - fn reduce_sum(self: @Tensor, axis: usize, keepdims: bool) -> Tensor { - math::reduce_sum::reduce_sum(self, axis, keepdims) + fn reduce_sum( + self: @Tensor, + axes: Option>, + keepdims: Option, + noop_with_empty_axes: Option + ) -> Tensor { + math::reduce_sum::reduce_sum(self, axes, keepdims, noop_with_empty_axes) } fn reduce_prod(self: @Tensor, axis: usize, keepdims: bool) -> Tensor { @@ -83,10 +92,10 @@ impl Complex64Tensor of TensorTrait { fn argmax( self: @Tensor, - axis: usize, + axis: i32, keepdims: Option, select_last_index: Option - ) -> Tensor { + ) -> Tensor { panic(array!['not supported!']) } @@ -127,11 +136,11 @@ impl Complex64Tensor of TensorTrait { panic(array!['not supported!']) } - fn less(self: @Tensor, other: @Tensor) -> Tensor { + fn less(self: @Tensor, other: @Tensor) -> Tensor { panic(array!['not supported!']) } - fn less_equal(self: @Tensor, other: @Tensor) -> Tensor { + fn less_equal(self: @Tensor, other: @Tensor) -> Tensor { panic(array!['not supported!']) } @@ -290,6 +299,26 @@ impl Complex64Tensor of TensorTrait { panic(array!['not supported!']) } + fn qlinear_conv( + self: @Tensor, + X_scale: @Tensor, + X_zero_point: @Tensor, + W: @Tensor, + W_scale: @Tensor, + W_zero_point: @Tensor, + B: Option>, + auto_pad: Option, + dilations: Option>, + group: Option, + kernel_shape: Option>, + pads: Option>, + strides: Option>, + y_scale: @Tensor, + y_zero_point: @Tensor, + ) -> Tensor { + panic(array!['not supported!']) + } + fn slice( self: @Tensor, starts: Span, @@ -301,7 +330,7 @@ impl Complex64Tensor of TensorTrait { } fn gather( - self: @Tensor, indices: Tensor, axis: Option + self: @Tensor, indices: Tensor, axis: Option ) -> Tensor { math::gather::gather(self, indices, axis) } @@ -408,7 +437,7 @@ impl Complex64Tensor of TensorTrait { fn gather_elements( - self: @Tensor, indices: Tensor, axis: Option + self: @Tensor, indices: Tensor, axis: Option ) -> Tensor { math::gather_elements::gather_elements(self, indices, axis) } @@ -574,6 +603,15 @@ impl Complex64Tensor of TensorTrait { panic(array!['not supported!']) } + fn center_crop_pad( + self: @Tensor, + shape: Tensor, + axes: Option> + ) -> Tensor { + let zero = ComplexTrait::zero(); + manipulation::center_crop_pad::center_crop_pad(self, shape, axes, zero) + } + fn label_encoder( self: @Tensor, default_list: Option>, @@ -668,17 +706,19 @@ fn eq(lhs: @complex64, rhs: @complex64) -> bool { fn tensor_eq(mut lhs: Tensor, mut rhs: Tensor,) -> bool { let mut is_eq = true; - while lhs.shape.len() != 0 && is_eq { - is_eq = lhs.shape.pop_front().unwrap() == rhs.shape.pop_front().unwrap(); - }; + while lhs.shape.len() != 0 + && is_eq { + is_eq = lhs.shape.pop_front().unwrap() == rhs.shape.pop_front().unwrap(); + }; if !is_eq { return false; } - while lhs.data.len() != 0 && is_eq { - is_eq = eq(lhs.data.pop_front().unwrap(), rhs.data.pop_front().unwrap()); - }; + while lhs.data.len() != 0 + && is_eq { + is_eq = eq(lhs.data.pop_front().unwrap(), rhs.data.pop_front().unwrap()); + }; is_eq } diff --git a/src/operators/tensor/implementations/tensor_fp16x16.cairo b/src/operators/tensor/implementations/tensor_fp16x16.cairo index a37ed0442..f3d74e1b3 100644 --- a/src/operators/tensor/implementations/tensor_fp16x16.cairo +++ b/src/operators/tensor/implementations/tensor_fp16x16.cairo @@ -12,6 +12,8 @@ use orion::operators::tensor::implementations::{ use orion::numbers::fixed_point::implementations::fp16x16::math::trig::PI; use orion::numbers::fixed_point::implementations::fp16x16wide::core::FP16x16W; +use orion::operators::nn::AUTO_PAD; +use orion::operators::nn::implementations::nn_fp16x16::FP16x16NN; impl FP16x16Tensor of TensorTrait { @@ -71,12 +73,17 @@ impl FP16x16Tensor of TensorTrait { unravel_index(index, *self.shape) } - fn reshape(self: @Tensor, target_shape: Span) -> Tensor { - reshape(self, target_shape) + fn reshape(self: @Tensor, target_shape: Span, allowzero: bool) -> Tensor { + reshape(self, target_shape, allowzero) } - fn reduce_sum(self: @Tensor, axis: usize, keepdims: bool) -> Tensor { - math::reduce_sum::reduce_sum(self, axis, keepdims) + fn reduce_sum( + self: @Tensor, + axes: Option>, + keepdims: Option, + noop_with_empty_axes: Option + ) -> Tensor { + math::reduce_sum::reduce_sum(self, axes, keepdims, noop_with_empty_axes) } fn reduce_prod(self: @Tensor, axis: usize, keepdims: bool) -> Tensor { @@ -84,8 +91,8 @@ impl FP16x16Tensor of TensorTrait { } fn argmax( - self: @Tensor, axis: usize, keepdims: Option, select_last_index: Option - ) -> Tensor { + self: @Tensor, axis: i32, keepdims: Option, select_last_index: Option + ) -> Tensor { math::argmax::argmax(self, axis, keepdims, select_last_index) } @@ -123,11 +130,11 @@ impl FP16x16Tensor of TensorTrait { math::greater_equal::greater_equal(self, other) } - fn less(self: @Tensor, other: @Tensor) -> Tensor { + fn less(self: @Tensor, other: @Tensor) -> Tensor { math::less::less(self, other) } - fn less_equal(self: @Tensor, other: @Tensor) -> Tensor { + fn less_equal(self: @Tensor, other: @Tensor) -> Tensor { math::less_equal::less_equal(self, other) } @@ -338,6 +345,44 @@ impl FP16x16Tensor of TensorTrait { ) } + fn qlinear_conv( + self: @Tensor, + X_scale: @Tensor, + X_zero_point: @Tensor, + W: @Tensor, + W_scale: @Tensor, + W_zero_point: @Tensor, + B: Option>, + auto_pad: Option, + dilations: Option>, + group: Option, + kernel_shape: Option>, + pads: Option>, + strides: Option>, + y_scale: @Tensor, + y_zero_point: @Tensor, + ) -> Tensor { + quantization::qlinear_conv::qlinear_conv( + self, + X_scale, + X_zero_point, + W, + W_scale, + W_zero_point, + B, + auto_pad, + dilations, + group, + kernel_shape, + pads, + strides, + y_scale, + y_zero_point, + NumberTrait::new_unscaled(128, true), + NumberTrait::new_unscaled(127, false) + ) + } + fn slice( self: @Tensor, starts: Span, @@ -349,7 +394,7 @@ impl FP16x16Tensor of TensorTrait { } fn gather( - self: @Tensor, indices: Tensor, axis: Option + self: @Tensor, indices: Tensor, axis: Option ) -> Tensor { math::gather::gather(self, indices, axis) } @@ -441,7 +486,7 @@ impl FP16x16Tensor of TensorTrait { } fn gather_elements( - self: @Tensor, indices: Tensor, axis: Option + self: @Tensor, indices: Tensor, axis: Option ) -> Tensor { math::gather_elements::gather_elements(self, indices, axis) } @@ -625,6 +670,13 @@ impl FP16x16Tensor of TensorTrait { ) -> Tensor { math::scatter_nd::scatter_nd(self, updates, indices, reduction) } + + fn center_crop_pad( + self: @Tensor, shape: Tensor, axes: Option> + ) -> Tensor { + let zero = NumberTrait::::zero(); + manipulation::center_crop_pad::center_crop_pad(self, shape, axes, zero) + } fn label_encoder( self: @Tensor, diff --git a/src/operators/tensor/implementations/tensor_fp16x16wide.cairo b/src/operators/tensor/implementations/tensor_fp16x16wide.cairo index 2003b28ff..e809f3658 100644 --- a/src/operators/tensor/implementations/tensor_fp16x16wide.cairo +++ b/src/operators/tensor/implementations/tensor_fp16x16wide.cairo @@ -16,6 +16,7 @@ use orion::numbers::fixed_point::implementations::fp16x16wide::core::{ }; use orion::numbers::fixed_point::implementations::fp16x16::core::FP16x16; +use orion::operators::nn::AUTO_PAD; impl FP16x16WTensor of TensorTrait { @@ -75,12 +76,17 @@ impl FP16x16WTensor of TensorTrait { unravel_index(index, *self.shape) } - fn reshape(self: @Tensor, target_shape: Span) -> Tensor { - reshape(self, target_shape) + fn reshape(self: @Tensor, target_shape: Span, allowzero: bool) -> Tensor { + reshape(self, target_shape, allowzero) } - fn reduce_sum(self: @Tensor, axis: usize, keepdims: bool) -> Tensor { - math::reduce_sum::reduce_sum(self, axis, keepdims) + fn reduce_sum( + self: @Tensor, + axes: Option>, + keepdims: Option, + noop_with_empty_axes: Option + ) -> Tensor { + math::reduce_sum::reduce_sum(self, axes, keepdims, noop_with_empty_axes) } fn reduce_prod(self: @Tensor, axis: usize, keepdims: bool) -> Tensor { @@ -89,10 +95,10 @@ impl FP16x16WTensor of TensorTrait { fn argmax( self: @Tensor, - axis: usize, + axis: i32, keepdims: Option, select_last_index: Option - ) -> Tensor { + ) -> Tensor { math::argmax::argmax(self, axis, keepdims, select_last_index) } @@ -133,11 +139,11 @@ impl FP16x16WTensor of TensorTrait { math::greater_equal::greater_equal(self, other) } - fn less(self: @Tensor, other: @Tensor) -> Tensor { + fn less(self: @Tensor, other: @Tensor) -> Tensor { math::less::less(self, other) } - fn less_equal(self: @Tensor, other: @Tensor) -> Tensor { + fn less_equal(self: @Tensor, other: @Tensor) -> Tensor { math::less_equal::less_equal(self, other) } @@ -302,6 +308,26 @@ impl FP16x16WTensor of TensorTrait { panic(array!['not supported!']) } + fn qlinear_conv( + self: @Tensor, + X_scale: @Tensor, + X_zero_point: @Tensor, + W: @Tensor, + W_scale: @Tensor, + W_zero_point: @Tensor, + B: Option>, + auto_pad: Option, + dilations: Option>, + group: Option, + kernel_shape: Option>, + pads: Option>, + strides: Option>, + y_scale: @Tensor, + y_zero_point: @Tensor, + ) -> Tensor { + panic(array!['not supported!']) + } + fn slice( self: @Tensor, starts: Span, @@ -313,7 +339,7 @@ impl FP16x16WTensor of TensorTrait { } fn gather( - self: @Tensor, indices: Tensor, axis: Option + self: @Tensor, indices: Tensor, axis: Option ) -> Tensor { math::gather::gather(self, indices, axis) } @@ -411,7 +437,7 @@ impl FP16x16WTensor of TensorTrait { } fn gather_elements( - self: @Tensor, indices: Tensor, axis: Option + self: @Tensor, indices: Tensor, axis: Option ) -> Tensor { math::gather_elements::gather_elements(self, indices, axis) } @@ -586,6 +612,13 @@ impl FP16x16WTensor of TensorTrait { math::scatter_nd::scatter_nd(self, updates, indices, reduction) } + fn center_crop_pad( + self: @Tensor, shape: Tensor, axes: Option> + ) -> Tensor { + let zero = NumberTrait::::zero(); + manipulation::center_crop_pad::center_crop_pad(self, shape, axes, zero) + } + fn label_encoder( self: @Tensor, default_list: Option>, diff --git a/src/operators/tensor/implementations/tensor_fp32x32.cairo b/src/operators/tensor/implementations/tensor_fp32x32.cairo index 4870226a1..87b0e80bc 100644 --- a/src/operators/tensor/implementations/tensor_fp32x32.cairo +++ b/src/operators/tensor/implementations/tensor_fp32x32.cairo @@ -10,6 +10,8 @@ use orion::numbers::fixed_point::implementations::fp32x32::core::ONE; use orion::operators::tensor::implementations::{ tensor_i8::I8Tensor, tensor_u32::U32Tensor, tensor_bool::BoolTensor }; +use orion::operators::nn::AUTO_PAD; +use orion::operators::nn::implementations::nn_fp32x32::FP32x32NN; impl FP32x32Tensor of TensorTrait { fn new(shape: Span, data: Span) -> Tensor { @@ -68,12 +70,17 @@ impl FP32x32Tensor of TensorTrait { unravel_index(index, *self.shape) } - fn reshape(self: @Tensor, target_shape: Span) -> Tensor { - reshape(self, target_shape) + fn reshape(self: @Tensor, target_shape: Span, allowzero: bool) -> Tensor { + reshape(self, target_shape, allowzero) } - fn reduce_sum(self: @Tensor, axis: usize, keepdims: bool) -> Tensor { - math::reduce_sum::reduce_sum(self, axis, keepdims) + fn reduce_sum( + self: @Tensor, + axes: Option>, + keepdims: Option, + noop_with_empty_axes: Option + ) -> Tensor { + math::reduce_sum::reduce_sum(self, axes, keepdims, noop_with_empty_axes) } fn reduce_prod(self: @Tensor, axis: usize, keepdims: bool) -> Tensor { @@ -81,8 +88,8 @@ impl FP32x32Tensor of TensorTrait { } fn argmax( - self: @Tensor, axis: usize, keepdims: Option, select_last_index: Option - ) -> Tensor { + self: @Tensor, axis: i32, keepdims: Option, select_last_index: Option + ) -> Tensor { math::argmax::argmax(self, axis, keepdims, select_last_index) } @@ -120,11 +127,11 @@ impl FP32x32Tensor of TensorTrait { math::greater_equal::greater_equal(self, other) } - fn less(self: @Tensor, other: @Tensor) -> Tensor { + fn less(self: @Tensor, other: @Tensor) -> Tensor { math::less::less(self, other) } - fn less_equal(self: @Tensor, other: @Tensor) -> Tensor { + fn less_equal(self: @Tensor, other: @Tensor) -> Tensor { math::less_equal::less_equal(self, other) } @@ -335,6 +342,44 @@ impl FP32x32Tensor of TensorTrait { ) } + fn qlinear_conv( + self: @Tensor, + X_scale: @Tensor, + X_zero_point: @Tensor, + W: @Tensor, + W_scale: @Tensor, + W_zero_point: @Tensor, + B: Option>, + auto_pad: Option, + dilations: Option>, + group: Option, + kernel_shape: Option>, + pads: Option>, + strides: Option>, + y_scale: @Tensor, + y_zero_point: @Tensor, + ) -> Tensor { + quantization::qlinear_conv::qlinear_conv( + self, + X_scale, + X_zero_point, + W, + W_scale, + W_zero_point, + B, + auto_pad, + dilations, + group, + kernel_shape, + pads, + strides, + y_scale, + y_zero_point, + NumberTrait::new_unscaled(128, true), + NumberTrait::new_unscaled(127, false) + ) + } + fn slice( self: @Tensor, starts: Span, @@ -346,7 +391,7 @@ impl FP32x32Tensor of TensorTrait { } fn gather( - self: @Tensor, indices: Tensor, axis: Option + self: @Tensor, indices: Tensor, axis: Option ) -> Tensor { math::gather::gather(self, indices, axis) } @@ -438,7 +483,7 @@ impl FP32x32Tensor of TensorTrait { } fn gather_elements( - self: @Tensor, indices: Tensor, axis: Option + self: @Tensor, indices: Tensor, axis: Option ) -> Tensor { math::gather_elements::gather_elements(self, indices, axis) } @@ -622,6 +667,13 @@ impl FP32x32Tensor of TensorTrait { math::scatter_nd::scatter_nd(self, updates, indices, reduction) } + fn center_crop_pad( + self: @Tensor, shape: Tensor, axes: Option> + ) -> Tensor { + let zero = NumberTrait::::zero(); + manipulation::center_crop_pad::center_crop_pad(self, shape, axes, zero) + } + fn label_encoder( self: @Tensor, default_list: Option>, diff --git a/src/operators/tensor/implementations/tensor_fp64x64.cairo b/src/operators/tensor/implementations/tensor_fp64x64.cairo index 3a7214d18..d186dc286 100644 --- a/src/operators/tensor/implementations/tensor_fp64x64.cairo +++ b/src/operators/tensor/implementations/tensor_fp64x64.cairo @@ -10,6 +10,8 @@ use orion::numbers::fixed_point::implementations::fp64x64::core::ONE; use orion::operators::tensor::implementations::{ tensor_i8::I8Tensor, tensor_u32::U32Tensor, tensor_bool::BoolTensor }; +use orion::operators::nn::AUTO_PAD; +use orion::operators::nn::implementations::nn_fp64x64::FP64x64NN; impl FP64x64Tensor of TensorTrait { fn new(shape: Span, data: Span) -> Tensor { @@ -68,12 +70,17 @@ impl FP64x64Tensor of TensorTrait { unravel_index(index, *self.shape) } - fn reshape(self: @Tensor, target_shape: Span) -> Tensor { - reshape(self, target_shape) + fn reshape(self: @Tensor, target_shape: Span, allowzero: bool) -> Tensor { + reshape(self, target_shape, allowzero) } - fn reduce_sum(self: @Tensor, axis: usize, keepdims: bool) -> Tensor { - math::reduce_sum::reduce_sum(self, axis, keepdims) + fn reduce_sum( + self: @Tensor, + axes: Option>, + keepdims: Option, + noop_with_empty_axes: Option + ) -> Tensor { + math::reduce_sum::reduce_sum(self, axes, keepdims, noop_with_empty_axes) } fn reduce_prod(self: @Tensor, axis: usize, keepdims: bool) -> Tensor { @@ -81,8 +88,8 @@ impl FP64x64Tensor of TensorTrait { } fn argmax( - self: @Tensor, axis: usize, keepdims: Option, select_last_index: Option - ) -> Tensor { + self: @Tensor, axis: i32, keepdims: Option, select_last_index: Option + ) -> Tensor { math::argmax::argmax(self, axis, keepdims, select_last_index) } @@ -120,11 +127,11 @@ impl FP64x64Tensor of TensorTrait { math::greater_equal::greater_equal(self, other) } - fn less(self: @Tensor, other: @Tensor) -> Tensor { + fn less(self: @Tensor, other: @Tensor) -> Tensor { math::less::less(self, other) } - fn less_equal(self: @Tensor, other: @Tensor) -> Tensor { + fn less_equal(self: @Tensor, other: @Tensor) -> Tensor { math::less_equal::less_equal(self, other) } @@ -335,6 +342,44 @@ impl FP64x64Tensor of TensorTrait { ) } + fn qlinear_conv( + self: @Tensor, + X_scale: @Tensor, + X_zero_point: @Tensor, + W: @Tensor, + W_scale: @Tensor, + W_zero_point: @Tensor, + B: Option>, + auto_pad: Option, + dilations: Option>, + group: Option, + kernel_shape: Option>, + pads: Option>, + strides: Option>, + y_scale: @Tensor, + y_zero_point: @Tensor, + ) -> Tensor { + quantization::qlinear_conv::qlinear_conv( + self, + X_scale, + X_zero_point, + W, + W_scale, + W_zero_point, + B, + auto_pad, + dilations, + group, + kernel_shape, + pads, + strides, + y_scale, + y_zero_point, + NumberTrait::new_unscaled(128, true), + NumberTrait::new_unscaled(127, false) + ) + } + fn slice( self: @Tensor, starts: Span, @@ -346,7 +391,7 @@ impl FP64x64Tensor of TensorTrait { } fn gather( - self: @Tensor, indices: Tensor, axis: Option + self: @Tensor, indices: Tensor, axis: Option ) -> Tensor { math::gather::gather(self, indices, axis) } @@ -438,7 +483,7 @@ impl FP64x64Tensor of TensorTrait { } fn gather_elements( - self: @Tensor, indices: Tensor, axis: Option + self: @Tensor, indices: Tensor, axis: Option ) -> Tensor { math::gather_elements::gather_elements(self, indices, axis) } @@ -622,6 +667,13 @@ impl FP64x64Tensor of TensorTrait { math::scatter_nd::scatter_nd(self, updates, indices, reduction) } + fn center_crop_pad( + self: @Tensor, shape: Tensor, axes: Option> + ) -> Tensor { + let zero = NumberTrait::::zero(); + manipulation::center_crop_pad::center_crop_pad(self, shape, axes, zero) + } + fn label_encoder( self: @Tensor, default_list: Option>, diff --git a/src/operators/tensor/implementations/tensor_fp8x23.cairo b/src/operators/tensor/implementations/tensor_fp8x23.cairo index b4a26d749..50ff34775 100644 --- a/src/operators/tensor/implementations/tensor_fp8x23.cairo +++ b/src/operators/tensor/implementations/tensor_fp8x23.cairo @@ -10,6 +10,8 @@ use orion::operators::tensor::implementations::{ tensor_i8::I8Tensor, tensor_u32::U32Tensor, tensor_bool::BoolTensor }; use orion::numbers::fixed_point::implementations::fp8x23::math::trig::PI; +use orion::operators::nn::AUTO_PAD; +use orion::operators::nn::implementations::nn_fp8x23::FP8x23NN; impl FP8x23Tensor of TensorTrait { fn new(shape: Span, data: Span) -> Tensor { @@ -68,12 +70,17 @@ impl FP8x23Tensor of TensorTrait { unravel_index(index, *self.shape) } - fn reshape(self: @Tensor, target_shape: Span) -> Tensor { - reshape(self, target_shape) + fn reshape(self: @Tensor, target_shape: Span, allowzero: bool) -> Tensor { + reshape(self, target_shape, allowzero) } - fn reduce_sum(self: @Tensor, axis: usize, keepdims: bool) -> Tensor { - math::reduce_sum::reduce_sum(self, axis, keepdims) + fn reduce_sum( + self: @Tensor, + axes: Option>, + keepdims: Option, + noop_with_empty_axes: Option + ) -> Tensor { + math::reduce_sum::reduce_sum(self, axes, keepdims, noop_with_empty_axes) } fn reduce_prod(self: @Tensor, axis: usize, keepdims: bool) -> Tensor { @@ -81,8 +88,8 @@ impl FP8x23Tensor of TensorTrait { } fn argmax( - self: @Tensor, axis: usize, keepdims: Option, select_last_index: Option - ) -> Tensor { + self: @Tensor, axis: i32, keepdims: Option, select_last_index: Option + ) -> Tensor { math::argmax::argmax(self, axis, keepdims, select_last_index) } @@ -120,11 +127,11 @@ impl FP8x23Tensor of TensorTrait { math::greater_equal::greater_equal(self, other) } - fn less(self: @Tensor, other: @Tensor) -> Tensor { + fn less(self: @Tensor, other: @Tensor) -> Tensor { math::less::less(self, other) } - fn less_equal(self: @Tensor, other: @Tensor) -> Tensor { + fn less_equal(self: @Tensor, other: @Tensor) -> Tensor { math::less_equal::less_equal(self, other) } @@ -335,6 +342,44 @@ impl FP8x23Tensor of TensorTrait { ) } + fn qlinear_conv( + self: @Tensor, + X_scale: @Tensor, + X_zero_point: @Tensor, + W: @Tensor, + W_scale: @Tensor, + W_zero_point: @Tensor, + B: Option>, + auto_pad: Option, + dilations: Option>, + group: Option, + kernel_shape: Option>, + pads: Option>, + strides: Option>, + y_scale: @Tensor, + y_zero_point: @Tensor, + ) -> Tensor { + quantization::qlinear_conv::qlinear_conv( + self, + X_scale, + X_zero_point, + W, + W_scale, + W_zero_point, + B, + auto_pad, + dilations, + group, + kernel_shape, + pads, + strides, + y_scale, + y_zero_point, + NumberTrait::new_unscaled(128, true), + NumberTrait::new_unscaled(127, false) + ) + } + fn slice( self: @Tensor, starts: Span, @@ -345,9 +390,7 @@ impl FP8x23Tensor of TensorTrait { core_ops::slice::(self, starts, ends, axes, steps) } - fn gather( - self: @Tensor, indices: Tensor, axis: Option - ) -> Tensor { + fn gather(self: @Tensor, indices: Tensor, axis: Option) -> Tensor { math::gather::gather(self, indices, axis) } @@ -426,7 +469,7 @@ impl FP8x23Tensor of TensorTrait { } fn gather_elements( - self: @Tensor, indices: Tensor, axis: Option + self: @Tensor, indices: Tensor, axis: Option ) -> Tensor { math::gather_elements::gather_elements(self, indices, axis) } @@ -620,6 +663,13 @@ impl FP8x23Tensor of TensorTrait { math::scatter_nd::scatter_nd(self, updates, indices, reduction) } + fn center_crop_pad( + self: @Tensor, shape: Tensor, axes: Option> + ) -> Tensor { + let zero = NumberTrait::::zero(); + manipulation::center_crop_pad::center_crop_pad(self, shape, axes, zero) + } + fn label_encoder( self: @Tensor, default_list: Option>, @@ -777,17 +827,19 @@ fn relative_eq(lhs: @FP8x23, rhs: @FP8x23) -> bool { fn tensor_eq(mut lhs: Tensor, mut rhs: Tensor,) -> bool { let mut is_eq = true; - while lhs.shape.len() != 0 && is_eq { - is_eq = lhs.shape.pop_front().unwrap() == rhs.shape.pop_front().unwrap(); - }; + while lhs.shape.len() != 0 + && is_eq { + is_eq = lhs.shape.pop_front().unwrap() == rhs.shape.pop_front().unwrap(); + }; if !is_eq { return false; } - while lhs.data.len() != 0 && is_eq { - is_eq = relative_eq(lhs.data.pop_front().unwrap(), rhs.data.pop_front().unwrap()); - }; + while lhs.data.len() != 0 + && is_eq { + is_eq = relative_eq(lhs.data.pop_front().unwrap(), rhs.data.pop_front().unwrap()); + }; is_eq } diff --git a/src/operators/tensor/implementations/tensor_fp8x23wide.cairo b/src/operators/tensor/implementations/tensor_fp8x23wide.cairo index 06a297b69..132d4fdd0 100644 --- a/src/operators/tensor/implementations/tensor_fp8x23wide.cairo +++ b/src/operators/tensor/implementations/tensor_fp8x23wide.cairo @@ -12,6 +12,7 @@ use orion::operators::tensor::implementations::{ use orion::numbers::fixed_point::implementations::fp8x23wide::math::trig::PI; use orion::numbers::fixed_point::implementations::fp8x23::core::FP8x23; +use orion::operators::nn::AUTO_PAD; impl FP8x23WTensor of TensorTrait { @@ -71,12 +72,17 @@ impl FP8x23WTensor of TensorTrait { unravel_index(index, *self.shape) } - fn reshape(self: @Tensor, target_shape: Span) -> Tensor { - reshape(self, target_shape) + fn reshape(self: @Tensor, target_shape: Span, allowzero: bool) -> Tensor { + reshape(self, target_shape, allowzero) } - fn reduce_sum(self: @Tensor, axis: usize, keepdims: bool) -> Tensor { - math::reduce_sum::reduce_sum(self, axis, keepdims) + fn reduce_sum( + self: @Tensor, + axes: Option>, + keepdims: Option, + noop_with_empty_axes: Option + ) -> Tensor { + math::reduce_sum::reduce_sum(self, axes, keepdims, noop_with_empty_axes) } fn reduce_prod(self: @Tensor, axis: usize, keepdims: bool) -> Tensor { @@ -84,8 +90,8 @@ impl FP8x23WTensor of TensorTrait { } fn argmax( - self: @Tensor, axis: usize, keepdims: Option, select_last_index: Option - ) -> Tensor { + self: @Tensor, axis: i32, keepdims: Option, select_last_index: Option + ) -> Tensor { math::argmax::argmax(self, axis, keepdims, select_last_index) } @@ -123,11 +129,11 @@ impl FP8x23WTensor of TensorTrait { math::greater_equal::greater_equal(self, other) } - fn less(self: @Tensor, other: @Tensor) -> Tensor { + fn less(self: @Tensor, other: @Tensor) -> Tensor { math::less::less(self, other) } - fn less_equal(self: @Tensor, other: @Tensor) -> Tensor { + fn less_equal(self: @Tensor, other: @Tensor) -> Tensor { math::less_equal::less_equal(self, other) } @@ -289,6 +295,26 @@ impl FP8x23WTensor of TensorTrait { panic(array!['not supported!']) } + fn qlinear_conv( + self: @Tensor, + X_scale: @Tensor, + X_zero_point: @Tensor, + W: @Tensor, + W_scale: @Tensor, + W_zero_point: @Tensor, + B: Option>, + auto_pad: Option, + dilations: Option>, + group: Option, + kernel_shape: Option>, + pads: Option>, + strides: Option>, + y_scale: @Tensor, + y_zero_point: @Tensor, + ) -> Tensor { + panic(array!['not supported!']) + } + fn slice( self: @Tensor, starts: Span, @@ -300,7 +326,7 @@ impl FP8x23WTensor of TensorTrait { } fn gather( - self: @Tensor, indices: Tensor, axis: Option + self: @Tensor, indices: Tensor, axis: Option ) -> Tensor { math::gather::gather(self, indices, axis) } @@ -393,7 +419,7 @@ impl FP8x23WTensor of TensorTrait { } fn gather_elements( - self: @Tensor, indices: Tensor, axis: Option + self: @Tensor, indices: Tensor, axis: Option ) -> Tensor { math::gather_elements::gather_elements(self, indices, axis) } @@ -563,6 +589,13 @@ impl FP8x23WTensor of TensorTrait { math::scatter_nd::scatter_nd(self, updates, indices, reduction) } + fn center_crop_pad( + self: @Tensor, shape: Tensor, axes: Option> + ) -> Tensor { + let zero = NumberTrait::::zero(); + manipulation::center_crop_pad::center_crop_pad(self, shape, axes, zero) + } + fn label_encoder( self: @Tensor, default_list: Option>, diff --git a/src/operators/tensor/implementations/tensor_i32.cairo b/src/operators/tensor/implementations/tensor_i32.cairo index 434d1c806..cef00cadc 100644 --- a/src/operators/tensor/implementations/tensor_i32.cairo +++ b/src/operators/tensor/implementations/tensor_i32.cairo @@ -10,6 +10,8 @@ use orion::numbers::{NumberTrait}; use orion::operators::tensor::implementations::{ tensor_u32::U32Tensor, tensor_i8::I8Tensor, tensor_bool::BoolTensor }; +use orion::operators::nn::AUTO_PAD; +use orion::operators::nn::implementations::nn_i32::I32NN; impl I32Tensor of TensorTrait { fn new(shape: Span, data: Span) -> Tensor { @@ -68,12 +70,17 @@ impl I32Tensor of TensorTrait { unravel_index(index, *self.shape) } - fn reshape(self: @Tensor, target_shape: Span) -> Tensor { - reshape(self, target_shape) + fn reshape(self: @Tensor, target_shape: Span, allowzero: bool) -> Tensor { + reshape(self, target_shape, allowzero) } - fn reduce_sum(self: @Tensor, axis: usize, keepdims: bool) -> Tensor { - math::reduce_sum::reduce_sum(self, axis, keepdims) + fn reduce_sum( + self: @Tensor, + axes: Option>, + keepdims: Option, + noop_with_empty_axes: Option + ) -> Tensor { + math::reduce_sum::reduce_sum(self, axes, keepdims, noop_with_empty_axes) } @@ -82,8 +89,8 @@ impl I32Tensor of TensorTrait { } fn argmax( - self: @Tensor, axis: usize, keepdims: Option, select_last_index: Option - ) -> Tensor { + self: @Tensor, axis: i32, keepdims: Option, select_last_index: Option + ) -> Tensor { math::argmax::argmax(self, axis, keepdims, select_last_index) } @@ -121,11 +128,11 @@ impl I32Tensor of TensorTrait { math::greater_equal::greater_equal(self, other) } - fn less(self: @Tensor, other: @Tensor) -> Tensor { + fn less(self: @Tensor, other: @Tensor) -> Tensor { math::less::less(self, other) } - fn less_equal(self: @Tensor, other: @Tensor) -> Tensor { + fn less_equal(self: @Tensor, other: @Tensor) -> Tensor { math::less_equal::less_equal(self, other) } @@ -330,6 +337,44 @@ impl I32Tensor of TensorTrait { ) } + fn qlinear_conv( + self: @Tensor, + X_scale: @Tensor, + X_zero_point: @Tensor, + W: @Tensor, + W_scale: @Tensor, + W_zero_point: @Tensor, + B: Option>, + auto_pad: Option, + dilations: Option>, + group: Option, + kernel_shape: Option>, + pads: Option>, + strides: Option>, + y_scale: @Tensor, + y_zero_point: @Tensor, + ) -> Tensor { + quantization::qlinear_conv::qlinear_conv( + self, + X_scale, + X_zero_point, + W, + W_scale, + W_zero_point, + B, + auto_pad, + dilations, + group, + kernel_shape, + pads, + strides, + y_scale, + y_zero_point, + NumberTrait::new_unscaled(128, true), + NumberTrait::new_unscaled(127, false) + ) + } + fn slice( self: @Tensor, starts: Span, @@ -340,7 +385,7 @@ impl I32Tensor of TensorTrait { core_tensor::slice::(self, starts, ends, axes, steps) } - fn gather(self: @Tensor, indices: Tensor, axis: Option) -> Tensor { + fn gather(self: @Tensor, indices: Tensor, axis: Option) -> Tensor { math::gather::gather(self, indices, axis) } @@ -431,7 +476,7 @@ impl I32Tensor of TensorTrait { } fn gather_elements( - self: @Tensor, indices: Tensor, axis: Option + self: @Tensor, indices: Tensor, axis: Option ) -> Tensor { math::gather_elements::gather_elements(self, indices, axis) } @@ -586,6 +631,13 @@ impl I32Tensor of TensorTrait { math::scatter_nd::scatter_nd(self, updates, indices, reduction) } + fn center_crop_pad( + self: @Tensor, shape: Tensor, axes: Option> + ) -> Tensor { + let zero = 0_i32; + manipulation::center_crop_pad::center_crop_pad(self, shape, axes, zero) + } + fn label_encoder( self: @Tensor, default_list: Option>, diff --git a/src/operators/tensor/implementations/tensor_i8.cairo b/src/operators/tensor/implementations/tensor_i8.cairo index 6e4ebb4cd..282670ca7 100644 --- a/src/operators/tensor/implementations/tensor_i8.cairo +++ b/src/operators/tensor/implementations/tensor_i8.cairo @@ -8,6 +8,8 @@ use orion::operators::tensor::core::{ use orion::operators::tensor::{math, linalg, quantization, core as core_tensor, ml, manipulation}; use orion::numbers::{NumberTrait}; use orion::operators::tensor::implementations::{tensor_u32::U32Tensor, tensor_bool::BoolTensor}; +use orion::operators::nn::AUTO_PAD; +use orion::operators::nn::implementations::nn_i8::I8NN; impl I8Tensor of TensorTrait { fn new(shape: Span, data: Span) -> Tensor { @@ -66,12 +68,17 @@ impl I8Tensor of TensorTrait { unravel_index(index, *self.shape) } - fn reshape(self: @Tensor, target_shape: Span) -> Tensor { - reshape(self, target_shape) + fn reshape(self: @Tensor, target_shape: Span, allowzero: bool) -> Tensor { + reshape(self, target_shape, allowzero) } - fn reduce_sum(self: @Tensor, axis: usize, keepdims: bool) -> Tensor { - math::reduce_sum::reduce_sum(self, axis, keepdims) + fn reduce_sum( + self: @Tensor, + axes: Option>, + keepdims: Option, + noop_with_empty_axes: Option + ) -> Tensor { + math::reduce_sum::reduce_sum(self, axes, keepdims, noop_with_empty_axes) } fn reduce_prod(self: @Tensor, axis: usize, keepdims: bool) -> Tensor { @@ -79,8 +86,8 @@ impl I8Tensor of TensorTrait { } fn argmax( - self: @Tensor, axis: usize, keepdims: Option, select_last_index: Option - ) -> Tensor { + self: @Tensor, axis: i32, keepdims: Option, select_last_index: Option + ) -> Tensor { math::argmax::argmax(self, axis, keepdims, select_last_index) } @@ -118,11 +125,11 @@ impl I8Tensor of TensorTrait { math::greater_equal::greater_equal(self, other) } - fn less(self: @Tensor, other: @Tensor) -> Tensor { + fn less(self: @Tensor, other: @Tensor) -> Tensor { math::less::less(self, other) } - fn less_equal(self: @Tensor, other: @Tensor) -> Tensor { + fn less_equal(self: @Tensor, other: @Tensor) -> Tensor { math::less_equal::less_equal(self, other) } @@ -333,6 +340,44 @@ impl I8Tensor of TensorTrait { ) } + fn qlinear_conv( + self: @Tensor, + X_scale: @Tensor, + X_zero_point: @Tensor, + W: @Tensor, + W_scale: @Tensor, + W_zero_point: @Tensor, + B: Option>, + auto_pad: Option, + dilations: Option>, + group: Option, + kernel_shape: Option>, + pads: Option>, + strides: Option>, + y_scale: @Tensor, + y_zero_point: @Tensor, + ) -> Tensor { + quantization::qlinear_conv::qlinear_conv( + self, + X_scale, + X_zero_point, + W, + W_scale, + W_zero_point, + B, + auto_pad, + dilations, + group, + kernel_shape, + pads, + strides, + y_scale, + y_zero_point, + NumberTrait::new_unscaled(127, true), + NumberTrait::new_unscaled(127, false) + ) + } + fn slice( self: @Tensor, starts: Span, @@ -343,7 +388,7 @@ impl I8Tensor of TensorTrait { core_tensor::slice::(self, starts, ends, axes, steps) } - fn gather(self: @Tensor, indices: Tensor, axis: Option) -> Tensor { + fn gather(self: @Tensor, indices: Tensor, axis: Option) -> Tensor { math::gather::gather(self, indices, axis) } @@ -434,7 +479,7 @@ impl I8Tensor of TensorTrait { } fn gather_elements( - self: @Tensor, indices: Tensor, axis: Option + self: @Tensor, indices: Tensor, axis: Option ) -> Tensor { math::gather_elements::gather_elements(self, indices, axis) } @@ -589,6 +634,13 @@ impl I8Tensor of TensorTrait { math::scatter_nd::scatter_nd(self, updates, indices, reduction) } + fn center_crop_pad( + self: @Tensor, shape: Tensor, axes: Option> + ) -> Tensor { + let zero = 0_i8; + manipulation::center_crop_pad::center_crop_pad(self, shape, axes, zero) + } + fn label_encoder( self: @Tensor, default_list: Option>, diff --git a/src/operators/tensor/implementations/tensor_u32.cairo b/src/operators/tensor/implementations/tensor_u32.cairo index efb681a86..a796350cb 100644 --- a/src/operators/tensor/implementations/tensor_u32.cairo +++ b/src/operators/tensor/implementations/tensor_u32.cairo @@ -7,6 +7,7 @@ use orion::operators::tensor::core::{ use orion::operators::tensor::{math, linalg, quantization, core as core_tensor, ml, manipulation}; use orion::numbers::{NumberTrait}; use orion::operators::tensor::implementations::{tensor_i8::I8Tensor, tensor_bool::BoolTensor}; +use orion::operators::nn::AUTO_PAD; impl U32Tensor of TensorTrait { fn new(shape: Span, data: Span) -> Tensor { @@ -65,12 +66,17 @@ impl U32Tensor of TensorTrait { unravel_index(index, *self.shape) } - fn reshape(self: @Tensor, target_shape: Span) -> Tensor { - reshape(self, target_shape) + fn reshape(self: @Tensor, target_shape: Span, allowzero: bool) -> Tensor { + reshape(self, target_shape, allowzero) } - fn reduce_sum(self: @Tensor, axis: usize, keepdims: bool) -> Tensor { - math::reduce_sum::reduce_sum(self, axis, keepdims) + fn reduce_sum( + self: @Tensor, + axes: Option>, + keepdims: Option, + noop_with_empty_axes: Option + ) -> Tensor { + math::reduce_sum::reduce_sum(self, axes, keepdims, noop_with_empty_axes) } fn reduce_prod(self: @Tensor, axis: usize, keepdims: bool) -> Tensor { @@ -78,8 +84,8 @@ impl U32Tensor of TensorTrait { } fn argmax( - self: @Tensor, axis: usize, keepdims: Option, select_last_index: Option - ) -> Tensor { + self: @Tensor, axis: i32, keepdims: Option, select_last_index: Option + ) -> Tensor { math::argmax::argmax(self, axis, keepdims, select_last_index) } @@ -117,11 +123,11 @@ impl U32Tensor of TensorTrait { math::greater_equal::greater_equal(self, other) } - fn less(self: @Tensor, other: @Tensor) -> Tensor { + fn less(self: @Tensor, other: @Tensor) -> Tensor { math::less::less(self, other) } - fn less_equal(self: @Tensor, other: @Tensor) -> Tensor { + fn less_equal(self: @Tensor, other: @Tensor) -> Tensor { math::less_equal::less_equal(self, other) } @@ -277,6 +283,26 @@ impl U32Tensor of TensorTrait { panic(array!['not supported!']) } + fn qlinear_conv( + self: @Tensor, + X_scale: @Tensor, + X_zero_point: @Tensor, + W: @Tensor, + W_scale: @Tensor, + W_zero_point: @Tensor, + B: Option>, + auto_pad: Option, + dilations: Option>, + group: Option, + kernel_shape: Option>, + pads: Option>, + strides: Option>, + y_scale: @Tensor, + y_zero_point: @Tensor, + ) -> Tensor { + panic(array!['not supported!']) + } + fn slice( self: @Tensor, starts: Span, @@ -287,7 +313,7 @@ impl U32Tensor of TensorTrait { core_tensor::slice::(self, starts, ends, axes, steps) } - fn gather(self: @Tensor, indices: Tensor, axis: Option) -> Tensor { + fn gather(self: @Tensor, indices: Tensor, axis: Option) -> Tensor { math::gather::gather(self, indices, axis) } @@ -378,7 +404,7 @@ impl U32Tensor of TensorTrait { } fn gather_elements( - self: @Tensor, indices: Tensor, axis: Option + self: @Tensor, indices: Tensor, axis: Option ) -> Tensor { math::gather_elements::gather_elements(self, indices, axis) } @@ -533,6 +559,13 @@ impl U32Tensor of TensorTrait { math::scatter_nd::scatter_nd(self, updates, indices, reduction) } + fn center_crop_pad( + self: @Tensor, shape: Tensor, axes: Option> + ) -> Tensor { + let zero = 0_u32; + manipulation::center_crop_pad::center_crop_pad(self, shape, axes, zero) + } + fn label_encoder( self: @Tensor, default_list: Option>, diff --git a/src/operators/tensor/manipulation.cairo b/src/operators/tensor/manipulation.cairo index 057e5afad..18edfc105 100644 --- a/src/operators/tensor/manipulation.cairo +++ b/src/operators/tensor/manipulation.cairo @@ -3,3 +3,4 @@ mod split; mod split_to_sequence; mod reverse_sequence; mod optional; +mod center_crop_pad; \ No newline at end of file diff --git a/src/operators/tensor/manipulation/center_crop_pad.cairo b/src/operators/tensor/manipulation/center_crop_pad.cairo new file mode 100644 index 000000000..21c9f5531 --- /dev/null +++ b/src/operators/tensor/manipulation/center_crop_pad.cairo @@ -0,0 +1,333 @@ +use orion::operators::tensor::{Tensor, TensorTrait, U32Tensor}; +use core::array::{ArrayTrait, SpanTrait}; +use core::option::OptionTrait; +use orion::numbers::NumberTrait; +use alexandria_data_structures::array_ext::{ArrayTraitExt, SpanTraitExt}; + +/// Cf: Tensor::center_crop_pad docstring +fn center_crop_pad< + T, + +Copy, + +Drop, + +TensorTrait, +>( + self: @Tensor, shape: Tensor, axes: Option>, zero: T +) -> Tensor { + let input_rank: usize = (*self.shape).len(); + let mut axes: Array = match axes { + Option::Some(mut value) => { + let mut axes: Array = ArrayTrait::new(); + loop { + match value.pop_front() { + Option::Some(axis) => { + if axis >= 0 { + axes.append(axis.try_into().unwrap()); + } else { + let mut input_rank: i64 = input_rank.into(); + assert!(axis + input_rank >= 0, "shape cannot be less than 0"); + axes.append((axis + input_rank).try_into().unwrap()); + } + }, + Option::None => { break (); }, + }; + }; + axes + }, + Option::None => { + let mut axes: Array = ArrayTrait::new(); + let mut i: usize = 0; + + while i < input_rank{ + axes.append(i); + i += 1; + }; + axes + } + }; + + let mut pad_slices: Array> = ArrayTrait::new(); + let mut crop_slices: Array> = ArrayTrait::new(); + let mut self_shape_copy = (*self.shape).clone(); + loop { + match self_shape_copy.pop_front() { + Option::Some(dim) => { + let mut temp: Array = ArrayTrait::new(); + let mut i: usize = 0; + + while i < *dim{ + temp.append(i); + i += 1; + }; + pad_slices.append(temp.clone()); + crop_slices.append(temp.clone()); + }, + Option::None(_) => { break (); } + }; + }; + + let mut new_shape: Array = ArrayTrait::new(); + let mut self_shape_copy = (*self.shape).clone(); + loop { + match self_shape_copy.pop_front() { + Option::Some(dim) => { + new_shape.append(*dim); + }, + Option::None(_) => { break (); } + }; + }; + + let mut i: usize = 0; + loop { + + let mut a: usize = match axes.pop_front() { + Option::Some(axes) => axes.try_into().unwrap(), + Option::None(_) => { break (); } + }; + + let mut sh: usize = match shape.data.get(i) { + Option::Some(sh) => { + let res: usize = (*sh.unbox()).try_into().unwrap(); + res + }, + Option::None(_) => { break (); } + }; + + let mut dim: usize = (*(*self.shape).at(a)); + if sh == a { + continue; + } else if sh < dim { + usize_cover(ref new_shape, a, sh); + let mut d = dim - sh; + let mut sl:Array = ArrayTrait::new(); + if d % 2 == 0 { + d /= 2; + sl = slice(d, dim - d); + } else { + d /= 2; + sl = slice(d, dim - d - 1); + } + array_cover(ref crop_slices, a, sl); + } else { + // sh > dim + usize_cover(ref new_shape, a, sh); + let mut d = sh - dim; + let mut sl:Array = ArrayTrait::new(); + if d % 2 == 0 { + d /= 2; + sl = slice(d, sh - d); + } else { + d /= 2; + sl = slice(d, sh - d - 1); + } + array_cover(ref pad_slices, a, sl); + }; + i += 1; + }; + + let mut cropped = tensor_crop(self, crop_slices); + let result = tensor_pad(cropped, pad_slices, new_shape, zero); + result +} + +fn tensor_pad< + T, + +Copy, + +Drop, + +TensorTrait, +>(input_data: Tensor, mut pad_slices: Array>, shape: Array, zero: T) -> Tensor { + let mut count: usize = 1; + let mut res: Span = input_data.data; + let mut shape_copy = shape.clone(); + let mut i: usize = input_data.shape.len().into() - 1; + loop { + let mut shape_i = shape_copy.at(i); + let mut input_data_shape_i = input_data.shape.at(i); + let mut slice = pad_slices.at(i); + let mut slice_len = slice.len(); + if slice_len > *shape_i { + slice_len = *shape_i; + } + if i == 0 { + if shape_i != input_data_shape_i { + let mut temp = res; + res = ArrayTrait::::new().span(); + res = make_zero_array(*slice.at(0) * count, zero).concat( + temp + ).concat( + make_zero_array((*shape_i - *slice.at(slice_len - 1) - 1) * count, zero) + ); + } + break (); + } + if shape_i != input_data_shape_i { + let mut arr_list: Array> = make_array_from_dim(res, count * *input_data_shape_i); + res = ArrayTrait::::new().span(); + loop { + match arr_list.pop_front() { + Option::Some(mut arr) => { + res = res.concat(make_zero_array(*slice.at(0) * count, zero)); + res = res.concat(arr.span()); + res = res.concat(make_zero_array((*shape_i - *slice.at(slice_len - 1) - 1) * count, zero)); + }, + Option::None(_) => { break (); } + }; + }; + } + count *= *shape_i; + i -= 1; + }; + TensorTrait::::new(shape.span(), res) +} + +fn tensor_crop< + T, + +Copy, + +Drop, + +TensorTrait, +>(input_data: @Tensor, mut crop_slices: Array>) -> Tensor { + let mut input_data_shape_copy: Span = *input_data.shape; + let mut count = 1; + let mut shape: Array = ArrayTrait::new(); + let mut i: usize = 0; + + while i < input_data_shape_copy.len(){ + shape.append(*input_data_shape_copy.at(i)); + i += 1; + }; + + let mut res: Span = *input_data.data; + let mut i: usize = input_data_shape_copy.len() - 1; + loop { + let mut dim = (*input_data_shape_copy.at(i)); + let mut slice = crop_slices.at(i); + let slice_len: usize = slice.len(); + if i == 0 { + if dim != slice_len { + usize_cover(ref shape, i, slice_len); + let mut arr_list: Array> = make_array_from_dim(res, count); + res = ArrayTrait::::new().span(); + let mut j: usize = 0; + + while j < slice_len{ + res = res.concat(arr_list.at(*slice.at(j)).span()); + j += 1; + }; + } + break (); + } + + if dim != slice_len { + usize_cover(ref shape, i, slice_len); + let mut arr_list: Array> = make_array_from_dim(res, count * dim); + res = ArrayTrait::::new().span(); + loop { + match arr_list.pop_front() { + Option::Some(mut arr) => { + let mut arr = make_array_from_dim(arr.span(), count); + let mut j: usize = 0; + + while j < slice_len{ + res = res.concat(arr.at(*slice.at(j)).span()); + j += 1; + }; + }, + Option::None(_) => { break(); } + }; + }; + } + count *= slice_len; + i -= 1; + }; + TensorTrait::new(shape.span(), res) +} + +fn make_zero_array< + T, + +Drop, + +Copy +>(size: usize, zero: T) -> Span { + let mut res: Array = ArrayTrait::new(); + let mut i: usize = 0; + + while i < size{ + res.append(zero.clone()); + i += 1; + }; + res.span() +} + +fn slice(start: usize, end: usize) -> Array { + let mut index: Array = ArrayTrait::new(); + let mut i: usize = start; + + while i < end{ + index.append(i); + i += 1; + }; + index +} + +fn array_cover(ref arr: Array>, index: usize, data: Array) { + + if arr.is_empty() { + arr.append(data); + return (); + } + + let mut arr_len: usize = arr.len(); + let mut i: usize = 0; + + while i < arr_len{ + let temp = arr.pop_front().unwrap(); + if i == index { + arr.append(data.clone()); + } else { + arr.append(temp); + } + i += 1; + }; +} + +fn usize_cover(ref arr: Array, index: usize, data: usize) { + + if arr.is_empty() { + arr.append(data); + return (); + } + + let mut arr_len: usize = arr.len(); + let mut i: usize = 0; + + while i < arr_len{ + let temp = arr.pop_front().unwrap(); + if i == index { + arr.append(data.clone()); + } else { + arr.append(temp); + } + i += 1; + }; +} + +fn make_array_from_dim, +Copy>(input_data: Span, dim: usize) -> Array> { + let row: usize = input_data.len() / dim; + let data_copy: Span = input_data.clone(); + + let mut res = ArrayTrait::>::new(); + let mut i: usize = 0; + + while i < row{ + let mut temp: Array = ArrayTrait::new(); + let mut j: usize = 0; + loop { + if j > dim - 1 { + break (); + } + temp.append((*data_copy.at(i * dim + j))); + j += 1; + }; + res.append(temp); + i += 1; + }; + res +} \ No newline at end of file diff --git a/src/operators/tensor/manipulation/split_to_sequence.cairo b/src/operators/tensor/manipulation/split_to_sequence.cairo index 46dbe1af7..2e8e4704c 100644 --- a/src/operators/tensor/manipulation/split_to_sequence.cairo +++ b/src/operators/tensor/manipulation/split_to_sequence.cairo @@ -1,3 +1,4 @@ +use core::option::OptionTrait; use orion::operators::tensor::{Tensor, TensorTrait, U32Tensor}; use orion::operators::matrix::{MutMatrixTrait, MutMatrix, MutMatrixImpl}; @@ -45,22 +46,24 @@ fn split_to_sequence, +Drop, +TensorTrait,>( if (keepdims == 0 && !has_split) { let mut splited_t_temp: Array> = array![]; let mut i = 0; - while i != splited_t.len() { - let mut shape: Array = array![]; - let mut j = 0; - let shape_in_splited: Span = *splited_t.at(i).shape; - while j != shape_in_splited.len() { - if (j != axis) { - shape.append(*shape_in_splited.at(j)) - } - - j += 1; + while i != splited_t + .len() { + let mut shape: Array = array![]; + let mut j = 0; + let shape_in_splited: Span = *splited_t.at(i).shape; + while j != shape_in_splited + .len() { + if (j != axis) { + shape.append((*shape_in_splited.at(j)).try_into().unwrap()) + } + + j += 1; + }; + + splited_t_temp.append(splited_t[i].reshape(shape.span(), false)); + i += 1; }; - splited_t_temp.append(splited_t[i].reshape(shape.span())); - i += 1; - }; - return splited_t_temp; } splited_t @@ -105,42 +108,45 @@ fn split_num_outputs, +Drop, +TensorTrait,>( let mut sli: MutMatrix = MutMatrixImpl::new((*t).shape.len(), 2); let mut pos: usize = 0; let mut i = 0; - while i != (*t).shape.len() { - let s: usize = *(*t).shape.at(i); - sli.set(i, 0, 0); - sli.set(i, 1, s); - i += 1; - }; + while i != (*t) + .shape + .len() { + let s: usize = *(*t).shape.at(i); + sli.set(i, 0, 0); + sli.set(i, 1, s); + i += 1; + }; let mut i: usize = 0; - while i != split.len() { - let spl = *split.at(i); - sli.set(axis, 0, pos); - pos += spl; - sli.set(axis, 1, pos); - - let end_ele_0 = match sli.get(axis, 0) { - Option::Some(res) => res, - Option::None => { - assert(false, 'Get end_ele_0 is failed'); - 0 - }, - }; - let end_ele_1 = match sli.get(axis, 1) { - Option::Some(res) => res, - Option::None => { - assert(false, 'Get end_ele_0 is failed'); - 0 - }, + while i != split + .len() { + let spl = *split.at(i); + sli.set(axis, 0, pos); + pos += spl; + sli.set(axis, 1, pos); + + let end_ele_0 = match sli.get(axis, 0) { + Option::Some(res) => res, + Option::None => { + assert(false, 'Get end_ele_0 is failed'); + 0 + }, + }; + let end_ele_1 = match sli.get(axis, 1) { + Option::Some(res) => res, + Option::None => { + assert(false, 'Get end_ele_0 is failed'); + 0 + }, + }; + let starts: Span = array![sli.get(0, 0).unwrap(), end_ele_0].span(); + let ends: Span = array![sli.get(0, 1).unwrap(), end_ele_1].span(); + let axes: Option> = Option::None(()); + let steps: Option> = Option::None(()); + let sub_t: Tensor = t.slice(starts, ends, axes, steps); + splited_t.append(sub_t); + i += 1; }; - let starts: Span = array![sli.get(0, 0).unwrap(), end_ele_0].span(); - let ends: Span = array![sli.get(0, 1).unwrap(), end_ele_1].span(); - let axes: Option> = Option::None(()); - let steps: Option> = Option::None(()); - let sub_t: Tensor = t.slice(starts, ends, axes, steps); - splited_t.append(sub_t); - i += 1; - }; splited_t } @@ -154,42 +160,46 @@ fn split_has_split, +Drop, +TensorTrait,>( let mut sli: MutMatrix = MutMatrixImpl::new((*t).shape.len(), 2); let mut pos: usize = 0; let mut i = 0; - while i != (*t).shape.len() { - let s: usize = *(*t).shape.at(i); - sli.set(i, 0, 0); - sli.set(i, 1, s); - i += 1; - }; + while i != (*t) + .shape + .len() { + let s: usize = *(*t).shape.at(i); + sli.set(i, 0, 0); + sli.set(i, 1, s); + i += 1; + }; let mut i: usize = 0; - while i != split.data.len() { - let spl: usize = split.at(indices: array![i].span()); - sli.set(axis, 0, pos); - pos += spl; - sli.set(axis, 1, pos); - - let end_ele_0 = match sli.get(axis, 0) { - Option::Some(res) => { res }, - Option::None => { - assert(false, 'Get end_ele_0 is failed'); - 0 - }, - }; - let end_ele_1 = match sli.get(axis, 1) { - Option::Some(res) => { res }, - Option::None => { - assert(false, 'Get end_ele_0 is failed'); - 0 - }, + while i != split + .data + .len() { + let spl: usize = split.at(indices: array![i].span()); + sli.set(axis, 0, pos); + pos += spl; + sli.set(axis, 1, pos); + + let end_ele_0 = match sli.get(axis, 0) { + Option::Some(res) => { res }, + Option::None => { + assert(false, 'Get end_ele_0 is failed'); + 0 + }, + }; + let end_ele_1 = match sli.get(axis, 1) { + Option::Some(res) => { res }, + Option::None => { + assert(false, 'Get end_ele_0 is failed'); + 0 + }, + }; + let starts: Span = array![sli.get(0, 0).unwrap(), end_ele_0].span(); + let ends: Span = array![sli.get(0, 1).unwrap(), end_ele_1].span(); + let axes: Option> = Option::None(()); + let steps: Option> = Option::None(()); + let sub_t: Tensor = t.slice(starts, ends, axes, steps); + splited_t.append(sub_t); + i += 1; }; - let starts: Span = array![sli.get(0, 0).unwrap(), end_ele_0].span(); - let ends: Span = array![sli.get(0, 1).unwrap(), end_ele_1].span(); - let axes: Option> = Option::None(()); - let steps: Option> = Option::None(()); - let sub_t: Tensor = t.slice(starts, ends, axes, steps); - splited_t.append(sub_t); - i += 1; - }; splited_t -} +} \ No newline at end of file diff --git a/src/operators/tensor/math/argmax.cairo b/src/operators/tensor/math/argmax.cairo index f16c99b5c..1a48d3d8b 100644 --- a/src/operators/tensor/math/argmax.cairo +++ b/src/operators/tensor/math/argmax.cairo @@ -1,4 +1,6 @@ -use orion::operators::tensor::core::{Tensor, TensorTrait, ravel_index, unravel_index}; +use core::option::OptionTrait; +use core::traits::TryInto; +use orion::operators::tensor::{core::{Tensor, TensorTrait, ravel_index, unravel_index}, I32Tensor}; use orion::operators::tensor::helpers::{reduce_output_shape, len_from_shape, combine_indices}; use orion::numbers::NumberTrait; @@ -6,23 +8,22 @@ use orion::numbers::NumberTrait; fn argmax< T, MAG, - impl UsizeTensor: TensorTrait, impl TNumber: NumberTrait, impl TPartialOrd: PartialOrd, impl TPartialEq: PartialEq, impl TCopy: Copy, impl TDrop: Drop, >( - self: @Tensor, axis: usize, keepdims: Option, select_last_index: Option -) -> Tensor { - let keepdims = match keepdims { - Option::Some(val) => val, - Option::None => true, - }; - - let select_last_index = match select_last_index { - Option::Some(val) => val, - Option::None => false, + self: @Tensor, axis: i32, keepdims: Option, select_last_index: Option +) -> Tensor { + let keepdims = keepdims.unwrap_or(true); + let select_last_index = select_last_index.unwrap_or(false); + + // Convert negative axis to positive + let axis = if axis < 0 { + ((*self.shape).len().try_into().unwrap() + axis).try_into().unwrap() + } else { + axis.try_into().unwrap() }; assert(axis <= (*self.shape).len(), 'axis out of dimensions'); @@ -31,7 +32,7 @@ fn argmax< return find_argmax_1D::(*self, axis, true, select_last_index); } - let mut output_data: Array = array![]; + let mut output_data: Array = array![]; let output_shape = reduce_output_shape(*self.shape, axis, false); let output_data_len = len_from_shape(output_shape); @@ -48,7 +49,7 @@ fn argmax< index += 1; }; - TensorTrait::::new(reduce_output_shape(*self.shape, axis, keepdims), output_data.span()) + TensorTrait::::new(reduce_output_shape(*self.shape, axis, keepdims), output_data.span()) } /// Helper function that finds the index of the maximum value in a flat tensor. @@ -66,21 +67,20 @@ fn argmax< /// * A usize value representing the index of the maximum value along the specified axis. fn find_argmax_1D< T, - impl UsizeTensor: TensorTrait, impl TPartialOrd: PartialOrd, impl TPartialEq: PartialEq, impl TCopy: Copy, impl TDrop: Drop, >( mut input: Tensor, axis: usize, keepdims: bool, select_last_index: bool -) -> Tensor { - let mut output_data = ArrayTrait::::new(); +) -> Tensor { + let mut output_data = ArrayTrait::::new(); let mut max = match input.data.pop_front() { Option::Some(item) => *item, Option::None => { return TensorTrait::< - usize + i32 >::new(reduce_output_shape(input.shape, axis, keepdims), output_data.span()); } }; @@ -108,7 +108,7 @@ fn find_argmax_1D< output_data.append(max_index); return TensorTrait::< - usize + i32 >::new(reduce_output_shape(input.shape, axis, keepdims), output_data.span()); } @@ -143,9 +143,9 @@ fn find_argmax< max_value: T, argmax: usize, select_last_index: bool -) -> usize { +) -> i32 { if axis_index == *(*input.shape)[axis] { - return argmax; + return argmax.try_into().unwrap(); } let input_indices = combine_indices(output_indices, axis_index, axis); diff --git a/src/operators/tensor/math/flatten.cairo b/src/operators/tensor/math/flatten.cairo index a23671b77..dcc7eb78c 100644 --- a/src/operators/tensor/math/flatten.cairo +++ b/src/operators/tensor/math/flatten.cairo @@ -23,5 +23,12 @@ fn flatten>(self: @Tensor, axis: usize) let new_shape_second_axis = (*self.data).len() / new_shape_first_axis; - self.reshape(array![new_shape_first_axis, new_shape_second_axis].span()) + self + .reshape( + array![ + new_shape_first_axis.try_into().unwrap(), new_shape_second_axis.try_into().unwrap() + ] + .span(), + false + ) } diff --git a/src/operators/tensor/math/gather.cairo b/src/operators/tensor/math/gather.cairo index a60e927ab..c14978969 100644 --- a/src/operators/tensor/math/gather.cairo +++ b/src/operators/tensor/math/gather.cairo @@ -1,3 +1,5 @@ +use core::option::OptionTrait; +use core::traits::TryInto; use alexandria_data_structures::array_ext::SpanTraitExt; use orion::numbers::NumberTrait; @@ -5,17 +7,41 @@ use orion::operators::tensor::{TensorTrait, Tensor}; /// Cf: TensorTrait::gather docstring fn gather, impl TCopy: Copy, impl TDrop: Drop,>( - self: @Tensor, indices: Tensor, axis: Option + self: @Tensor, indices: Tensor, axis: Option ) -> Tensor { - let axis = match axis { - Option::Some(val) => val, + let axis: usize = match axis { + Option::Some(val) => { + if val < 0 { + (((*self.shape).len()).try_into().unwrap() + val).try_into().unwrap() + } else { + val.try_into().unwrap() + } + }, Option::None => 0 }; assert(axis < (*self.shape).len(), 'axis out of dimensions'); let axis_shape = *(*self.shape).at(axis); - let ind_max = indices.data.max().unwrap(); - assert(ind_max < axis_shape, 'this index out of bounds'); + + // Adjust indices that are negative + let mut adjusted_indices = array![]; + let mut indices_data = indices.data.clone(); + loop { + match indices_data.pop_front() { + Option::Some(index) => { + let adjusted_index: usize = if *index < 0 { + let val: u32 = (axis_shape.try_into().unwrap() + *index).try_into().unwrap(); + val + } else { + let val: u32 = (*index).try_into().unwrap(); + val + }; + assert(adjusted_index >= 0 && adjusted_index < axis_shape, 'Index out of bounds'); + adjusted_indices.append(adjusted_index); + }, + Option::None => { break; } + }; + }; let mut output_data = array![]; let mut output_size = array![]; @@ -80,14 +106,14 @@ fn gather, impl TCopy: Copy, impl TDrop: let mut outer_loop: usize = 0; let axis_index = *self.shape[axis]; while outer_loop != outer_loop_break { - let mut data_indices = indices.data; + let mut adjusted_indices_iter = adjusted_indices.clone(); loop { - match data_indices.pop_front() { + match adjusted_indices_iter.pop_front() { Option::Some(indice) => { let mut inner_loop = 0; while inner_loop != break_loop { let new_val = inner_loop / divisor % axis_index; - if *indice == new_val { + if indice == new_val { output_data.append(*self.data[break_loop * outer_loop + inner_loop]); } diff --git a/src/operators/tensor/math/gather_elements.cairo b/src/operators/tensor/math/gather_elements.cairo index c3793a316..e4b624e42 100644 --- a/src/operators/tensor/math/gather_elements.cairo +++ b/src/operators/tensor/math/gather_elements.cairo @@ -1,115 +1,65 @@ +use core::option::OptionTrait; +use core::traits::TryInto; use alexandria_data_structures::array_ext::SpanTraitExt; use orion::numbers::NumberTrait; -use orion::operators::tensor::U32TensorPartialEq; -use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor}; +use orion::operators::tensor::{{TensorTrait, Tensor}, core::{unravel_index, stride}}; -/// Cf: TensorTrait::gather docstring +/// Cf: TensorTrait::gather_elements docstring fn gather_elements, impl TCopy: Copy, impl TDrop: Drop,>( - self: @Tensor, indices: Tensor, axis: Option + self: @Tensor, indices: Tensor, axis: Option ) -> Tensor { - let axis = match axis { - Option::Some(val) => val, + let axis: usize = match axis { + Option::Some(val) => { + if val < 0 { + (((*self.shape).len()).try_into().unwrap() + val).try_into().unwrap() + } else { + val.try_into().unwrap() + } + }, Option::None => 0 }; assert(axis < (*self.shape).len(), 'axis out of dimensions'); - let data_rank = (*self.shape).len(); - let indices_rank = (indices.shape).len(); - assert((data_rank == indices_rank) & (indices_rank >= 1), 'must be same rank'); - - let axis_shape = *(*self.shape).at(axis); - let ind_max = indices.data.max().unwrap(); - assert(ind_max < axis_shape, 'this index out of bounds'); - - let mut indices_shape = indices.shape; - let mut data_shape = *self.shape; - let mut data_shape_clone = data_shape.clone(); - - let mut ind = 0; - loop { - match data_shape.pop_front() { - Option::Some(val) => { - if (ind != axis) { - assert(*val == *indices_shape.at(ind), 'shape mismatch'); - } - ind += 1; - }, - Option::None => { break; } - }; - }; + let data_strides = stride(*self.shape); let mut output_data = array![]; - - let mut outer_loop = data_shape_clone.at(axis); - let mut inner_loop = 1; - let mut multiplier = 1; - let mut ind = 0; - loop { - match data_shape_clone.pop_front() { - Option::Some(val) => { - inner_loop *= *val; - if (ind >= axis) { - multiplier *= *val; - } - - ind += 1; - }, - Option::None => { break; } - }; - }; - - let looper = multiplier / *outer_loop; - - if inner_loop != 1 { - inner_loop /= *outer_loop; - } - - let mut multiplier_index = 1; - let mut outer_loop_index = indices_shape.at(axis); - let mut ind = 0; - loop { - match indices_shape.pop_front() { - Option::Some(val) => { - if (ind >= axis) { - multiplier_index *= *val; - } - - ind += 1; - }, - Option::None => { break; } - }; - }; - - let mut data_indices = indices.data; let mut i: usize = 0; - loop { - match data_indices.pop_front() { - Option::Some(val) => { - if (axis == 0) { - let value = *val * inner_loop.into() + (i % inner_loop); - output_data.append(*self.data[value]); - } - - if ((axis == indices_rank - 1) & (axis != 0)) { - let value = *val + *outer_loop * (i / *outer_loop_index); - output_data.append(*self.data[value]); - } - - if ((axis != indices_rank - 1) & (axis != 0)) { - let value = *val * (looper) - + (i % looper) - + (multiplier * (i / multiplier_index)); - output_data.append(*self.data[value]); - } - - i += 1; - }, - Option::None => { break; } + while i < indices + .data + .len() { + let indice = *indices.data.at(i); + let adjusted_indice: u32 = if indice < 0 { + ((*(*self.shape).at(axis)).try_into().unwrap() + indice).try_into().unwrap() + } else { + indice.try_into().unwrap() + }; + + assert(adjusted_indice < (*(*self.shape).at(axis)), 'Index out of bounds'); + + let multidim_index = unravel_index(i, indices.shape); + let mut flat_index_for_data = 0; + + let mut j: usize = 0; + while j < multidim_index + .len() { + let dim_index = *multidim_index.at(j); + if j == axis { + flat_index_for_data += adjusted_indice * (*data_strides.at(j)); + } else { + flat_index_for_data += (dim_index * *data_strides.at(j)) + } + j += 1; + }; + + assert( + flat_index_for_data < (*self.data).len().try_into().unwrap(), + 'Flat index out of bounds' + ); + + output_data.append(*(*self.data).at(flat_index_for_data)); + i += 1; }; - }; - - let mut output_tensor = TensorTrait::::new(indices.shape, output_data.span()); - output_tensor + TensorTrait::::new(indices.shape, output_data.span()) } diff --git a/src/operators/tensor/math/layer_normalization.cairo b/src/operators/tensor/math/layer_normalization.cairo index e61e826f5..b6aa33ec0 100644 --- a/src/operators/tensor/math/layer_normalization.cairo +++ b/src/operators/tensor/math/layer_normalization.cairo @@ -1,3 +1,5 @@ +use core::option::OptionTrait; +use core::traits::TryInto; use orion::numbers::{NumberTrait, I32IntoU32}; use orion::numbers::{FP16x16, FP16x16Impl, FP32x32, FP32x32Impl, FixedTrait}; use orion::operators::tensor::{ @@ -72,8 +74,8 @@ fn layer_normalization< }; let mut shape_matrix = array![]; - shape_matrix.append(row_number); - shape_matrix.append(col_number); + shape_matrix.append(row_number.try_into().unwrap()); + shape_matrix.append(col_number.try_into().unwrap()); // Shape [1, 1] to mutiply one element tensors with 2D matrices let mut shape_one = array![]; @@ -89,14 +91,15 @@ fn layer_normalization< let mut one_tensor = array![]; one_tensor.append(NumberTrait::one()); - let x_mat = self.reshape(shape_matrix.span()); - let x_mean = x_mat.reduce_sum(1, true) + let x_mat = self.reshape(shape_matrix.span(), false); + let x_mean = x_mat + .reduce_sum(Option::Some(array![1].span()), Option::Some(true), Option::Some(false)) / TensorTrait::new(shape_one.span(), col_number_tensor.span()); let x_diff = x_mat - x_mean; let x_squared_diff = x_diff * x_diff; - let variance = x_squared_diff.reduce_sum(1, true) + let variance = x_squared_diff.reduce_sum(Option::Some(array![1].span()), Option::Some(true), Option::Some(false)) / TensorTrait::new(shape_one.span(), col_number_tensor.span()); let variance_eps = variance + TensorTrait::new(shape_one.span(), epsilon_tensor.span()); @@ -126,7 +129,15 @@ fn layer_normalization< *scale }; - let Y = y_mat.reshape((*self).shape) * scale; + let mut i = 0; + let mut target_shape: Array = array![]; + while i < (*self) + .shape + .len() { + target_shape.append((*(*self).shape.at(i)).try_into().unwrap()); + i += 1; + }; + let Y = y_mat.reshape(target_shape.span(), false) * scale; let Y = match B { Option::Some(B) => { diff --git a/src/operators/tensor/math/less.cairo b/src/operators/tensor/math/less.cairo index 35f9b4d73..d23fb4301 100644 --- a/src/operators/tensor/math/less.cairo +++ b/src/operators/tensor/math/less.cairo @@ -1,20 +1,14 @@ -use orion::operators::tensor::core::{Tensor, TensorTrait, unravel_index}; +use orion::operators::tensor::{core::{Tensor, TensorTrait, unravel_index}, I32Tensor}; use orion::operators::tensor::helpers::{ broadcast_shape, broadcast_index_mapping, len_from_shape, check_compatibility }; /// Cf: TensorTrait::less docstring -fn less< - T, - impl UsizeFTensor: TensorTrait, - impl TPartialOrd: PartialOrd, - impl TCopy: Copy, - impl TDrop: Drop ->( +fn less, impl TCopy: Copy, impl TDrop: Drop>( y: @Tensor, z: @Tensor -) -> Tensor { +) -> Tensor { let broadcasted_shape = broadcast_shape(*y.shape, *z.shape); - let mut result: Array = array![]; + let mut result: Array = array![]; let num_elements = len_from_shape(broadcasted_shape); diff --git a/src/operators/tensor/math/less_equal.cairo b/src/operators/tensor/math/less_equal.cairo index 8c982a09c..dea786878 100644 --- a/src/operators/tensor/math/less_equal.cairo +++ b/src/operators/tensor/math/less_equal.cairo @@ -1,4 +1,4 @@ -use orion::operators::tensor::core::{Tensor, TensorTrait, unravel_index}; +use orion::operators::tensor::{core::{Tensor, TensorTrait, unravel_index}, I32Tensor}; use orion::operators::tensor::helpers::{ broadcast_shape, broadcast_index_mapping, len_from_shape, check_compatibility }; @@ -6,15 +6,14 @@ use orion::operators::tensor::helpers::{ /// Cf: TensorTrait::less_equal docstring fn less_equal< T, - impl UsizeFTensor: TensorTrait, impl TPartialOrd: PartialOrd, impl TCopy: Copy, impl TDrop: Drop >( y: @Tensor, z: @Tensor -) -> Tensor { +) -> Tensor { let broadcasted_shape = broadcast_shape(*y.shape, *z.shape); - let mut result: Array = array![]; + let mut result: Array = array![]; let num_elements = len_from_shape(broadcasted_shape); diff --git a/src/operators/tensor/math/reduce_l1.cairo b/src/operators/tensor/math/reduce_l1.cairo index ba2be9215..29b83b69d 100644 --- a/src/operators/tensor/math/reduce_l1.cairo +++ b/src/operators/tensor/math/reduce_l1.cairo @@ -16,5 +16,5 @@ fn reduce_l1< ) -> Tensor { let data_abs = self.abs(); - data_abs.reduce_sum(axis: axis, keepdims: keepdims) + data_abs.reduce_sum(Option::Some(array![axis.try_into().unwrap()].span()), Option::Some(keepdims), Option::Some(false)) } diff --git a/src/operators/tensor/math/reduce_l2.cairo b/src/operators/tensor/math/reduce_l2.cairo index 96f4b7245..82f2d6e92 100644 --- a/src/operators/tensor/math/reduce_l2.cairo +++ b/src/operators/tensor/math/reduce_l2.cairo @@ -46,7 +46,12 @@ fn reduce_l2< self: @Tensor, axis: usize, keepdims: bool ) -> Tensor { let tensor_square = square(self); - let tensor_square_sum = tensor_square.reduce_sum(axis: axis, keepdims: keepdims); + let tensor_square_sum = tensor_square + .reduce_sum( + Option::Some(array![axis.try_into().unwrap()].span()), + Option::Some(keepdims), + Option::Some(false) + ); tensor_square_sum.sqrt() } @@ -64,7 +69,12 @@ fn reduce_l2_complex< self: @Tensor, axis: usize, keepdims: bool ) -> Tensor { let mut tensor_square = square(@self.abs()); - let mut tensor_square_sum = tensor_square.reduce_sum(axis: axis, keepdims: keepdims); + let mut tensor_square_sum = tensor_square + .reduce_sum( + Option::Some(array![axis.try_into().unwrap()].span()), + Option::Some(keepdims), + Option::Some(false) + ); tensor_square_sum.sqrt() } diff --git a/src/operators/tensor/math/reduce_log_sum.cairo b/src/operators/tensor/math/reduce_log_sum.cairo index 60a5225cb..0cc60f9cb 100644 --- a/src/operators/tensor/math/reduce_log_sum.cairo +++ b/src/operators/tensor/math/reduce_log_sum.cairo @@ -15,7 +15,12 @@ fn reduce_log_sum< >( self: @Tensor, axis: usize, keepdims: bool ) -> Tensor { - let tensor_square_sum = self.reduce_sum(axis: axis, keepdims: keepdims); + let tensor_square_sum = self + .reduce_sum( + Option::Some(array![axis.try_into().unwrap()].span()), + Option::Some(keepdims), + Option::Some(false) + ); let tensor_square_sum_log = tensor_square_sum.log(); tensor_square_sum_log diff --git a/src/operators/tensor/math/reduce_sum.cairo b/src/operators/tensor/math/reduce_sum.cairo index 078345f4a..ace480561 100644 --- a/src/operators/tensor/math/reduce_sum.cairo +++ b/src/operators/tensor/math/reduce_sum.cairo @@ -1,6 +1,14 @@ +use core::option::OptionTrait; +use core::traits::TryInto; +use alexandria_sorting::bubble_sort; +use alexandria_data_structures::array_ext::{SpanTraitExt}; + +use orion::numbers::fixed_point::core::FixedTrait; use orion::numbers::NumberTrait; use orion::operators::tensor::core::{Tensor, TensorTrait, ravel_index, unravel_index}; -use orion::operators::tensor::helpers::{reduce_output_shape, len_from_shape, combine_indices}; +use orion::operators::tensor::helpers::{ + reduce_output_shape, len_from_shape, combine_indices, get_all_axes +}; /// Cf: TensorTrait::reduce_sum docstring fn reduce_sum< @@ -8,48 +16,108 @@ fn reduce_sum< MAG, impl TTensor: TensorTrait, impl TNumber: NumberTrait, - impl TAddEq: AddEq, impl TCopy: Copy, impl TDrop: Drop >( - self: @Tensor, axis: usize, keepdims: bool + self: @Tensor, + axes: Option>, + keepdims: Option, + noop_with_empty_axes: Option ) -> Tensor { - let mut output_data: Array = array![]; - - if (*self.shape).len() == 1 { - assert(axis == 0, 'axis out of dimensions'); - let current_sum = accumulate_sum::(*self.data, *self.shape, *self.shape, axis); - output_data.append(current_sum); + let noop_with_empty_axes = match noop_with_empty_axes { + Option::Some(noop_with_empty_axes) => noop_with_empty_axes, + Option::None => false, + }; + let axes = match axes { + Option::Some(axes) => { + if (axes.len() == 0) { + get_all_axes(*self.shape) + } else { + assert(axes.len() == axes.unique().len(), 'duplicated axis.'); + let mut axes_arr: Array = array![]; + let mut copy_axes = axes.clone(); + loop { + match copy_axes.pop_front() { + Option::Some(axis) => { + // Adjust negative axes to positive + let adjusted_axis = if *axis < 0 { + ((*self.shape).len().try_into().unwrap() + *axis) + .try_into() + .unwrap() + } else { + (*axis).try_into().unwrap() + }; + axes_arr.append(adjusted_axis); + }, + Option::None => { break; } + }; + }; + let sorted_axes = bubble_sort::bubble_sort_elements(axes_arr, true).span(); + sorted_axes + } + }, + Option::None => { + if noop_with_empty_axes { + return *self; + } + get_all_axes(*self.shape) + }, + }; + let keepdims = match keepdims { + Option::Some(keepdims) => keepdims, + Option::None => true, + }; - let mut output_shape: Array = array![]; - output_shape.append(1); + let mut axis_c = 0; + let mut copy_axes = axes.clone(); + let mut shape = *self.shape; + let mut data = *self.data; + loop { + match copy_axes.pop_front() { + Option::Some(axis) => { + if (shape.len() == 1) { + let current_sum = accumulate_sum::(data, shape, shape, 0); + shape = array![].span(); + data = array![current_sum].span(); + break (); + } + let mut temp_data = array![]; + let mut temp_shape = reduce_output_shape(shape, *axis - axis_c, false); + let data_len = len_from_shape(temp_shape); + let mut index: usize = 0; + while index != data_len { + let indices = unravel_index(index, temp_shape); + let current_sum = accumulate_sum::(data, shape, indices, *axis - axis_c); - return TensorTrait::new(output_shape.span(), output_data.span()); - } else { - assert(axis <= (*self.shape).len(), 'axis out of dimensions'); - let output_shape = reduce_output_shape(*self.shape, axis, false); - let output_data_len = len_from_shape(output_shape); - let mut index: usize = 0; - while index != output_data_len { - let output_indices = unravel_index(index, output_shape); - let current_sum = accumulate_sum::(*self.data, *self.shape, output_indices, axis); + temp_data.append(current_sum); - output_data.append(current_sum); + index += 1; + }; - index += 1; + shape = temp_shape; + data = temp_data.span(); + axis_c += 1; + }, + Option::None => { break; } }; + }; - if keepdims { - let output_shape = reduce_output_shape(*self.shape, axis, true); + let mut axes_copy = axes.clone(); + if keepdims { + shape = *self.shape; + loop { + match axes_copy.pop_front() { + Option::Some(axis) => { shape = reduce_output_shape(shape, *axis, true); }, + Option::None => { break; } + }; + }; - TensorTrait::::new(output_shape, output_data.span()) - } else { - TensorTrait::::new(output_shape, output_data.span()) - } + TensorTrait::::new(shape, data) + } else { + TensorTrait::::new(shape, data) } } - /// Helper function that accumulates the sum of elements along a specific axis. /// /// # Arguments @@ -62,42 +130,34 @@ fn reduce_sum< /// * Panics if gas limit is exceeded during execution. /// /// # Returns -/// * An i32 value representing the accumulated sum along the specified axis. +/// * A value representing the accumulated sum along the specified axis. fn accumulate_sum< - T, - MAG, - impl TNumber: NumberTrait, - impl TAddEq: AddEq, - impl TCopy: Copy, - impl TDrop: Drop + T, MAG, impl TNumber: NumberTrait, impl TCopy: Copy, impl TDrop: Drop >( mut input_data: Span, input_shape: Span, output_indices: Span, axis: usize ) -> T { let axis_len = *(input_shape)[axis]; - let mut acc: T = NumberTrait::zero(); + let mut sum: T = NumberTrait::zero(); - let mut axis_index: usize = 0; + let mut axis_index = 0; if (input_shape).len() > 1 { - loop { - if axis_index == axis_len { - break (); - } - + while axis_index != axis_len { let input_indices = combine_indices(output_indices, axis_index, axis); let input_index = ravel_index(input_shape, input_indices); let ele = *(input_data)[input_index]; - acc += ele; + sum = NumberTrait::add(sum, ele); + axis_index += 1; }; } else { loop { match input_data.pop_front() { - Option::Some(item) => { acc += *item; }, + Option::Some(item) => sum = NumberTrait::add(sum, *item), Option::None => { break; } }; }; } - return acc; + sum } diff --git a/src/operators/tensor/math/reduce_sum_square.cairo b/src/operators/tensor/math/reduce_sum_square.cairo index b8ad7df99..fc7789150 100644 --- a/src/operators/tensor/math/reduce_sum_square.cairo +++ b/src/operators/tensor/math/reduce_sum_square.cairo @@ -45,7 +45,12 @@ fn reduce_sum_square< self: @Tensor, axis: usize, keepdims: bool ) -> Tensor { let tensor_square = square(self); - let tensor_square_sum = tensor_square.reduce_sum(axis: axis, keepdims: keepdims); + let tensor_square_sum = tensor_square + .reduce_sum( + Option::Some(array![axis.try_into().unwrap()].span()), + Option::Some(keepdims), + Option::Some(false) + ); tensor_square_sum } diff --git a/src/operators/tensor/math/resize.cairo b/src/operators/tensor/math/resize.cairo index ab0ef86f7..18917454e 100644 --- a/src/operators/tensor/math/resize.cairo +++ b/src/operators/tensor/math/resize.cairo @@ -5,6 +5,7 @@ use orion::operators::tensor::{ TensorTrait, Tensor, I8Tensor, I32Tensor, U32Tensor, FP16x16Tensor, BoolTensor }; use orion::numbers::{FP16x16, FP16x16Impl, FP32x32, FP32x32Impl, FixedTrait}; +use orion::operators::nn::helpers::{get_all_coord}; #[derive(Copy, Drop)] enum MODE { @@ -434,12 +435,14 @@ fn interpolate_nd< i += 1; }; - let mut ret = cartesian(ret.span()); + //let mut ret = cartesian(ret.span()); + let mut ret = get_all_coord(output_size); let mut ret_data = array![]; loop { match ret.pop_front() { Option::Some(X) => { + let X = *X; let mut x: Array = array![]; let mut i = 0; while i != X.len() { @@ -476,94 +479,6 @@ fn interpolate_nd< TensorTrait::new(output_size, ret_data.span()) } -fn cartesian(mut arrays: Span>,) -> Array> { - let mut n = 1; - let mut i = arrays.len() - 1; - loop { - n = n * (*(arrays.at(i))).len(); - if i == 0 { - break; - } - i -= 1; - }; - - let mut i = 0; - let mut size_arrays = array![]; - while i != arrays.len() { - size_arrays.append((*(arrays.at(i))).len()); - i += 1; - }; - - let size_arrays = size_arrays.span(); - let mut output_arrays = array![]; - let mut m = n; - - let mut i = 0; - while i != arrays.len() { - m = m / (*(arrays.at(i))).len(); - let mut out = repeat(*(arrays.at(i)), m); - out = repeat_2(out, size_arrays, i); - - output_arrays.append(out); - i += 1; - }; - - let output_arrays = output_arrays.span(); - - let mut i = 0; - let mut ret = array![]; - while i != n { - let mut j = 0; - let mut x = array![]; - while j != arrays.len() { - x.append(*(output_arrays.at(j)).at(i)); - j += 1; - }; - - ret.append(x); - i += 1; - }; - - ret -} - -fn repeat_2(mut array: Array, size_array: Span, index: usize) -> Array { - let mut size = array.len(); - let mut i = 0; - while i != index { - let mut j = 1; - while j != *size_array.at(index - 1 - i) { - let mut k = 0; - while k != size { - array.append(*array.at(k)); - k += 1; - }; - - j += 1; - }; - - size = size * *size_array.at(index - 1 - i); - i += 1; - }; - - array -} - -fn repeat(array: Span, m: usize,) -> Array { - let mut out = array![]; - let mut j = 0; - while j != array.len() { - let mut k = 0; - while k != m { - out.append(*array.at(j)); - k += 1; - }; - - j += 1; - }; - - out -} fn interpolate_nd_with_x< T, diff --git a/src/operators/tensor/quantization.cairo b/src/operators/tensor/quantization.cairo index 4f56fc5cd..29fc85a32 100644 --- a/src/operators/tensor/quantization.cairo +++ b/src/operators/tensor/quantization.cairo @@ -6,3 +6,4 @@ mod qlinear_concat; mod qlinear_add; mod qlinear_mul; mod qlinear_leakyrelu; +mod qlinear_conv; diff --git a/src/operators/tensor/quantization/qlinear_conv.cairo b/src/operators/tensor/quantization/qlinear_conv.cairo new file mode 100644 index 000000000..d4c276825 --- /dev/null +++ b/src/operators/tensor/quantization/qlinear_conv.cairo @@ -0,0 +1,139 @@ +use orion::numbers::NumberTrait; +use orion::operators::tensor::{TensorTrait, Tensor}; + +use orion::operators::tensor::quantization::dequantize_linear::dequantize_linear; +use orion::operators::tensor::quantization::quantize_linear::quantize_linear; +use orion::operators::nn::{NNTrait}; +use orion::operators::nn::AUTO_PAD; +//use orion::operators::nn::functional::conv::conv; + +/// # tensor.qlinear_conv +/// +/// ```rust +/// +/// qlinear_conv( +/// X: @Tensor, +/// X_scale: @Tensor, +/// X_zero_point: @Tensor, +/// W: @Tensor, +/// W_scale: @Tensor, +/// W_zero_point: @Tensor, +/// B: Option>, +/// auto_pad: Option, +/// dilations: Option>, +/// group: Option, +/// kernel_shape: Option>, +/// pads: Option>, +/// strides: Option>, +/// y_scale: @Tensor, +/// y_zero_point: @Tensor, +/// ) -> Tensor +/// ``` +/// +/// Performs convolution on quantized Tensors +/// +/// The convolution operator consumes a quantized input tensor, its scale and zero point, a quantized filter, its scale and zero point, +/// and output's scale and zero point, and computes the quantized output. Each scale and zero-point pair must have same shape. +/// It means they must be either scalars (per tensor) or 1-D tensors (per output channel). Each input or output and its related zero point must have same type. +/// +/// ## Args +/// +/// * `X`(`@Tensor`) - Quantized input data tensor, has size (N x C x H x W), where N is the batch size, C is the number of channels, and H and W are the height and width. Note that this is for the 2D image. Otherwise the size is (N x C x D1 x D2 ... x Dn). +/// * `X_scale`(`@Tensor`) - Scale for input `X`. +/// * `X_zero_point`(`@Tensor`) - Zero point for input `X`. +/// * `W`(`@Tensor`) - Quantized weight tensor that will be used in the convolutions; has size (M x C/group x kH x kW), where C is the number of channels, and kH and kW are the height and width of the kernel, and M is the number of feature maps. For more than 2 dimensions, the kernel shape will be (M x C/group x k1 x k2 x ... x kn), where (k1 x k2 x ... kn) is the dimension of the kernel. +/// * `W_scale`(`@Tensor`) - Scale for input `W`. +/// * `W_zero_point`(`@Tensor`) - Zero point for input `W`. +/// * `B`(`Option<@Tensor>`) - Optional 1D bias to be added to the convolution, has size of M. Bias must be quantized using scale = x_scale * w_scale and zero_point = 0. +/// * `auto_pad`(`Option`) - Default is NOTSET, auto_pad must be either NOTSET, SAME_UPPER, SAME_LOWER or VALID. NOTSET means explicit padding is used. SAME_UPPER or SAME_LOWER mean pad the input so that `output_shape[i] = ceil(input_shape[i] / strides[i])` for each axis `i`. +/// * `dilations`(`Option>`) - Dilation value along each spatial axis of the filter. If not present, the dilation defaults to 1 along each spatial axis. +/// * `group`(`Option`) - Default is 1, number of groups input channels and output channels are divided into. +/// * `kernel_shape`(`Option>`) - The shape of the convolution kernel. If not present, should be inferred from input W. +/// * `pads`(`Option>`) - Padding for the beginning and ending along each spatial axis, it can take any value greater than or equal to 0. The value represent the number of pixels added to the beginning and end part of the corresponding axis. `pads` format should be as follow [x1_begin, x2_begin...x1_end, x2_end,...], where xi_begin the number of pixels added at the beginning of axis `i` and xi_end, the number of pixels added at the end of axis `i`. This attribute cannot be used simultaneously with auto_pad attribute. If not present, the padding defaults to 0 along start and end of each spatial axis. +/// * `strides`(`Option>`) - Stride along each spatial axis. If not present, the stride defaults to 1 along each spatial axis. +/// * `y_scale`(`@Tensor`) - Scale for output. +/// * `y_zero_point`(`@Tensor`) - Zero point for output. +/// +/// ## Returns +/// +/// A new `Tensor`, containing the quantized result of the convolution of the dequantized inputs. +/// +/// ## Type Constraints +/// +/// u32 tensor, not supported. +/// fp8x23wide tensor, not supported. +/// fp16x16wide tensor, not supported. +/// +/// ## Example +/// +/// ```rust + +/// ``` +/// + +fn qlinear_conv< + T, + MAG, + Q, + impl TTensor: TensorTrait, + impl QTensor: TensorTrait, + impl QIntoT: Into, + impl QTensorIntoTTensor: Into, Tensor>, + impl TAdd: Add, + impl TSub: Sub, + impl TDiv: Div, + impl TMul: Mul, + impl TTensorMul: Mul>, + impl TTensorSub: Sub>, + impl TTensorDiv: Div>, + impl TPartialOrd: PartialOrd, + impl TNumber: NumberTrait, + impl TTryInto: TryInto, + impl TAddEq: AddEq, + impl TCopy: Copy, + impl TDrop: Drop, + impl QCopy: Copy, + impl QDrop: Drop, + +NNTrait, +>( + X: @Tensor, + X_scale: @Tensor, + X_zero_point: @Tensor, + W: @Tensor, + W_scale: @Tensor, + W_zero_point: @Tensor, + B: Option>, + auto_pad: Option, + dilations: Option>, + group: Option, + kernel_shape: Option>, + pads: Option>, + strides: Option>, + y_scale: @Tensor, + y_zero_point: @Tensor, + min: T, + max: T +) -> Tensor { + assert((*X).shape.len() >= 3, 'X must have at least 3 dim'); + let mut dequantized_X = dequantize_linear(@(*X), X_scale, X_zero_point); + let mut dequantized_W = dequantize_linear(@(*W), W_scale, W_zero_point); + let B = match B { + Option::Some(B) => { + Option::Some( + dequantize_linear( + @TensorTrait::new(array![B.len()].span(), B), + @(*X_scale * *W_scale), + @TensorTrait::new(array![1].span(), array![NumberTrait::::zero()].span()) + ) + .data + ) + }, + Option::None => { Option::None } + }; + + let mut y = NNTrait::conv( + @dequantized_X, @dequantized_W, B, auto_pad, dilations, group, kernel_shape, pads, strides + ); + + return (quantize_linear(@y, @(*y_scale), y_zero_point, min, max)); +} diff --git a/tests/ml.cairo b/tests/ml.cairo index 4e3e0781e..b92dbcd83 100644 --- a/tests/ml.cairo +++ b/tests/ml.cairo @@ -5,3 +5,4 @@ mod linear_classifier_test; mod svm_regressor_test; mod svm_classifier_test; mod normalizer_test; +mod tree_ensemble_test; diff --git a/tests/ml/tree_ensemble_test.cairo b/tests/ml/tree_ensemble_test.cairo new file mode 100644 index 000000000..59a5592f6 --- /dev/null +++ b/tests/ml/tree_ensemble_test.cairo @@ -0,0 +1,300 @@ +use orion::numbers::FP16x16; +use orion::operators::tensor::{Tensor, TensorTrait, FP16x16Tensor, U32Tensor}; +use orion::operators::ml::tree_ensemble::tree_ensemble::{ + TreeEnsembleTrait, POST_TRANSFORM, AGGREGATE_FUNCTION, NODE_MODE +}; +use orion::operators::matrix::{MutMatrix, MutMatrixImpl, MutMatrixTrait}; +use orion::numbers::NumberTrait; + + +#[test] +#[available_gas(200000000000)] +fn export_tree_ensemble_two_trees() { + let mut shape = ArrayTrait::::new(); + shape.append(3); + shape.append(3); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 32768, sign: true }); + data.append(FP16x16 { mag: 26214, sign: true }); + data.append(FP16x16 { mag: 19660, sign: true }); + data.append(FP16x16 { mag: 13107, sign: true }); + data.append(FP16x16 { mag: 6553, sign: true }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 6553, sign: false }); + data.append(FP16x16 { mag: 13107, sign: false }); + data.append(FP16x16 { mag: 19660, sign: false }); + let mut X = TensorTrait::new(shape.span(), data.span()); + + let mut shape = ArrayTrait::::new(); + shape.append(6); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 5041, sign: false }); + data.append(FP16x16 { mag: 32768, sign: false }); + data.append(FP16x16 { mag: 32768, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 18724, sign: false }); + data.append(FP16x16 { mag: 32768, sign: false }); + let leaf_weights = TensorTrait::new(shape.span(), data.span()); + + let mut shape = ArrayTrait::::new(); + shape.append(4); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 17462, sign: false }); + data.append(FP16x16 { mag: 40726, sign: false }); + data.append(FP16x16 { mag: 36652, sign: true }); + data.append(FP16x16 { mag: 47240, sign: true }); + let nodes_splits = TensorTrait::new(shape.span(), data.span()); + + let n_targets = 1; + let aggregate_function = AGGREGATE_FUNCTION::AVERAGE; + let nodes_missing_value_tracks_true = Option::None; + let nodes_hitrates = Option::None; + let post_transform = POST_TRANSFORM::NONE; + + let tree_roots: Span = array![0, 2].span(); + let nodes_modes: Span = array![ + NODE_MODE::LEQ, NODE_MODE::LEQ, NODE_MODE::LEQ, NODE_MODE::LEQ + ] + .span(); + + let nodes_featureids: Span = array![0, 2, 0, 0].span(); + let nodes_truenodeids: Span = array![1, 0, 3, 4].span(); + let nodes_trueleafs: Span = array![0, 1, 1, 1].span(); + let nodes_falsenodeids: Span = array![2, 1, 3, 5].span(); + let nodes_falseleafs: Span = array![1, 1, 0, 1].span(); + let leaf_targetids: Span = array![0, 0, 0, 0, 0, 0].span(); + + let mut scores = TreeEnsembleTrait::predict( + @X, + nodes_splits, + nodes_featureids, + nodes_modes, + nodes_truenodeids, + nodes_falsenodeids, + nodes_trueleafs, + nodes_falseleafs, + leaf_targetids, + leaf_weights, + tree_roots, + post_transform, + aggregate_function, + nodes_hitrates, + nodes_missing_value_tracks_true, + Option::None, + n_targets + ); + + // ASSERT SCOREs + assert(scores.at(0, 0) == FP16x16 { mag: 18904, sign: false }, 'scores.at(0, 0)'); + assert(scores.at(1, 0) == FP16x16 { mag: 18904, sign: false }, 'scores.at(1, 0)'); + assert(scores.at(2, 0) == FP16x16 { mag: 18904, sign: false }, 'scores.at(2, 0)'); +} + + +#[test] +#[available_gas(200000000000)] +fn export_tree_ensemble_one_tree() { + let mut shape = ArrayTrait::::new(); + shape.append(3); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 78643, sign: false }); + data.append(FP16x16 { mag: 222822, sign: false }); + data.append(FP16x16 { mag: 7864, sign: true }); + data.append(FP16x16 { mag: 108789, sign: false }); + data.append(FP16x16 { mag: 271319, sign: false }); + data.append(FP16x16 { mag: 115998, sign: false }); + let mut X = TensorTrait::new(shape.span(), data.span()); + + let mut shape = ArrayTrait::::new(); + shape.append(4); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 342753, sign: false }); + data.append(FP16x16 { mag: 794296, sign: false }); + data.append(FP16x16 { mag: 801505, sign: true }); + data.append(FP16x16 { mag: 472514, sign: false }); + let leaf_weights = TensorTrait::new(shape.span(), data.span()); + + let mut shape = ArrayTrait::::new(); + shape.append(3); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 205783, sign: false }); + data.append(FP16x16 { mag: 78643, sign: false }); + data.append(FP16x16 { mag: 275251, sign: false }); + let nodes_splits = TensorTrait::new(shape.span(), data.span()); + + let membership_values = Option::None; + + let n_targets = 2; + let aggregate_function = AGGREGATE_FUNCTION::SUM; + let nodes_missing_value_tracks_true = Option::None; + let nodes_hitrates = Option::None; + let post_transform = POST_TRANSFORM::NONE; + + let tree_roots: Span = array![0].span(); + let nodes_modes: Span = array![NODE_MODE::LEQ, NODE_MODE::LEQ, NODE_MODE::LEQ] + .span(); + + let nodes_featureids: Span = array![0, 0, 0].span(); + let nodes_truenodeids: Span = array![1, 0, 1].span(); + let nodes_trueleafs: Span = array![0, 1, 1].span(); + let nodes_falsenodeids: Span = array![2, 2, 3].span(); + let nodes_falseleafs: Span = array![0, 1, 1].span(); + let leaf_targetids: Span = array![0, 1, 0, 1].span(); + + let mut scores = TreeEnsembleTrait::predict( + @X, + nodes_splits, + nodes_featureids, + nodes_modes, + nodes_truenodeids, + nodes_falsenodeids, + nodes_trueleafs, + nodes_falseleafs, + leaf_targetids, + leaf_weights, + tree_roots, + post_transform, + aggregate_function, + nodes_hitrates, + nodes_missing_value_tracks_true, + membership_values, + n_targets + ); + + // ASSERT SCOREs + assert(scores.at(0, 0) == FP16x16 { mag: 342753, sign: false }, 'scores.at(0, 0)'); + assert(scores.at(0, 1) == FP16x16 { mag: 0, sign: false }, 'scores.at(0, 1)'); + + assert(scores.at(1, 0) == FP16x16 { mag: 342753, sign: false }, 'scores.at(1, 0)'); + assert(scores.at(1, 1) == FP16x16 { mag: 0, sign: false }, 'scores.at(1, 1)'); + + assert(scores.at(2, 0) == FP16x16 { mag: 0, sign: false }, 'scores.at(2, 0)'); + assert(scores.at(2, 1) == FP16x16 { mag: 794296, sign: false }, 'scores.at(2, 1)'); +} + + +#[test] +#[available_gas(200000000000)] +fn export_tree_ensemble_set_membership() { + let mut shape = ArrayTrait::::new(); + shape.append(6); + shape.append(1); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 78643, sign: false }); + data.append(FP16x16 { mag: 222822, sign: false }); + data.append(FP16x16 { mag: 7864, sign: true }); + data.append(NumberTrait::::NaN()); + data.append(FP16x16 { mag: 786432, sign: false }); + data.append(FP16x16 { mag: 458752, sign: false }); + let mut X = TensorTrait::new(shape.span(), data.span()); + + let mut shape = ArrayTrait::::new(); + shape.append(4); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 655360, sign: false }); + data.append(FP16x16 { mag: 65536000, sign: false }); + data.append(FP16x16 { mag: 6553600, sign: false }); + let leaf_weights = TensorTrait::new(shape.span(), data.span()); + + let mut shape = ArrayTrait::::new(); + shape.append(3); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 720896, sign: false }); + data.append(FP16x16 { mag: 1522663424, sign: false }); + data.append(NumberTrait::::NaN()); + let nodes_splits = TensorTrait::new(shape.span(), data.span()); + + let mut shape = ArrayTrait::::new(); + shape.append(8); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 78643, sign: false }); + data.append(FP16x16 { mag: 242483, sign: false }); + data.append(FP16x16 { mag: 524288, sign: false }); + data.append(FP16x16 { mag: 589824, sign: false }); + data.append(NumberTrait::::NaN()); + data.append(FP16x16 { mag: 786432, sign: false }); + data.append(FP16x16 { mag: 458752, sign: false }); + data.append(NumberTrait::::NaN()); + let membership_values = Option::Some(TensorTrait::new(shape.span(), data.span())); + + let n_targets = 4; + let aggregate_function = AGGREGATE_FUNCTION::SUM; + let nodes_missing_value_tracks_true = Option::None; + let nodes_hitrates = Option::None; + let post_transform = POST_TRANSFORM::NONE; + + let tree_roots: Span = array![0].span(); + let nodes_modes: Span = array![NODE_MODE::LEQ, NODE_MODE::MEMBER, NODE_MODE::MEMBER] + .span(); + + let nodes_featureids: Span = array![0, 0, 0].span(); + let nodes_truenodeids: Span = array![1, 0, 1].span(); + let nodes_trueleafs: Span = array![0, 1, 1].span(); + let nodes_falsenodeids: Span = array![2, 2, 3].span(); + let nodes_falseleafs: Span = array![1, 0, 1].span(); + let leaf_targetids: Span = array![0, 1, 2, 3].span(); + + let mut scores = TreeEnsembleTrait::predict( + @X, + nodes_splits, + nodes_featureids, + nodes_modes, + nodes_truenodeids, + nodes_falsenodeids, + nodes_trueleafs, + nodes_falseleafs, + leaf_targetids, + leaf_weights, + tree_roots, + post_transform, + aggregate_function, + nodes_hitrates, + nodes_missing_value_tracks_true, + membership_values, + n_targets + ); + + // ASSERT SCOREs + assert(scores.at(0, 0) == FP16x16 { mag: 65536, sign: false }, 'scores.at(0, 0)'); + assert(scores.at(0, 1) == FP16x16 { mag: 0, sign: false }, 'scores.at(0, 1)'); + assert(scores.at(0, 2) == FP16x16 { mag: 0, sign: false }, 'scores.at(0, 2)'); + assert(scores.at(0, 3) == FP16x16 { mag: 0, sign: false }, 'scores.at(0, 3)'); + + assert(scores.at(1, 0) == FP16x16 { mag: 0, sign: false }, 'scores.at(1, 0)'); + assert(scores.at(1, 1) == FP16x16 { mag: 0, sign: false }, 'scores.at(1, 1)'); + assert(scores.at(1, 2) == FP16x16 { mag: 0, sign: false }, 'scores.at(1, 2)'); + assert(scores.at(1, 3) == FP16x16 { mag: 6553600, sign: false }, 'scores.at(1, 3)'); + + assert(scores.at(2, 0) == FP16x16 { mag: 0, sign: false }, 'scores.at(2, 0)'); + assert(scores.at(2, 1) == FP16x16 { mag: 0, sign: false }, 'scores.at(2, 1)'); + assert(scores.at(2, 2) == FP16x16 { mag: 0, sign: false }, 'scores.at(2, 2)'); + assert(scores.at(2, 3) == FP16x16 { mag: 6553600, sign: false }, 'scores.at(2, 3)'); + + assert(scores.at(3, 0) == FP16x16 { mag: 0, sign: false }, 'scores.at(3, 0)'); + assert(scores.at(3, 1) == FP16x16 { mag: 0, sign: false }, 'scores.at(3, 1)'); + assert(scores.at(3, 2) == FP16x16 { mag: 65536000, sign: false }, 'scores.at(3, 2)'); + assert(scores.at(3, 3) == FP16x16 { mag: 0, sign: false }, 'scores.at(3, 3)'); + + assert(scores.at(4, 0) == FP16x16 { mag: 0, sign: false }, 'scores.at(4, 0)'); + assert(scores.at(4, 1) == FP16x16 { mag: 0, sign: false }, 'scores.at(4, 1)'); + assert(scores.at(4, 2) == FP16x16 { mag: 65536000, sign: false }, 'scores.at(4, 2)'); + assert(scores.at(4, 3) == FP16x16 { mag: 0, sign: false }, 'scores.at(4, 3)'); + + assert(scores.at(5, 0) == FP16x16 { mag: 0, sign: false }, 'scores.at(5, 0)'); + assert(scores.at(5, 1) == FP16x16 { mag: 655360, sign: false }, 'scores.at(5, 1)'); + assert(scores.at(5, 2) == FP16x16 { mag: 0, sign: false }, 'scores.at(5, 2)'); + assert(scores.at(5, 3) == FP16x16 { mag: 0, sign: false }, 'scores.at(5, 3)'); +} + diff --git a/tests/nodes.cairo b/tests/nodes.cairo index 84008cd64..64d07a9f1 100644 --- a/tests/nodes.cairo +++ b/tests/nodes.cairo @@ -16,51 +16,6 @@ mod add_i8; mod add_i8_broadcast; mod add_u32; mod add_u32_broadcast; -mod argmax_fp16x16_1D_default; -mod argmax_fp16x16_1D_keepdims_false; -mod argmax_fp16x16_1D_last_index; -mod argmax_fp16x16_2D_default; -mod argmax_fp16x16_2D_keepdims_false; -mod argmax_fp16x16_2D_last_index; -mod argmax_fp16x16_3D_default; -mod argmax_fp16x16_3D_keepdims_false; -mod argmax_fp16x16_3D_last_index; -mod argmax_fp8x23_1D_default; -mod argmax_fp8x23_1D_keepdims_false; -mod argmax_fp8x23_1D_last_index; -mod argmax_fp8x23_2D_default; -mod argmax_fp8x23_2D_keepdims_false; -mod argmax_fp8x23_2D_last_index; -mod argmax_fp8x23_3D_default; -mod argmax_fp8x23_3D_keepdims_false; -mod argmax_fp8x23_3D_last_index; -mod argmax_i32_1D_default; -mod argmax_i32_1D_keepdims_false; -mod argmax_i32_1D_last_index; -mod argmax_i32_2D_default; -mod argmax_i32_2D_keepdims_false; -mod argmax_i32_2D_last_index; -mod argmax_i32_3D_default; -mod argmax_i32_3D_keepdims_false; -mod argmax_i32_3D_last_index; -mod argmax_i8_1D_default; -mod argmax_i8_1D_keepdims_false; -mod argmax_i8_1D_last_index; -mod argmax_i8_2D_default; -mod argmax_i8_2D_keepdims_false; -mod argmax_i8_2D_last_index; -mod argmax_i8_3D_default; -mod argmax_i8_3D_keepdims_false; -mod argmax_i8_3D_last_index; -mod argmax_u32_1D_default; -mod argmax_u32_1D_keepdims_false; -mod argmax_u32_1D_last_index; -mod argmax_u32_2D_default; -mod argmax_u32_2D_keepdims_false; -mod argmax_u32_2D_last_index; -mod argmax_u32_3D_default; -mod argmax_u32_3D_keepdims_false; -mod argmax_u32_3D_last_index; mod argmin_fp16x16_1D_default; mod argmin_fp16x16_1D_keepdims_false; mod argmin_fp16x16_1D_last_index; @@ -278,26 +233,6 @@ mod or_i8; mod or_i8_broadcast; mod or_u32; mod or_u32_broadcast; -mod reduce_sum_fp16x16_1D; -mod reduce_sum_fp16x16_2D_default; -mod reduce_sum_fp16x16_2D_keepdims; -mod reduce_sum_fp16x16_2D_axis_1; -mod reduce_sum_fp8x23_1D; -mod reduce_sum_fp8x23_2D_default; -mod reduce_sum_fp8x23_2D_keepdims; -mod reduce_sum_fp8x23_2D_axis_1; -mod reduce_sum_i32_1D; -mod reduce_sum_i32_2D_default; -mod reduce_sum_i32_2D_keepdims; -mod reduce_sum_i32_2D_axis_1; -mod reduce_sum_i8_1D; -mod reduce_sum_i8_2D_default; -mod reduce_sum_i8_2D_keepdims; -mod reduce_sum_i8_2D_axis_1; -mod reduce_sum_u32_1D; -mod reduce_sum_u32_2D_default; -mod reduce_sum_u32_2D_keepdims; -mod reduce_sum_u32_2D_axis_1; mod relu_fp16x16; mod relu_fp8x23; mod relu_i32; @@ -308,8 +243,6 @@ mod sin_fp16x16; mod sin_fp8x23; mod sinh_fp16x16; mod sinh_fp8x23; -mod softmax_fp16x16; -mod softmax_fp8x23; mod softplus_fp8x23; mod softplus_fp16x16; mod softsign_fp8x23; @@ -348,16 +281,6 @@ mod xor_i8; mod xor_i8_broadcast; mod xor_u32; mod xor_u32_broadcast; -mod less_fp16x16; -mod less_fp16x16_broadcast; -mod less_fp8x23; -mod less_fp8x23_broadcast; -mod less_i32; -mod less_i32_broadcast; -mod less_i8; -mod less_i8_broadcast; -mod less_u32; -mod less_u32_broadcast; mod greater_equal_fp16x16; mod greater_equal_fp16x16_broadcast; mod greater_equal_fp8x23; @@ -378,21 +301,6 @@ mod slice_i8_2d; mod slice_i8_3d; mod slice_u32_2d; mod slice_u32_3d; -mod gather_fp8x23_3d_default; -mod gather_fp8x23_3d_axis1; -mod gather_fp8x23_3d_axis2; -mod gather_fp16x16_3d_default; -mod gather_fp16x16_3d_axis1; -mod gather_fp16x16_3d_axis2; -mod gather_i8_3d_default; -mod gather_i8_3d_axis1; -mod gather_i8_3d_axis2; -mod gather_i32_3d_default; -mod gather_i32_3d_axis1; -mod gather_i32_3d_axis2; -mod gather_u32_3d_default; -mod gather_u32_3d_axis1; -mod gather_u32_3d_axis2; mod nonzero_fp16x16_2d; mod nonzero_fp16x16_3d; mod nonzero_fp8x23_2d; @@ -676,21 +584,6 @@ mod reduce_prod_u32_1D; mod reduce_prod_u32_2D_default; mod reduce_prod_u32_2D_keepdims; mod reduce_prod_u32_2D_axis_1; -mod gather_elements_fp16x16_3d_default; -mod gather_elements_fp16x16_3d_axis1; -mod gather_elements_fp16x16_3d_axis2; -mod gather_elements_fp8x23_3d_default; -mod gather_elements_fp8x23_3d_axis1; -mod gather_elements_fp8x23_3d_axis2; -mod gather_elements_i8_3d_default; -mod gather_elements_i8_3d_axis1; -mod gather_elements_i32_3d_default; -mod gather_elements_i32_3d_axis1; -mod gather_elements_i32_3d_axis2; -mod gather_elements_u32_default; -mod gather_elements_u32_axis1; -mod gather_elements_u32_axis2; -mod gather_elements_u32_axis3; mod sequence_length_fp16x16; mod sequence_length_fp16x16_broadcast; mod sequence_length_fp8x23; @@ -1042,10 +935,75 @@ mod conv_2D_with_autopad_same; mod conv_2D_with_strides_asymmetric_padding; mod conv_2D_with_strides_with_padding; mod conv_4D_with_padding; +mod maxpool_2d_constraint_index; +mod maxpool_2d_default; +mod maxpool_2d_dilations; +mod maxpool_2d_pads_default; +mod maxpool_2d_same_lower_default; +mod maxpool_2d_same_upper; +mod maxpool_2d_same_upper_default; +mod maxpool_3d_dilations; +mod maxpool_4d_dilations; +mod export_center_crop_pad_crop; +mod export_center_crop_pad_pad; +mod export_center_crop_pad_crop_axes_hwc; +mod export_center_crop_pad_crop_and_pad; +mod export_center_crop_pad_crop_axes_chw; +mod export_center_crop_pad_crop_negative_axes_hwc; mod label_encoder_fp16x16_3d_default; mod label_encoder_fp8x23_default; mod label_encoder_i8_default; mod label_encoder_i32_default; mod label_encoder_u32_default; mod conv_interger_with_padding; -mod conv_interger_no_padding; \ No newline at end of file +mod conv_interger_no_padding; +mod qlinear_conv; +mod gather_fp16x16_3d_default; +mod gather_fp16x16_3d_axis1; +mod gather_fp16x16_3d_axis2; +mod gather_negative_indices; +mod gather_negative_axis; +mod less_fp16x16; +mod less_fp16x16_broadcast; +mod less_fp8x23; +mod less_fp8x23_broadcast; +mod less_i32; +mod less_i32_broadcast; +mod less_i8; +mod less_i8_broadcast; +mod less_u32; +mod less_u32_broadcast; +mod reshape_extended_dims; +mod reshape_negative_dim; +mod reshape_negative_extended_dims; +mod reshape_one_dim; +mod reshape_reduced_dims; +mod reshape_reordered_all_dims; +mod reshape_reordered_last_dims; +mod reshape_zero_and_negative_dim; +mod reshape_zero_dim; +mod reduce_sum_default_axes_keepdims; +mod reduce_sum_empty_axes_input_noop; +mod reduce_sum_keep_dims; +mod reduce_sum_negative_axes_keepdims; +mod reduce_sum_no_keep_dims; +mod gather_elements_default; +mod gather_elements_axis1; +mod gather_elements_axis2; +mod gather_elements_negative_indices; +mod softmax_axis_0; +mod softmax_axis_1; +mod softmax_axis_2; +mod softmax_axis_minus_1; +mod argmax_default_axes_keepdims; +mod argmax_default_axes_keepdims_select_last_index; +mod argmax_keepdims; +mod argmax_keepdims_select_last_index; +mod argmax_negative_axis_keepdims; +mod argmax_negative_axis_keepdims_select_last_index; +mod argmax_no_keepdims; +mod argmax_no_keepdims_select_last_index; +mod deform_conv_with_padding; +mod deform_conv_with_mask_bias; +mod deform_conv_with_multiple_offset_groups; +mod deform_conv; diff --git a/tests/nodes/argmax_fp16x16_1D_keepdims_false.cairo b/tests/nodes/argmax_default_axes_keepdims.cairo similarity index 56% rename from tests/nodes/argmax_fp16x16_1D_keepdims_false.cairo rename to tests/nodes/argmax_default_axes_keepdims.cairo index 1563fad06..ba970e3b1 100644 --- a/tests/nodes/argmax_fp16x16_1D_keepdims_false.cairo +++ b/tests/nodes/argmax_default_axes_keepdims.cairo @@ -2,21 +2,21 @@ mod input_0; mod output_0; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::FP16x16TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::I32TensorPartialEq; use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::operators::tensor::FP16x16TensorPartialEq; #[test] #[available_gas(2000000000)] -fn test_argmax_fp16x16_1D_keepdims_false() { +fn test_argmax_default_axes_keepdims() { let input_0 = input_0::input_0(); - let z = output_0::output_0(); + let z_0 = output_0::output_0(); - let y = input_0.argmax(0, Option::Some(false), Option::None(())); + let y_0 = input_0.argmax(0, Option::Some(true), Option::None(())); - assert_eq(y, z); + assert_eq(y_0, z_0); } diff --git a/tests/nodes/argmax_fp16x16_2D_keepdims_false/input_0.cairo b/tests/nodes/argmax_default_axes_keepdims/input_0.cairo similarity index 65% rename from tests/nodes/argmax_fp16x16_2D_keepdims_false/input_0.cairo rename to tests/nodes/argmax_default_axes_keepdims/input_0.cairo index 906f29fff..2bd0e9ded 100644 --- a/tests/nodes/argmax_fp16x16_2D_keepdims_false/input_0.cairo +++ b/tests/nodes/argmax_default_axes_keepdims/input_0.cairo @@ -9,9 +9,9 @@ fn input_0() -> Tensor { shape.append(2); let mut data = ArrayTrait::new(); - data.append(FP16x16 { mag: 4521984, sign: false }); - data.append(FP16x16 { mag: 7667712, sign: true }); - data.append(FP16x16 { mag: 393216, sign: true }); - data.append(FP16x16 { mag: 6356992, sign: true }); + data.append(FP16x16 { mag: 2, sign: false }); + data.append(FP16x16 { mag: 1, sign: false }); + data.append(FP16x16 { mag: 3, sign: false }); + data.append(FP16x16 { mag: 10, sign: false }); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/reduce_sum_i32_2D_keepdims/output_0.cairo b/tests/nodes/argmax_default_axes_keepdims/output_0.cairo similarity index 70% rename from tests/nodes/reduce_sum_i32_2D_keepdims/output_0.cairo rename to tests/nodes/argmax_default_axes_keepdims/output_0.cairo index 704b7fd71..83db954c1 100644 --- a/tests/nodes/reduce_sum_i32_2D_keepdims/output_0.cairo +++ b/tests/nodes/argmax_default_axes_keepdims/output_0.cairo @@ -1,6 +1,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorMul}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); @@ -8,7 +9,7 @@ fn output_0() -> Tensor { shape.append(2); let mut data = ArrayTrait::new(); - data.append(2); - data.append(4); + data.append(1); + data.append(1); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/argmax_default_axes_keepdims_select_last_index.cairo b/tests/nodes/argmax_default_axes_keepdims_select_last_index.cairo new file mode 100644 index 000000000..868a5f4a2 --- /dev/null +++ b/tests/nodes/argmax_default_axes_keepdims_select_last_index.cairo @@ -0,0 +1,22 @@ +mod input_0; +mod output_0; + + +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::I32TensorPartialEq; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::operators::tensor::FP16x16TensorPartialEq; + +#[test] +#[available_gas(2000000000)] +fn test_argmax_default_axes_keepdims_select_last_index() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let y_0 = input_0.argmax(0, Option::Some(true), Option::Some(true)); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/argmax_fp16x16_2D_last_index/input_0.cairo b/tests/nodes/argmax_default_axes_keepdims_select_last_index/input_0.cairo similarity index 65% rename from tests/nodes/argmax_fp16x16_2D_last_index/input_0.cairo rename to tests/nodes/argmax_default_axes_keepdims_select_last_index/input_0.cairo index 708f630e3..c0673e50d 100644 --- a/tests/nodes/argmax_fp16x16_2D_last_index/input_0.cairo +++ b/tests/nodes/argmax_default_axes_keepdims_select_last_index/input_0.cairo @@ -9,9 +9,9 @@ fn input_0() -> Tensor { shape.append(2); let mut data = ArrayTrait::new(); - data.append(FP16x16 { mag: 1310720, sign: true }); - data.append(FP16x16 { mag: 3670016, sign: true }); - data.append(FP16x16 { mag: 6422528, sign: true }); - data.append(FP16x16 { mag: 5636096, sign: false }); + data.append(FP16x16 { mag: 2, sign: false }); + data.append(FP16x16 { mag: 2, sign: false }); + data.append(FP16x16 { mag: 3, sign: false }); + data.append(FP16x16 { mag: 10, sign: false }); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/argmax_i32_2D_keepdims_false/input_0.cairo b/tests/nodes/argmax_default_axes_keepdims_select_last_index/output_0.cairo similarity index 69% rename from tests/nodes/argmax_i32_2D_keepdims_false/input_0.cairo rename to tests/nodes/argmax_default_axes_keepdims_select_last_index/output_0.cairo index 4b1340a16..83db954c1 100644 --- a/tests/nodes/argmax_i32_2D_keepdims_false/input_0.cairo +++ b/tests/nodes/argmax_default_axes_keepdims_select_last_index/output_0.cairo @@ -1,16 +1,15 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn input_0() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); - shape.append(2); + shape.append(1); shape.append(2); let mut data = ArrayTrait::new(); - data.append(15); - data.append(57); - data.append(-83); - data.append(13); + data.append(1); + data.append(1); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/argmax_fp16x16_1D_default.cairo b/tests/nodes/argmax_fp16x16_1D_default.cairo deleted file mode 100644 index 873579cce..000000000 --- a/tests/nodes/argmax_fp16x16_1D_default.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::FP16x16TensorPartialEq; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_fp16x16_1D_default() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::None(()), Option::None(())); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_fp16x16_1D_default/input_0.cairo b/tests/nodes/argmax_fp16x16_1D_default/input_0.cairo deleted file mode 100644 index 1d26625fd..000000000 --- a/tests/nodes/argmax_fp16x16_1D_default/input_0.cairo +++ /dev/null @@ -1,15 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; -use orion::numbers::{FixedTrait, FP16x16}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(FP16x16 { mag: 4194304, sign: true }); - data.append(FP16x16 { mag: 917504, sign: false }); - data.append(FP16x16 { mag: 5832704, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_fp16x16_1D_default/output_0.cairo b/tests/nodes/argmax_fp16x16_1D_default/output_0.cairo deleted file mode 100644 index 23846d97b..000000000 --- a/tests/nodes/argmax_fp16x16_1D_default/output_0.cairo +++ /dev/null @@ -1,12 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - - let mut data = ArrayTrait::new(); - data.append(2); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_fp16x16_1D_last_index.cairo b/tests/nodes/argmax_fp16x16_1D_last_index.cairo deleted file mode 100644 index fad13c40f..000000000 --- a/tests/nodes/argmax_fp16x16_1D_last_index.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::FP16x16TensorPartialEq; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_fp16x16_1D_last_index() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::None(()), Option::Some(true)); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_fp16x16_1D_last_index/input_0.cairo b/tests/nodes/argmax_fp16x16_1D_last_index/input_0.cairo deleted file mode 100644 index 9f3f8fb9f..000000000 --- a/tests/nodes/argmax_fp16x16_1D_last_index/input_0.cairo +++ /dev/null @@ -1,15 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; -use orion::numbers::{FixedTrait, FP16x16}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(FP16x16 { mag: 2359296, sign: true }); - data.append(FP16x16 { mag: 5701632, sign: false }); - data.append(FP16x16 { mag: 6684672, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_fp16x16_1D_last_index/output_0.cairo b/tests/nodes/argmax_fp16x16_1D_last_index/output_0.cairo deleted file mode 100644 index 23846d97b..000000000 --- a/tests/nodes/argmax_fp16x16_1D_last_index/output_0.cairo +++ /dev/null @@ -1,12 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - - let mut data = ArrayTrait::new(); - data.append(2); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_fp16x16_2D_keepdims_false.cairo b/tests/nodes/argmax_fp16x16_2D_keepdims_false.cairo deleted file mode 100644 index 32fa5de64..000000000 --- a/tests/nodes/argmax_fp16x16_2D_keepdims_false.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::FP16x16TensorPartialEq; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_fp16x16_2D_keepdims_false() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::Some(false), Option::None(())); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_fp16x16_2D_keepdims_false/output_0.cairo b/tests/nodes/argmax_fp16x16_2D_keepdims_false/output_0.cairo deleted file mode 100644 index 2fe75c127..000000000 --- a/tests/nodes/argmax_fp16x16_2D_keepdims_false/output_0.cairo +++ /dev/null @@ -1,13 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_fp16x16_2D_last_index.cairo b/tests/nodes/argmax_fp16x16_2D_last_index.cairo deleted file mode 100644 index 3c0061e3e..000000000 --- a/tests/nodes/argmax_fp16x16_2D_last_index.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::FP16x16TensorPartialEq; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_fp16x16_2D_last_index() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::None(()), Option::Some(true)); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_fp16x16_2D_last_index/output_0.cairo b/tests/nodes/argmax_fp16x16_2D_last_index/output_0.cairo deleted file mode 100644 index a550af121..000000000 --- a/tests/nodes/argmax_fp16x16_2D_last_index/output_0.cairo +++ /dev/null @@ -1,14 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_fp16x16_3D_default.cairo b/tests/nodes/argmax_fp16x16_3D_default.cairo deleted file mode 100644 index b7efa083b..000000000 --- a/tests/nodes/argmax_fp16x16_3D_default.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::FP16x16TensorPartialEq; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_fp16x16_3D_default() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::None(()), Option::None(())); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_fp16x16_3D_default/input_0.cairo b/tests/nodes/argmax_fp16x16_3D_default/input_0.cairo deleted file mode 100644 index d2f4ba6a0..000000000 --- a/tests/nodes/argmax_fp16x16_3D_default/input_0.cairo +++ /dev/null @@ -1,22 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; -use orion::numbers::{FixedTrait, FP16x16}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(FP16x16 { mag: 720896, sign: true }); - data.append(FP16x16 { mag: 4390912, sign: false }); - data.append(FP16x16 { mag: 5111808, sign: true }); - data.append(FP16x16 { mag: 6553600, sign: false }); - data.append(FP16x16 { mag: 1245184, sign: false }); - data.append(FP16x16 { mag: 6094848, sign: true }); - data.append(FP16x16 { mag: 4718592, sign: false }); - data.append(FP16x16 { mag: 3211264, sign: true }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_fp16x16_3D_default/output_0.cairo b/tests/nodes/argmax_fp16x16_3D_default/output_0.cairo deleted file mode 100644 index 03945682b..000000000 --- a/tests/nodes/argmax_fp16x16_3D_default/output_0.cairo +++ /dev/null @@ -1,17 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(1); - data.append(0); - data.append(1); - data.append(0); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_fp16x16_3D_keepdims_false.cairo b/tests/nodes/argmax_fp16x16_3D_keepdims_false.cairo deleted file mode 100644 index dfd529ffb..000000000 --- a/tests/nodes/argmax_fp16x16_3D_keepdims_false.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::FP16x16TensorPartialEq; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_fp16x16_3D_keepdims_false() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::Some(false), Option::None(())); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_fp16x16_3D_keepdims_false/input_0.cairo b/tests/nodes/argmax_fp16x16_3D_keepdims_false/input_0.cairo deleted file mode 100644 index 392ed4928..000000000 --- a/tests/nodes/argmax_fp16x16_3D_keepdims_false/input_0.cairo +++ /dev/null @@ -1,22 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; -use orion::numbers::{FixedTrait, FP16x16}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(FP16x16 { mag: 1572864, sign: false }); - data.append(FP16x16 { mag: 2424832, sign: true }); - data.append(FP16x16 { mag: 6422528, sign: false }); - data.append(FP16x16 { mag: 5242880, sign: false }); - data.append(FP16x16 { mag: 1703936, sign: true }); - data.append(FP16x16 { mag: 6291456, sign: false }); - data.append(FP16x16 { mag: 589824, sign: true }); - data.append(FP16x16 { mag: 7733248, sign: true }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_fp16x16_3D_keepdims_false/output_0.cairo b/tests/nodes/argmax_fp16x16_3D_keepdims_false/output_0.cairo deleted file mode 100644 index 825125d8a..000000000 --- a/tests/nodes/argmax_fp16x16_3D_keepdims_false/output_0.cairo +++ /dev/null @@ -1,16 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(0); - data.append(0); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_fp16x16_3D_last_index.cairo b/tests/nodes/argmax_fp16x16_3D_last_index.cairo deleted file mode 100644 index 72b0e2642..000000000 --- a/tests/nodes/argmax_fp16x16_3D_last_index.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::FP16x16TensorPartialEq; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_fp16x16_3D_last_index() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::None(()), Option::Some(true)); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_fp16x16_3D_last_index/input_0.cairo b/tests/nodes/argmax_fp16x16_3D_last_index/input_0.cairo deleted file mode 100644 index 50ac50fc8..000000000 --- a/tests/nodes/argmax_fp16x16_3D_last_index/input_0.cairo +++ /dev/null @@ -1,22 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; -use orion::numbers::{FixedTrait, FP16x16}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(FP16x16 { mag: 6291456, sign: true }); - data.append(FP16x16 { mag: 7077888, sign: true }); - data.append(FP16x16 { mag: 1966080, sign: false }); - data.append(FP16x16 { mag: 4063232, sign: false }); - data.append(FP16x16 { mag: 5439488, sign: false }); - data.append(FP16x16 { mag: 1114112, sign: true }); - data.append(FP16x16 { mag: 1441792, sign: false }); - data.append(FP16x16 { mag: 458752, sign: true }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_fp8x23_1D_default.cairo b/tests/nodes/argmax_fp8x23_1D_default.cairo deleted file mode 100644 index 022e60b2f..000000000 --- a/tests/nodes/argmax_fp8x23_1D_default.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; -use orion::operators::tensor::FP8x23TensorPartialEq; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_fp8x23_1D_default() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::None(()), Option::None(())); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_fp8x23_1D_default/input_0.cairo b/tests/nodes/argmax_fp8x23_1D_default/input_0.cairo deleted file mode 100644 index 96ca7af0a..000000000 --- a/tests/nodes/argmax_fp8x23_1D_default/input_0.cairo +++ /dev/null @@ -1,15 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 1040187392, sign: false }); - data.append(FP8x23 { mag: 637534208, sign: true }); - data.append(FP8x23 { mag: 830472192, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_fp8x23_1D_default/output_0.cairo b/tests/nodes/argmax_fp8x23_1D_default/output_0.cairo deleted file mode 100644 index e4dbc507c..000000000 --- a/tests/nodes/argmax_fp8x23_1D_default/output_0.cairo +++ /dev/null @@ -1,12 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - - let mut data = ArrayTrait::new(); - data.append(0); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_fp8x23_1D_keepdims_false.cairo b/tests/nodes/argmax_fp8x23_1D_keepdims_false.cairo deleted file mode 100644 index cb6cea94f..000000000 --- a/tests/nodes/argmax_fp8x23_1D_keepdims_false.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; -use orion::operators::tensor::FP8x23TensorPartialEq; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_fp8x23_1D_keepdims_false() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::Some(false), Option::None(())); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_fp8x23_1D_keepdims_false/input_0.cairo b/tests/nodes/argmax_fp8x23_1D_keepdims_false/input_0.cairo deleted file mode 100644 index 35f085f6e..000000000 --- a/tests/nodes/argmax_fp8x23_1D_keepdims_false/input_0.cairo +++ /dev/null @@ -1,15 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 402653184, sign: false }); - data.append(FP8x23 { mag: 905969664, sign: true }); - data.append(FP8x23 { mag: 822083584, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_fp8x23_1D_keepdims_false/output_0.cairo b/tests/nodes/argmax_fp8x23_1D_keepdims_false/output_0.cairo deleted file mode 100644 index 23846d97b..000000000 --- a/tests/nodes/argmax_fp8x23_1D_keepdims_false/output_0.cairo +++ /dev/null @@ -1,12 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - - let mut data = ArrayTrait::new(); - data.append(2); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_fp8x23_1D_last_index.cairo b/tests/nodes/argmax_fp8x23_1D_last_index.cairo deleted file mode 100644 index e2a7f0985..000000000 --- a/tests/nodes/argmax_fp8x23_1D_last_index.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; -use orion::operators::tensor::FP8x23TensorPartialEq; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_fp8x23_1D_last_index() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::None(()), Option::Some(true)); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_fp8x23_1D_last_index/input_0.cairo b/tests/nodes/argmax_fp8x23_1D_last_index/input_0.cairo deleted file mode 100644 index 7613acbd4..000000000 --- a/tests/nodes/argmax_fp8x23_1D_last_index/input_0.cairo +++ /dev/null @@ -1,15 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 369098752, sign: false }); - data.append(FP8x23 { mag: 847249408, sign: true }); - data.append(FP8x23 { mag: 612368384, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_fp8x23_1D_last_index/output_0.cairo b/tests/nodes/argmax_fp8x23_1D_last_index/output_0.cairo deleted file mode 100644 index 23846d97b..000000000 --- a/tests/nodes/argmax_fp8x23_1D_last_index/output_0.cairo +++ /dev/null @@ -1,12 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - - let mut data = ArrayTrait::new(); - data.append(2); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_fp8x23_2D_default.cairo b/tests/nodes/argmax_fp8x23_2D_default.cairo deleted file mode 100644 index 0e474f982..000000000 --- a/tests/nodes/argmax_fp8x23_2D_default.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; -use orion::operators::tensor::FP8x23TensorPartialEq; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_fp8x23_2D_default() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::None(()), Option::None(())); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_fp8x23_2D_default/input_0.cairo b/tests/nodes/argmax_fp8x23_2D_default/input_0.cairo deleted file mode 100644 index d3ddea114..000000000 --- a/tests/nodes/argmax_fp8x23_2D_default/input_0.cairo +++ /dev/null @@ -1,17 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 654311424, sign: true }); - data.append(FP8x23 { mag: 469762048, sign: false }); - data.append(FP8x23 { mag: 964689920, sign: true }); - data.append(FP8x23 { mag: 662700032, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_fp8x23_2D_keepdims_false.cairo b/tests/nodes/argmax_fp8x23_2D_keepdims_false.cairo deleted file mode 100644 index 40fe14c02..000000000 --- a/tests/nodes/argmax_fp8x23_2D_keepdims_false.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; -use orion::operators::tensor::FP8x23TensorPartialEq; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_fp8x23_2D_keepdims_false() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::Some(false), Option::None(())); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_fp8x23_2D_keepdims_false/input_0.cairo b/tests/nodes/argmax_fp8x23_2D_keepdims_false/input_0.cairo deleted file mode 100644 index efb3441d3..000000000 --- a/tests/nodes/argmax_fp8x23_2D_keepdims_false/input_0.cairo +++ /dev/null @@ -1,17 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 536870912, sign: true }); - data.append(FP8x23 { mag: 469762048, sign: false }); - data.append(FP8x23 { mag: 83886080, sign: true }); - data.append(FP8x23 { mag: 620756992, sign: true }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_fp8x23_2D_keepdims_false/output_0.cairo b/tests/nodes/argmax_fp8x23_2D_keepdims_false/output_0.cairo deleted file mode 100644 index edc68637b..000000000 --- a/tests/nodes/argmax_fp8x23_2D_keepdims_false/output_0.cairo +++ /dev/null @@ -1,13 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(1); - data.append(0); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_fp8x23_2D_last_index.cairo b/tests/nodes/argmax_fp8x23_2D_last_index.cairo deleted file mode 100644 index 05510e4f2..000000000 --- a/tests/nodes/argmax_fp8x23_2D_last_index.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; -use orion::operators::tensor::FP8x23TensorPartialEq; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_fp8x23_2D_last_index() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::None(()), Option::Some(true)); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_fp8x23_2D_last_index/input_0.cairo b/tests/nodes/argmax_fp8x23_2D_last_index/input_0.cairo deleted file mode 100644 index be2e02d4c..000000000 --- a/tests/nodes/argmax_fp8x23_2D_last_index/input_0.cairo +++ /dev/null @@ -1,17 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 335544320, sign: false }); - data.append(FP8x23 { mag: 1031798784, sign: true }); - data.append(FP8x23 { mag: 989855744, sign: true }); - data.append(FP8x23 { mag: 813694976, sign: true }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_fp8x23_2D_last_index/output_0.cairo b/tests/nodes/argmax_fp8x23_2D_last_index/output_0.cairo deleted file mode 100644 index a550af121..000000000 --- a/tests/nodes/argmax_fp8x23_2D_last_index/output_0.cairo +++ /dev/null @@ -1,14 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_fp8x23_3D_default.cairo b/tests/nodes/argmax_fp8x23_3D_default.cairo deleted file mode 100644 index 4ca1b45c4..000000000 --- a/tests/nodes/argmax_fp8x23_3D_default.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; -use orion::operators::tensor::FP8x23TensorPartialEq; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_fp8x23_3D_default() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::None(()), Option::None(())); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_fp8x23_3D_default/input_0.cairo b/tests/nodes/argmax_fp8x23_3D_default/input_0.cairo deleted file mode 100644 index 4512a7d3c..000000000 --- a/tests/nodes/argmax_fp8x23_3D_default/input_0.cairo +++ /dev/null @@ -1,22 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 612368384, sign: false }); - data.append(FP8x23 { mag: 578813952, sign: false }); - data.append(FP8x23 { mag: 947912704, sign: false }); - data.append(FP8x23 { mag: 201326592, sign: true }); - data.append(FP8x23 { mag: 1031798784, sign: true }); - data.append(FP8x23 { mag: 729808896, sign: false }); - data.append(FP8x23 { mag: 922746880, sign: false }); - data.append(FP8x23 { mag: 33554432, sign: true }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_fp8x23_3D_default/output_0.cairo b/tests/nodes/argmax_fp8x23_3D_default/output_0.cairo deleted file mode 100644 index 07cf1b47e..000000000 --- a/tests/nodes/argmax_fp8x23_3D_default/output_0.cairo +++ /dev/null @@ -1,17 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(0); - data.append(1); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_fp8x23_3D_keepdims_false.cairo b/tests/nodes/argmax_fp8x23_3D_keepdims_false.cairo deleted file mode 100644 index 4d5a5b850..000000000 --- a/tests/nodes/argmax_fp8x23_3D_keepdims_false.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; -use orion::operators::tensor::FP8x23TensorPartialEq; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_fp8x23_3D_keepdims_false() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::Some(false), Option::None(())); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_fp8x23_3D_keepdims_false/input_0.cairo b/tests/nodes/argmax_fp8x23_3D_keepdims_false/input_0.cairo deleted file mode 100644 index a7ac816c9..000000000 --- a/tests/nodes/argmax_fp8x23_3D_keepdims_false/input_0.cairo +++ /dev/null @@ -1,22 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 444596224, sign: false }); - data.append(FP8x23 { mag: 369098752, sign: false }); - data.append(FP8x23 { mag: 1056964608, sign: false }); - data.append(FP8x23 { mag: 234881024, sign: false }); - data.append(FP8x23 { mag: 159383552, sign: true }); - data.append(FP8x23 { mag: 16777216, sign: true }); - data.append(FP8x23 { mag: 897581056, sign: true }); - data.append(FP8x23 { mag: 327155712, sign: true }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_fp8x23_3D_keepdims_false/output_0.cairo b/tests/nodes/argmax_fp8x23_3D_keepdims_false/output_0.cairo deleted file mode 100644 index 637e10c01..000000000 --- a/tests/nodes/argmax_fp8x23_3D_keepdims_false/output_0.cairo +++ /dev/null @@ -1,16 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(0); - data.append(0); - data.append(0); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_fp8x23_3D_last_index.cairo b/tests/nodes/argmax_fp8x23_3D_last_index.cairo deleted file mode 100644 index 856fbd988..000000000 --- a/tests/nodes/argmax_fp8x23_3D_last_index.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; -use orion::operators::tensor::FP8x23TensorPartialEq; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_fp8x23_3D_last_index() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::None(()), Option::Some(true)); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_fp8x23_3D_last_index/input_0.cairo b/tests/nodes/argmax_fp8x23_3D_last_index/input_0.cairo deleted file mode 100644 index 42b2e25d0..000000000 --- a/tests/nodes/argmax_fp8x23_3D_last_index/input_0.cairo +++ /dev/null @@ -1,22 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 83886080, sign: false }); - data.append(FP8x23 { mag: 729808896, sign: true }); - data.append(FP8x23 { mag: 536870912, sign: true }); - data.append(FP8x23 { mag: 905969664, sign: false }); - data.append(FP8x23 { mag: 75497472, sign: true }); - data.append(FP8x23 { mag: 377487360, sign: true }); - data.append(FP8x23 { mag: 92274688, sign: true }); - data.append(FP8x23 { mag: 209715200, sign: true }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_fp8x23_3D_last_index/output_0.cairo b/tests/nodes/argmax_fp8x23_3D_last_index/output_0.cairo deleted file mode 100644 index e35cd05a2..000000000 --- a/tests/nodes/argmax_fp8x23_3D_last_index/output_0.cairo +++ /dev/null @@ -1,17 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(1); - data.append(0); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i32_1D_default.cairo b/tests/nodes/argmax_i32_1D_default.cairo deleted file mode 100644 index 7846917bd..000000000 --- a/tests/nodes/argmax_i32_1D_default.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::I32TensorPartialEq; -use orion::operators::tensor::{I32Tensor, I32TensorAdd}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_i32_1D_default() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::None(()), Option::None(())); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_i32_1D_default/output_0.cairo b/tests/nodes/argmax_i32_1D_default/output_0.cairo deleted file mode 100644 index 23846d97b..000000000 --- a/tests/nodes/argmax_i32_1D_default/output_0.cairo +++ /dev/null @@ -1,12 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - - let mut data = ArrayTrait::new(); - data.append(2); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i32_1D_keepdims_false.cairo b/tests/nodes/argmax_i32_1D_keepdims_false.cairo deleted file mode 100644 index 9649435c7..000000000 --- a/tests/nodes/argmax_i32_1D_keepdims_false.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::I32TensorPartialEq; -use orion::operators::tensor::{I32Tensor, I32TensorAdd}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_i32_1D_keepdims_false() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::Some(false), Option::None(())); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_i32_1D_keepdims_false/output_0.cairo b/tests/nodes/argmax_i32_1D_keepdims_false/output_0.cairo deleted file mode 100644 index f59edfe99..000000000 --- a/tests/nodes/argmax_i32_1D_keepdims_false/output_0.cairo +++ /dev/null @@ -1,12 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - - let mut data = ArrayTrait::new(); - data.append(1); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i32_1D_last_index.cairo b/tests/nodes/argmax_i32_1D_last_index.cairo deleted file mode 100644 index 94f533be6..000000000 --- a/tests/nodes/argmax_i32_1D_last_index.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::I32TensorPartialEq; -use orion::operators::tensor::{I32Tensor, I32TensorAdd}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_i32_1D_last_index() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::None(()), Option::Some(true)); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_i32_1D_last_index/output_0.cairo b/tests/nodes/argmax_i32_1D_last_index/output_0.cairo deleted file mode 100644 index f59edfe99..000000000 --- a/tests/nodes/argmax_i32_1D_last_index/output_0.cairo +++ /dev/null @@ -1,12 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - - let mut data = ArrayTrait::new(); - data.append(1); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i32_2D_default/input_0.cairo b/tests/nodes/argmax_i32_2D_default/input_0.cairo deleted file mode 100644 index 92434e2c9..000000000 --- a/tests/nodes/argmax_i32_2D_default/input_0.cairo +++ /dev/null @@ -1,16 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorAdd}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(-27); - data.append(114); - data.append(-54); - data.append(-100); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i32_2D_default/output_0.cairo b/tests/nodes/argmax_i32_2D_default/output_0.cairo deleted file mode 100644 index e072284af..000000000 --- a/tests/nodes/argmax_i32_2D_default/output_0.cairo +++ /dev/null @@ -1,14 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(0); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i32_2D_keepdims_false.cairo b/tests/nodes/argmax_i32_2D_keepdims_false.cairo deleted file mode 100644 index 6e5372c2b..000000000 --- a/tests/nodes/argmax_i32_2D_keepdims_false.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::I32TensorPartialEq; -use orion::operators::tensor::{I32Tensor, I32TensorAdd}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_i32_2D_keepdims_false() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::Some(false), Option::None(())); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_i32_2D_keepdims_false/output_0.cairo b/tests/nodes/argmax_i32_2D_keepdims_false/output_0.cairo deleted file mode 100644 index 4870d2de9..000000000 --- a/tests/nodes/argmax_i32_2D_keepdims_false/output_0.cairo +++ /dev/null @@ -1,13 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(0); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i32_2D_last_index.cairo b/tests/nodes/argmax_i32_2D_last_index.cairo deleted file mode 100644 index 5d734d434..000000000 --- a/tests/nodes/argmax_i32_2D_last_index.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::I32TensorPartialEq; -use orion::operators::tensor::{I32Tensor, I32TensorAdd}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_i32_2D_last_index() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::None(()), Option::Some(true)); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_i32_2D_last_index/output_0.cairo b/tests/nodes/argmax_i32_2D_last_index/output_0.cairo deleted file mode 100644 index e072284af..000000000 --- a/tests/nodes/argmax_i32_2D_last_index/output_0.cairo +++ /dev/null @@ -1,14 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(0); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i32_3D_default.cairo b/tests/nodes/argmax_i32_3D_default.cairo deleted file mode 100644 index 0f1088869..000000000 --- a/tests/nodes/argmax_i32_3D_default.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::I32TensorPartialEq; -use orion::operators::tensor::{I32Tensor, I32TensorAdd}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_i32_3D_default() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::None(()), Option::None(())); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_i32_3D_default/input_0.cairo b/tests/nodes/argmax_i32_3D_default/input_0.cairo deleted file mode 100644 index 142afb3c3..000000000 --- a/tests/nodes/argmax_i32_3D_default/input_0.cairo +++ /dev/null @@ -1,21 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorAdd}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(-56); - data.append(46); - data.append(-48); - data.append(91); - data.append(-70); - data.append(-54); - data.append(96); - data.append(122); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i32_3D_default/output_0.cairo b/tests/nodes/argmax_i32_3D_default/output_0.cairo deleted file mode 100644 index a4cc4f838..000000000 --- a/tests/nodes/argmax_i32_3D_default/output_0.cairo +++ /dev/null @@ -1,17 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(0); - data.append(1); - data.append(1); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i32_3D_keepdims_false.cairo b/tests/nodes/argmax_i32_3D_keepdims_false.cairo deleted file mode 100644 index 8aac46a2c..000000000 --- a/tests/nodes/argmax_i32_3D_keepdims_false.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::I32TensorPartialEq; -use orion::operators::tensor::{I32Tensor, I32TensorAdd}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_i32_3D_keepdims_false() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::Some(false), Option::None(())); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_i32_3D_keepdims_false/input_0.cairo b/tests/nodes/argmax_i32_3D_keepdims_false/input_0.cairo deleted file mode 100644 index 5a61a206a..000000000 --- a/tests/nodes/argmax_i32_3D_keepdims_false/input_0.cairo +++ /dev/null @@ -1,21 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorAdd}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(-121); - data.append(-114); - data.append(56); - data.append(42); - data.append(79); - data.append(43); - data.append(126); - data.append(-64); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i32_3D_keepdims_false/output_0.cairo b/tests/nodes/argmax_i32_3D_keepdims_false/output_0.cairo deleted file mode 100644 index 1d637338a..000000000 --- a/tests/nodes/argmax_i32_3D_keepdims_false/output_0.cairo +++ /dev/null @@ -1,16 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(1); - data.append(1); - data.append(1); - data.append(0); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i32_3D_last_index.cairo b/tests/nodes/argmax_i32_3D_last_index.cairo deleted file mode 100644 index 81f4997de..000000000 --- a/tests/nodes/argmax_i32_3D_last_index.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::I32TensorPartialEq; -use orion::operators::tensor::{I32Tensor, I32TensorAdd}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_i32_3D_last_index() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::None(()), Option::Some(true)); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_i32_3D_last_index/input_0.cairo b/tests/nodes/argmax_i32_3D_last_index/input_0.cairo deleted file mode 100644 index c5d8bc74e..000000000 --- a/tests/nodes/argmax_i32_3D_last_index/input_0.cairo +++ /dev/null @@ -1,21 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorAdd}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(98); - data.append(89); - data.append(-126); - data.append(-68); - data.append(31); - data.append(7); - data.append(-86); - data.append(99); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i32_3D_last_index/output_0.cairo b/tests/nodes/argmax_i32_3D_last_index/output_0.cairo deleted file mode 100644 index a4cc4f838..000000000 --- a/tests/nodes/argmax_i32_3D_last_index/output_0.cairo +++ /dev/null @@ -1,17 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(0); - data.append(1); - data.append(1); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i8_1D_default.cairo b/tests/nodes/argmax_i8_1D_default.cairo deleted file mode 100644 index 5fd40f6b5..000000000 --- a/tests/nodes/argmax_i8_1D_default.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::I8TensorPartialEq; -use orion::operators::tensor::{I8Tensor, I8TensorAdd}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_i8_1D_default() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::None(()), Option::None(())); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_i8_1D_default/output_0.cairo b/tests/nodes/argmax_i8_1D_default/output_0.cairo deleted file mode 100644 index e4dbc507c..000000000 --- a/tests/nodes/argmax_i8_1D_default/output_0.cairo +++ /dev/null @@ -1,12 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - - let mut data = ArrayTrait::new(); - data.append(0); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i8_1D_keepdims_false.cairo b/tests/nodes/argmax_i8_1D_keepdims_false.cairo deleted file mode 100644 index 9fa8ef88c..000000000 --- a/tests/nodes/argmax_i8_1D_keepdims_false.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::I8TensorPartialEq; -use orion::operators::tensor::{I8Tensor, I8TensorAdd}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_i8_1D_keepdims_false() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::Some(false), Option::None(())); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_i8_1D_keepdims_false/input_0.cairo b/tests/nodes/argmax_i8_1D_keepdims_false/input_0.cairo deleted file mode 100644 index fdfdf6ff4..000000000 --- a/tests/nodes/argmax_i8_1D_keepdims_false/input_0.cairo +++ /dev/null @@ -1,14 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I8Tensor, I8TensorAdd}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(-68); - data.append(56); - data.append(-126); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i8_1D_keepdims_false/output_0.cairo b/tests/nodes/argmax_i8_1D_keepdims_false/output_0.cairo deleted file mode 100644 index f59edfe99..000000000 --- a/tests/nodes/argmax_i8_1D_keepdims_false/output_0.cairo +++ /dev/null @@ -1,12 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - - let mut data = ArrayTrait::new(); - data.append(1); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i8_1D_last_index.cairo b/tests/nodes/argmax_i8_1D_last_index.cairo deleted file mode 100644 index 54ccb82f9..000000000 --- a/tests/nodes/argmax_i8_1D_last_index.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::I8TensorPartialEq; -use orion::operators::tensor::{I8Tensor, I8TensorAdd}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_i8_1D_last_index() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::None(()), Option::Some(true)); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_i8_1D_last_index/input_0.cairo b/tests/nodes/argmax_i8_1D_last_index/input_0.cairo deleted file mode 100644 index 262a8306c..000000000 --- a/tests/nodes/argmax_i8_1D_last_index/input_0.cairo +++ /dev/null @@ -1,14 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I8Tensor, I8TensorAdd}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(111); - data.append(84); - data.append(-120); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i8_1D_last_index/output_0.cairo b/tests/nodes/argmax_i8_1D_last_index/output_0.cairo deleted file mode 100644 index e4dbc507c..000000000 --- a/tests/nodes/argmax_i8_1D_last_index/output_0.cairo +++ /dev/null @@ -1,12 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - - let mut data = ArrayTrait::new(); - data.append(0); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i8_2D_default.cairo b/tests/nodes/argmax_i8_2D_default.cairo deleted file mode 100644 index dc0a71e4e..000000000 --- a/tests/nodes/argmax_i8_2D_default.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::I8TensorPartialEq; -use orion::operators::tensor::{I8Tensor, I8TensorAdd}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_i8_2D_default() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::None(()), Option::None(())); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_i8_2D_default/input_0.cairo b/tests/nodes/argmax_i8_2D_default/input_0.cairo deleted file mode 100644 index 9aa9650c7..000000000 --- a/tests/nodes/argmax_i8_2D_default/input_0.cairo +++ /dev/null @@ -1,16 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I8Tensor, I8TensorAdd}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(-8); - data.append(-67); - data.append(-22); - data.append(99); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i8_2D_default/output_0.cairo b/tests/nodes/argmax_i8_2D_default/output_0.cairo deleted file mode 100644 index a550af121..000000000 --- a/tests/nodes/argmax_i8_2D_default/output_0.cairo +++ /dev/null @@ -1,14 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i8_2D_keepdims_false.cairo b/tests/nodes/argmax_i8_2D_keepdims_false.cairo deleted file mode 100644 index a56d67f01..000000000 --- a/tests/nodes/argmax_i8_2D_keepdims_false.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::I8TensorPartialEq; -use orion::operators::tensor::{I8Tensor, I8TensorAdd}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_i8_2D_keepdims_false() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::Some(false), Option::None(())); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_i8_2D_keepdims_false/input_0.cairo b/tests/nodes/argmax_i8_2D_keepdims_false/input_0.cairo deleted file mode 100644 index 373558d6e..000000000 --- a/tests/nodes/argmax_i8_2D_keepdims_false/input_0.cairo +++ /dev/null @@ -1,16 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I8Tensor, I8TensorAdd}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(25); - data.append(-120); - data.append(-2); - data.append(105); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i8_2D_keepdims_false/output_0.cairo b/tests/nodes/argmax_i8_2D_keepdims_false/output_0.cairo deleted file mode 100644 index 2fe75c127..000000000 --- a/tests/nodes/argmax_i8_2D_keepdims_false/output_0.cairo +++ /dev/null @@ -1,13 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i8_2D_last_index.cairo b/tests/nodes/argmax_i8_2D_last_index.cairo deleted file mode 100644 index 1574a72f7..000000000 --- a/tests/nodes/argmax_i8_2D_last_index.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::I8TensorPartialEq; -use orion::operators::tensor::{I8Tensor, I8TensorAdd}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_i8_2D_last_index() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::None(()), Option::Some(true)); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_i8_2D_last_index/input_0.cairo b/tests/nodes/argmax_i8_2D_last_index/input_0.cairo deleted file mode 100644 index 051786fb8..000000000 --- a/tests/nodes/argmax_i8_2D_last_index/input_0.cairo +++ /dev/null @@ -1,16 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I8Tensor, I8TensorAdd}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(-73); - data.append(111); - data.append(47); - data.append(-18); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i8_2D_last_index/output_0.cairo b/tests/nodes/argmax_i8_2D_last_index/output_0.cairo deleted file mode 100644 index 221e8a246..000000000 --- a/tests/nodes/argmax_i8_2D_last_index/output_0.cairo +++ /dev/null @@ -1,14 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(1); - data.append(0); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i8_3D_default.cairo b/tests/nodes/argmax_i8_3D_default.cairo deleted file mode 100644 index eaf92eae5..000000000 --- a/tests/nodes/argmax_i8_3D_default.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::I8TensorPartialEq; -use orion::operators::tensor::{I8Tensor, I8TensorAdd}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_i8_3D_default() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::None(()), Option::None(())); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_i8_3D_default/input_0.cairo b/tests/nodes/argmax_i8_3D_default/input_0.cairo deleted file mode 100644 index cc96b52ca..000000000 --- a/tests/nodes/argmax_i8_3D_default/input_0.cairo +++ /dev/null @@ -1,21 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I8Tensor, I8TensorAdd}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(66); - data.append(-56); - data.append(49); - data.append(-2); - data.append(-93); - data.append(-55); - data.append(115); - data.append(28); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i8_3D_default/output_0.cairo b/tests/nodes/argmax_i8_3D_default/output_0.cairo deleted file mode 100644 index 56d0d331d..000000000 --- a/tests/nodes/argmax_i8_3D_default/output_0.cairo +++ /dev/null @@ -1,17 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(1); - data.append(1); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i8_3D_keepdims_false.cairo b/tests/nodes/argmax_i8_3D_keepdims_false.cairo deleted file mode 100644 index 3b3f3c10c..000000000 --- a/tests/nodes/argmax_i8_3D_keepdims_false.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::I8TensorPartialEq; -use orion::operators::tensor::{I8Tensor, I8TensorAdd}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_i8_3D_keepdims_false() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::Some(false), Option::None(())); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_i8_3D_keepdims_false/input_0.cairo b/tests/nodes/argmax_i8_3D_keepdims_false/input_0.cairo deleted file mode 100644 index f6de84eca..000000000 --- a/tests/nodes/argmax_i8_3D_keepdims_false/input_0.cairo +++ /dev/null @@ -1,21 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I8Tensor, I8TensorAdd}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(82); - data.append(70); - data.append(-18); - data.append(-46); - data.append(-4); - data.append(82); - data.append(58); - data.append(-41); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i8_3D_keepdims_false/output_0.cairo b/tests/nodes/argmax_i8_3D_keepdims_false/output_0.cairo deleted file mode 100644 index f13678224..000000000 --- a/tests/nodes/argmax_i8_3D_keepdims_false/output_0.cairo +++ /dev/null @@ -1,16 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(1); - data.append(1); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i8_3D_last_index.cairo b/tests/nodes/argmax_i8_3D_last_index.cairo deleted file mode 100644 index cd460d7c2..000000000 --- a/tests/nodes/argmax_i8_3D_last_index.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::I8TensorPartialEq; -use orion::operators::tensor::{I8Tensor, I8TensorAdd}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_i8_3D_last_index() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::None(()), Option::Some(true)); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_i8_3D_last_index/input_0.cairo b/tests/nodes/argmax_i8_3D_last_index/input_0.cairo deleted file mode 100644 index a665d1534..000000000 --- a/tests/nodes/argmax_i8_3D_last_index/input_0.cairo +++ /dev/null @@ -1,21 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I8Tensor, I8TensorAdd}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(-7); - data.append(-94); - data.append(-64); - data.append(-19); - data.append(59); - data.append(-40); - data.append(99); - data.append(38); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_i8_3D_last_index/output_0.cairo b/tests/nodes/argmax_i8_3D_last_index/output_0.cairo deleted file mode 100644 index 23b7ccc3c..000000000 --- a/tests/nodes/argmax_i8_3D_last_index/output_0.cairo +++ /dev/null @@ -1,17 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(1); - data.append(1); - data.append(1); - data.append(1); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_fp16x16_2D_default.cairo b/tests/nodes/argmax_keepdims.cairo similarity index 58% rename from tests/nodes/argmax_fp16x16_2D_default.cairo rename to tests/nodes/argmax_keepdims.cairo index 754dd2119..49f6f5d7b 100644 --- a/tests/nodes/argmax_fp16x16_2D_default.cairo +++ b/tests/nodes/argmax_keepdims.cairo @@ -2,21 +2,21 @@ mod input_0; mod output_0; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::FP16x16TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::I32TensorPartialEq; use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::operators::tensor::FP16x16TensorPartialEq; #[test] #[available_gas(2000000000)] -fn test_argmax_fp16x16_2D_default() { +fn test_argmax_keepdims() { let input_0 = input_0::input_0(); - let z = output_0::output_0(); + let z_0 = output_0::output_0(); - let y = input_0.argmax(0, Option::None(()), Option::None(())); + let y_0 = input_0.argmax(1, Option::Some(true), Option::None(())); - assert_eq(y, z); + assert_eq(y_0, z_0); } diff --git a/tests/nodes/argmax_fp16x16_2D_default/input_0.cairo b/tests/nodes/argmax_keepdims/input_0.cairo similarity index 65% rename from tests/nodes/argmax_fp16x16_2D_default/input_0.cairo rename to tests/nodes/argmax_keepdims/input_0.cairo index ce1b11cae..2bd0e9ded 100644 --- a/tests/nodes/argmax_fp16x16_2D_default/input_0.cairo +++ b/tests/nodes/argmax_keepdims/input_0.cairo @@ -9,9 +9,9 @@ fn input_0() -> Tensor { shape.append(2); let mut data = ArrayTrait::new(); - data.append(FP16x16 { mag: 196608, sign: true }); - data.append(FP16x16 { mag: 2162688, sign: false }); - data.append(FP16x16 { mag: 1507328, sign: true }); - data.append(FP16x16 { mag: 6815744, sign: false }); + data.append(FP16x16 { mag: 2, sign: false }); + data.append(FP16x16 { mag: 1, sign: false }); + data.append(FP16x16 { mag: 3, sign: false }); + data.append(FP16x16 { mag: 10, sign: false }); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/argmax_fp8x23_2D_default/output_0.cairo b/tests/nodes/argmax_keepdims/output_0.cairo similarity index 72% rename from tests/nodes/argmax_fp8x23_2D_default/output_0.cairo rename to tests/nodes/argmax_keepdims/output_0.cairo index a550af121..a1ae6cd36 100644 --- a/tests/nodes/argmax_fp8x23_2D_default/output_0.cairo +++ b/tests/nodes/argmax_keepdims/output_0.cairo @@ -1,11 +1,12 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn output_0() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); - shape.append(1); shape.append(2); + shape.append(1); let mut data = ArrayTrait::new(); data.append(0); diff --git a/tests/nodes/argmax_keepdims_select_last_index.cairo b/tests/nodes/argmax_keepdims_select_last_index.cairo new file mode 100644 index 000000000..234cb0057 --- /dev/null +++ b/tests/nodes/argmax_keepdims_select_last_index.cairo @@ -0,0 +1,22 @@ +mod input_0; +mod output_0; + + +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::I32TensorPartialEq; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::operators::tensor::FP16x16TensorPartialEq; + +#[test] +#[available_gas(2000000000)] +fn test_argmax_keepdims_select_last_index() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let y_0 = input_0.argmax(1, Option::Some(true), Option::Some(true)); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/argmax_fp16x16_1D_keepdims_false/input_0.cairo b/tests/nodes/argmax_keepdims_select_last_index/input_0.cairo similarity index 60% rename from tests/nodes/argmax_fp16x16_1D_keepdims_false/input_0.cairo rename to tests/nodes/argmax_keepdims_select_last_index/input_0.cairo index 1c4977212..c0673e50d 100644 --- a/tests/nodes/argmax_fp16x16_1D_keepdims_false/input_0.cairo +++ b/tests/nodes/argmax_keepdims_select_last_index/input_0.cairo @@ -5,11 +5,13 @@ use orion::numbers::{FixedTrait, FP16x16}; fn input_0() -> Tensor { let mut shape = ArrayTrait::::new(); - shape.append(3); + shape.append(2); + shape.append(2); let mut data = ArrayTrait::new(); - data.append(FP16x16 { mag: 6422528, sign: false }); - data.append(FP16x16 { mag: 2031616, sign: false }); - data.append(FP16x16 { mag: 6356992, sign: true }); + data.append(FP16x16 { mag: 2, sign: false }); + data.append(FP16x16 { mag: 2, sign: false }); + data.append(FP16x16 { mag: 3, sign: false }); + data.append(FP16x16 { mag: 10, sign: false }); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/argmax_i32_2D_last_index/input_0.cairo b/tests/nodes/argmax_keepdims_select_last_index/output_0.cairo similarity index 69% rename from tests/nodes/argmax_i32_2D_last_index/input_0.cairo rename to tests/nodes/argmax_keepdims_select_last_index/output_0.cairo index f06f44db7..241b14b08 100644 --- a/tests/nodes/argmax_i32_2D_last_index/input_0.cairo +++ b/tests/nodes/argmax_keepdims_select_last_index/output_0.cairo @@ -1,16 +1,15 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn input_0() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(2); - shape.append(2); + shape.append(1); let mut data = ArrayTrait::new(); - data.append(-31); - data.append(-9); - data.append(-103); - data.append(-88); + data.append(1); + data.append(1); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/argmax_negative_axis_keepdims.cairo b/tests/nodes/argmax_negative_axis_keepdims.cairo new file mode 100644 index 000000000..85eb2619f --- /dev/null +++ b/tests/nodes/argmax_negative_axis_keepdims.cairo @@ -0,0 +1,22 @@ +mod input_0; +mod output_0; + + +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::I32TensorPartialEq; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::operators::tensor::FP16x16TensorPartialEq; + +#[test] +#[available_gas(2000000000)] +fn test_argmax_negative_axis_keepdims() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let y_0 = input_0.argmax(-1, Option::Some(true), Option::None(())); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/argmax_negative_axis_keepdims/input_0.cairo b/tests/nodes/argmax_negative_axis_keepdims/input_0.cairo new file mode 100644 index 000000000..2bd0e9ded --- /dev/null +++ b/tests/nodes/argmax_negative_axis_keepdims/input_0.cairo @@ -0,0 +1,17 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(2); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 2, sign: false }); + data.append(FP16x16 { mag: 1, sign: false }); + data.append(FP16x16 { mag: 3, sign: false }); + data.append(FP16x16 { mag: 10, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/argmax_fp16x16_2D_default/output_0.cairo b/tests/nodes/argmax_negative_axis_keepdims/output_0.cairo similarity index 72% rename from tests/nodes/argmax_fp16x16_2D_default/output_0.cairo rename to tests/nodes/argmax_negative_axis_keepdims/output_0.cairo index a550af121..a1ae6cd36 100644 --- a/tests/nodes/argmax_fp16x16_2D_default/output_0.cairo +++ b/tests/nodes/argmax_negative_axis_keepdims/output_0.cairo @@ -1,11 +1,12 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn output_0() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); - shape.append(1); shape.append(2); + shape.append(1); let mut data = ArrayTrait::new(); data.append(0); diff --git a/tests/nodes/argmax_negative_axis_keepdims_select_last_index.cairo b/tests/nodes/argmax_negative_axis_keepdims_select_last_index.cairo new file mode 100644 index 000000000..92c5f9f10 --- /dev/null +++ b/tests/nodes/argmax_negative_axis_keepdims_select_last_index.cairo @@ -0,0 +1,22 @@ +mod input_0; +mod output_0; + + +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::I32TensorPartialEq; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::operators::tensor::FP16x16TensorPartialEq; + +#[test] +#[available_gas(2000000000)] +fn test_argmax_negative_axis_keepdims_select_last_index() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let y_0 = input_0.argmax(-1, Option::Some(true), Option::Some(true)); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/argmax_negative_axis_keepdims_select_last_index/input_0.cairo b/tests/nodes/argmax_negative_axis_keepdims_select_last_index/input_0.cairo new file mode 100644 index 000000000..c0673e50d --- /dev/null +++ b/tests/nodes/argmax_negative_axis_keepdims_select_last_index/input_0.cairo @@ -0,0 +1,17 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(2); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 2, sign: false }); + data.append(FP16x16 { mag: 2, sign: false }); + data.append(FP16x16 { mag: 3, sign: false }); + data.append(FP16x16 { mag: 10, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/argmax_negative_axis_keepdims_select_last_index/output_0.cairo b/tests/nodes/argmax_negative_axis_keepdims_select_last_index/output_0.cairo new file mode 100644 index 000000000..241b14b08 --- /dev/null +++ b/tests/nodes/argmax_negative_axis_keepdims_select_last_index/output_0.cairo @@ -0,0 +1,15 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(2); + shape.append(1); + + let mut data = ArrayTrait::new(); + data.append(1); + data.append(1); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/argmax_no_keepdims.cairo b/tests/nodes/argmax_no_keepdims.cairo new file mode 100644 index 000000000..c278fee35 --- /dev/null +++ b/tests/nodes/argmax_no_keepdims.cairo @@ -0,0 +1,22 @@ +mod input_0; +mod output_0; + + +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::I32TensorPartialEq; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::operators::tensor::FP16x16TensorPartialEq; + +#[test] +#[available_gas(2000000000)] +fn test_argmax_no_keepdims() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let y_0 = input_0.argmax(1, Option::Some(false), Option::None(())); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/argmax_no_keepdims/input_0.cairo b/tests/nodes/argmax_no_keepdims/input_0.cairo new file mode 100644 index 000000000..2bd0e9ded --- /dev/null +++ b/tests/nodes/argmax_no_keepdims/input_0.cairo @@ -0,0 +1,17 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(2); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 2, sign: false }); + data.append(FP16x16 { mag: 1, sign: false }); + data.append(FP16x16 { mag: 3, sign: false }); + data.append(FP16x16 { mag: 10, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/reduce_sum_i32_2D_axis_1/output_0.cairo b/tests/nodes/argmax_no_keepdims/output_0.cairo similarity index 73% rename from tests/nodes/reduce_sum_i32_2D_axis_1/output_0.cairo rename to tests/nodes/argmax_no_keepdims/output_0.cairo index bb1a0e727..ed50e53b0 100644 --- a/tests/nodes/reduce_sum_i32_2D_axis_1/output_0.cairo +++ b/tests/nodes/argmax_no_keepdims/output_0.cairo @@ -1,13 +1,14 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorMul}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(2); let mut data = ArrayTrait::new(); + data.append(0); data.append(1); - data.append(5); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/argmax_no_keepdims_select_last_index.cairo b/tests/nodes/argmax_no_keepdims_select_last_index.cairo new file mode 100644 index 000000000..5233204eb --- /dev/null +++ b/tests/nodes/argmax_no_keepdims_select_last_index.cairo @@ -0,0 +1,22 @@ +mod input_0; +mod output_0; + + +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::I32TensorPartialEq; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::operators::tensor::FP16x16TensorPartialEq; + +#[test] +#[available_gas(2000000000)] +fn test_argmax_no_keepdims_select_last_index() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let y_0 = input_0.argmax(1, Option::Some(false), Option::Some(true)); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/argmax_no_keepdims_select_last_index/input_0.cairo b/tests/nodes/argmax_no_keepdims_select_last_index/input_0.cairo new file mode 100644 index 000000000..c0673e50d --- /dev/null +++ b/tests/nodes/argmax_no_keepdims_select_last_index/input_0.cairo @@ -0,0 +1,17 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(2); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 2, sign: false }); + data.append(FP16x16 { mag: 2, sign: false }); + data.append(FP16x16 { mag: 3, sign: false }); + data.append(FP16x16 { mag: 10, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/argmax_no_keepdims_select_last_index/output_0.cairo b/tests/nodes/argmax_no_keepdims_select_last_index/output_0.cairo new file mode 100644 index 000000000..29a921caf --- /dev/null +++ b/tests/nodes/argmax_no_keepdims_select_last_index/output_0.cairo @@ -0,0 +1,14 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(1); + data.append(1); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/argmax_u32_1D_default/input_0.cairo b/tests/nodes/argmax_u32_1D_default/input_0.cairo deleted file mode 100644 index d02f0a9a5..000000000 --- a/tests/nodes/argmax_u32_1D_default/input_0.cairo +++ /dev/null @@ -1,14 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(244); - data.append(135); - data.append(53); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_u32_1D_default/output_0.cairo b/tests/nodes/argmax_u32_1D_default/output_0.cairo deleted file mode 100644 index e4dbc507c..000000000 --- a/tests/nodes/argmax_u32_1D_default/output_0.cairo +++ /dev/null @@ -1,12 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - - let mut data = ArrayTrait::new(); - data.append(0); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_u32_1D_keepdims_false.cairo b/tests/nodes/argmax_u32_1D_keepdims_false.cairo deleted file mode 100644 index aa6555d1c..000000000 --- a/tests/nodes/argmax_u32_1D_keepdims_false.cairo +++ /dev/null @@ -1,20 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_u32_1D_keepdims_false() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::Some(false), Option::None(())); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_u32_1D_keepdims_false/input_0.cairo b/tests/nodes/argmax_u32_1D_keepdims_false/input_0.cairo deleted file mode 100644 index 161945ea0..000000000 --- a/tests/nodes/argmax_u32_1D_keepdims_false/input_0.cairo +++ /dev/null @@ -1,14 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(89); - data.append(33); - data.append(140); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_u32_1D_keepdims_false/output_0.cairo b/tests/nodes/argmax_u32_1D_keepdims_false/output_0.cairo deleted file mode 100644 index 23846d97b..000000000 --- a/tests/nodes/argmax_u32_1D_keepdims_false/output_0.cairo +++ /dev/null @@ -1,12 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - - let mut data = ArrayTrait::new(); - data.append(2); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_u32_1D_last_index.cairo b/tests/nodes/argmax_u32_1D_last_index.cairo deleted file mode 100644 index e6ad1f332..000000000 --- a/tests/nodes/argmax_u32_1D_last_index.cairo +++ /dev/null @@ -1,20 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_u32_1D_last_index() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::None(()), Option::Some(true)); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_u32_1D_last_index/input_0.cairo b/tests/nodes/argmax_u32_1D_last_index/input_0.cairo deleted file mode 100644 index caad0d75f..000000000 --- a/tests/nodes/argmax_u32_1D_last_index/input_0.cairo +++ /dev/null @@ -1,14 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(63); - data.append(40); - data.append(22); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_u32_1D_last_index/output_0.cairo b/tests/nodes/argmax_u32_1D_last_index/output_0.cairo deleted file mode 100644 index e4dbc507c..000000000 --- a/tests/nodes/argmax_u32_1D_last_index/output_0.cairo +++ /dev/null @@ -1,12 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - - let mut data = ArrayTrait::new(); - data.append(0); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_u32_2D_default.cairo b/tests/nodes/argmax_u32_2D_default.cairo deleted file mode 100644 index 9c9a285bd..000000000 --- a/tests/nodes/argmax_u32_2D_default.cairo +++ /dev/null @@ -1,20 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_u32_2D_default() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::None(()), Option::None(())); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_u32_2D_default/input_0.cairo b/tests/nodes/argmax_u32_2D_default/input_0.cairo deleted file mode 100644 index e6678379b..000000000 --- a/tests/nodes/argmax_u32_2D_default/input_0.cairo +++ /dev/null @@ -1,16 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(51); - data.append(202); - data.append(164); - data.append(83); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_u32_2D_default/output_0.cairo b/tests/nodes/argmax_u32_2D_default/output_0.cairo deleted file mode 100644 index 221e8a246..000000000 --- a/tests/nodes/argmax_u32_2D_default/output_0.cairo +++ /dev/null @@ -1,14 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(1); - data.append(0); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_u32_2D_keepdims_false.cairo b/tests/nodes/argmax_u32_2D_keepdims_false.cairo deleted file mode 100644 index 8bfa99454..000000000 --- a/tests/nodes/argmax_u32_2D_keepdims_false.cairo +++ /dev/null @@ -1,20 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_u32_2D_keepdims_false() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::Some(false), Option::None(())); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_u32_2D_keepdims_false/input_0.cairo b/tests/nodes/argmax_u32_2D_keepdims_false/input_0.cairo deleted file mode 100644 index 19a457838..000000000 --- a/tests/nodes/argmax_u32_2D_keepdims_false/input_0.cairo +++ /dev/null @@ -1,16 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(207); - data.append(36); - data.append(209); - data.append(4); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_u32_2D_keepdims_false/output_0.cairo b/tests/nodes/argmax_u32_2D_keepdims_false/output_0.cairo deleted file mode 100644 index edc68637b..000000000 --- a/tests/nodes/argmax_u32_2D_keepdims_false/output_0.cairo +++ /dev/null @@ -1,13 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(1); - data.append(0); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_u32_2D_last_index.cairo b/tests/nodes/argmax_u32_2D_last_index.cairo deleted file mode 100644 index 60b70f828..000000000 --- a/tests/nodes/argmax_u32_2D_last_index.cairo +++ /dev/null @@ -1,20 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_u32_2D_last_index() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::None(()), Option::Some(true)); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_u32_2D_last_index/input_0.cairo b/tests/nodes/argmax_u32_2D_last_index/input_0.cairo deleted file mode 100644 index 0f577ecf4..000000000 --- a/tests/nodes/argmax_u32_2D_last_index/input_0.cairo +++ /dev/null @@ -1,16 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(41); - data.append(93); - data.append(233); - data.append(71); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_u32_2D_last_index/output_0.cairo b/tests/nodes/argmax_u32_2D_last_index/output_0.cairo deleted file mode 100644 index 221e8a246..000000000 --- a/tests/nodes/argmax_u32_2D_last_index/output_0.cairo +++ /dev/null @@ -1,14 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(1); - data.append(0); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_u32_3D_default.cairo b/tests/nodes/argmax_u32_3D_default.cairo deleted file mode 100644 index f9f47d2fd..000000000 --- a/tests/nodes/argmax_u32_3D_default.cairo +++ /dev/null @@ -1,20 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_u32_3D_default() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::None(()), Option::None(())); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_u32_3D_default/input_0.cairo b/tests/nodes/argmax_u32_3D_default/input_0.cairo deleted file mode 100644 index 83343807d..000000000 --- a/tests/nodes/argmax_u32_3D_default/input_0.cairo +++ /dev/null @@ -1,21 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(22); - data.append(254); - data.append(48); - data.append(151); - data.append(21); - data.append(13); - data.append(254); - data.append(100); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_u32_3D_keepdims_false.cairo b/tests/nodes/argmax_u32_3D_keepdims_false.cairo deleted file mode 100644 index 7ee7d2aad..000000000 --- a/tests/nodes/argmax_u32_3D_keepdims_false.cairo +++ /dev/null @@ -1,20 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_u32_3D_keepdims_false() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::Some(false), Option::None(())); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_u32_3D_keepdims_false/input_0.cairo b/tests/nodes/argmax_u32_3D_keepdims_false/input_0.cairo deleted file mode 100644 index 4842ff00c..000000000 --- a/tests/nodes/argmax_u32_3D_keepdims_false/input_0.cairo +++ /dev/null @@ -1,21 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(183); - data.append(138); - data.append(72); - data.append(104); - data.append(239); - data.append(185); - data.append(16); - data.append(188); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_u32_3D_keepdims_false/output_0.cairo b/tests/nodes/argmax_u32_3D_keepdims_false/output_0.cairo deleted file mode 100644 index 15d30cb7a..000000000 --- a/tests/nodes/argmax_u32_3D_keepdims_false/output_0.cairo +++ /dev/null @@ -1,16 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(1); - data.append(1); - data.append(0); - data.append(1); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_u32_3D_last_index.cairo b/tests/nodes/argmax_u32_3D_last_index.cairo deleted file mode 100644 index 8098105e1..000000000 --- a/tests/nodes/argmax_u32_3D_last_index.cairo +++ /dev/null @@ -1,20 +0,0 @@ -mod input_0; -mod output_0; - - -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_argmax_u32_3D_last_index() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.argmax(0, Option::None(()), Option::Some(true)); - - assert_eq(y, z); -} diff --git a/tests/nodes/argmax_u32_3D_last_index/input_0.cairo b/tests/nodes/argmax_u32_3D_last_index/input_0.cairo deleted file mode 100644 index 2a464efd3..000000000 --- a/tests/nodes/argmax_u32_3D_last_index/input_0.cairo +++ /dev/null @@ -1,21 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(9); - data.append(169); - data.append(140); - data.append(99); - data.append(130); - data.append(132); - data.append(79); - data.append(57); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/argmax_u32_3D_last_index/output_0.cairo b/tests/nodes/argmax_u32_3D_last_index/output_0.cairo deleted file mode 100644 index 217f9ee86..000000000 --- a/tests/nodes/argmax_u32_3D_last_index/output_0.cairo +++ /dev/null @@ -1,17 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(1); - data.append(0); - data.append(0); - data.append(0); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/conv_2D_with_autopad_same.cairo b/tests/nodes/conv_2D_with_autopad_same.cairo index b3c88bdf4..aa0816386 100644 --- a/tests/nodes/conv_2D_with_autopad_same.cairo +++ b/tests/nodes/conv_2D_with_autopad_same.cairo @@ -9,7 +9,7 @@ use orion::utils::{assert_eq, assert_seq_eq}; use orion::operators::tensor::FP16x16TensorPartialEq; use orion::operators::nn::FP16x16NN; -use orion::operators::nn::functional::conv::AUTO_PAD; +use orion::operators::nn::AUTO_PAD; #[test] #[available_gas(2000000000)] diff --git a/tests/nodes/deform_conv.cairo b/tests/nodes/deform_conv.cairo new file mode 100644 index 000000000..4568731a7 --- /dev/null +++ b/tests/nodes/deform_conv.cairo @@ -0,0 +1,36 @@ +mod input_0; +mod input_1; +mod input_2; +mod output_0; + + +use orion::numbers::FixedTrait; +use orion::operators::nn::NNTrait; +use orion::operators::nn::FP16x16NN; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::FP16x16TensorPartialEq; + +#[test] +#[available_gas(2000000000)] +fn test_deform_conv() { + let input_0 = input_0::input_0(); + let input_1 = input_1::input_1(); + let input_2 = input_2::input_2(); + let z_0 = output_0::output_0(); + + let y_0 = NNTrait::deform_conv( + @input_0, + @input_1, + @input_2, + Option::None, + Option::None, + Option::None, + Option::None, + Option::Some(array![2, 2].span()), + Option::None, + Option::None, + Option::None + ); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/deform_conv/input_0.cairo b/tests/nodes/deform_conv/input_0.cairo new file mode 100644 index 000000000..5208e1993 --- /dev/null +++ b/tests/nodes/deform_conv/input_0.cairo @@ -0,0 +1,24 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(1); + shape.append(3); + shape.append(3); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 262144, sign: false }); + data.append(FP16x16 { mag: 327680, sign: false }); + data.append(FP16x16 { mag: 393216, sign: false }); + data.append(FP16x16 { mag: 458752, sign: false }); + data.append(FP16x16 { mag: 524288, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/deform_conv/input_1.cairo b/tests/nodes/deform_conv/input_1.cairo new file mode 100644 index 000000000..fd236fd56 --- /dev/null +++ b/tests/nodes/deform_conv/input_1.cairo @@ -0,0 +1,19 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_1() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(1); + shape.append(2); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/deform_conv/input_2.cairo b/tests/nodes/deform_conv/input_2.cairo new file mode 100644 index 000000000..f292a30c7 --- /dev/null +++ b/tests/nodes/deform_conv/input_2.cairo @@ -0,0 +1,47 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_2() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(8); + shape.append(2); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 32768, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 6553, sign: true }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/deform_conv/output_0.cairo b/tests/nodes/deform_conv/output_0.cairo new file mode 100644 index 000000000..0405486ac --- /dev/null +++ b/tests/nodes/deform_conv/output_0.cairo @@ -0,0 +1,19 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(1); + shape.append(2); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 622592, sign: false }); + data.append(FP16x16 { mag: 779878, sign: false }); + data.append(FP16x16 { mag: 1310720, sign: false }); + data.append(FP16x16 { mag: 1572864, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/deform_conv_with_mask_bias.cairo b/tests/nodes/deform_conv_with_mask_bias.cairo new file mode 100644 index 000000000..2627fa720 --- /dev/null +++ b/tests/nodes/deform_conv_with_mask_bias.cairo @@ -0,0 +1,40 @@ +mod input_0; +mod input_1; +mod input_2; +mod input_3; +mod input_4; +mod output_0; + + +use orion::numbers::FixedTrait; +use orion::operators::nn::NNTrait; +use orion::operators::nn::FP16x16NN; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::FP16x16TensorPartialEq; + +#[test] +#[available_gas(2000000000)] +fn test_deform_conv_with_mask_bias() { + let input_0 = input_0::input_0(); + let input_1 = input_1::input_1(); + let input_2 = input_2::input_2(); + let input_3 = input_3::input_3(); + let input_4 = input_4::input_4(); + let z_0 = output_0::output_0(); + + let y_0 = NNTrait::deform_conv( + @input_0, + @input_1, + @input_2, + Option::Some(input_3.data), + Option::Some(input_4), + Option::None, + Option::None, + Option::Some(array![2, 2].span()), + Option::None, + Option::None, + Option::None + ); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/deform_conv_with_mask_bias/input_0.cairo b/tests/nodes/deform_conv_with_mask_bias/input_0.cairo new file mode 100644 index 000000000..5208e1993 --- /dev/null +++ b/tests/nodes/deform_conv_with_mask_bias/input_0.cairo @@ -0,0 +1,24 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(1); + shape.append(3); + shape.append(3); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 262144, sign: false }); + data.append(FP16x16 { mag: 327680, sign: false }); + data.append(FP16x16 { mag: 393216, sign: false }); + data.append(FP16x16 { mag: 458752, sign: false }); + data.append(FP16x16 { mag: 524288, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/deform_conv_with_mask_bias/input_1.cairo b/tests/nodes/deform_conv_with_mask_bias/input_1.cairo new file mode 100644 index 000000000..fd236fd56 --- /dev/null +++ b/tests/nodes/deform_conv_with_mask_bias/input_1.cairo @@ -0,0 +1,19 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_1() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(1); + shape.append(2); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/deform_conv_with_mask_bias/input_2.cairo b/tests/nodes/deform_conv_with_mask_bias/input_2.cairo new file mode 100644 index 000000000..f292a30c7 --- /dev/null +++ b/tests/nodes/deform_conv_with_mask_bias/input_2.cairo @@ -0,0 +1,47 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_2() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(8); + shape.append(2); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 32768, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 6553, sign: true }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/reduce_sum_fp16x16_1D/output_0.cairo b/tests/nodes/deform_conv_with_mask_bias/input_3.cairo similarity index 65% rename from tests/nodes/reduce_sum_fp16x16_1D/output_0.cairo rename to tests/nodes/deform_conv_with_mask_bias/input_3.cairo index a2e4a88f1..805491b57 100644 --- a/tests/nodes/reduce_sum_fp16x16_1D/output_0.cairo +++ b/tests/nodes/deform_conv_with_mask_bias/input_3.cairo @@ -1,13 +1,13 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorMul}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; use orion::numbers::{FixedTrait, FP16x16}; -fn output_0() -> Tensor { +fn input_3() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(1); let mut data = ArrayTrait::new(); - data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/deform_conv_with_mask_bias/input_4.cairo b/tests/nodes/deform_conv_with_mask_bias/input_4.cairo new file mode 100644 index 000000000..13381e7f3 --- /dev/null +++ b/tests/nodes/deform_conv_with_mask_bias/input_4.cairo @@ -0,0 +1,31 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_4() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(4); + shape.append(2); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 13107, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/deform_conv_with_mask_bias/output_0.cairo b/tests/nodes/deform_conv_with_mask_bias/output_0.cairo new file mode 100644 index 000000000..4e2ac6dc2 --- /dev/null +++ b/tests/nodes/deform_conv_with_mask_bias/output_0.cairo @@ -0,0 +1,19 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(1); + shape.append(2); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 688128, sign: false }); + data.append(FP16x16 { mag: 845414, sign: false }); + data.append(FP16x16 { mag: 1376256, sign: false }); + data.append(FP16x16 { mag: 1271398, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/deform_conv_with_multiple_offset_groups.cairo b/tests/nodes/deform_conv_with_multiple_offset_groups.cairo new file mode 100644 index 000000000..91840d1c4 --- /dev/null +++ b/tests/nodes/deform_conv_with_multiple_offset_groups.cairo @@ -0,0 +1,36 @@ +mod input_0; +mod input_1; +mod input_2; +mod output_0; + + +use orion::numbers::FixedTrait; +use orion::operators::nn::NNTrait; +use orion::operators::nn::FP16x16NN; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::FP16x16TensorPartialEq; + +#[test] +#[available_gas(2000000000)] +fn test_deform_conv_with_multiple_offset_groups() { + let input_0 = input_0::input_0(); + let input_1 = input_1::input_1(); + let input_2 = input_2::input_2(); + let z_0 = output_0::output_0(); + + let y_0 = NNTrait::deform_conv( + @input_0, + @input_1, + @input_2, + Option::None, + Option::None, + Option::None, + Option::None, + Option::Some(array![2, 2].span()), + Option::Some(2), + Option::None, + Option::None + ); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/deform_conv_with_multiple_offset_groups/input_0.cairo b/tests/nodes/deform_conv_with_multiple_offset_groups/input_0.cairo new file mode 100644 index 000000000..e628eeb6d --- /dev/null +++ b/tests/nodes/deform_conv_with_multiple_offset_groups/input_0.cairo @@ -0,0 +1,33 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(2); + shape.append(3); + shape.append(3); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 262144, sign: false }); + data.append(FP16x16 { mag: 327680, sign: false }); + data.append(FP16x16 { mag: 393216, sign: false }); + data.append(FP16x16 { mag: 458752, sign: false }); + data.append(FP16x16 { mag: 524288, sign: false }); + data.append(FP16x16 { mag: 524288, sign: false }); + data.append(FP16x16 { mag: 458752, sign: false }); + data.append(FP16x16 { mag: 393216, sign: false }); + data.append(FP16x16 { mag: 327680, sign: false }); + data.append(FP16x16 { mag: 262144, sign: false }); + data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/deform_conv_with_multiple_offset_groups/input_1.cairo b/tests/nodes/deform_conv_with_multiple_offset_groups/input_1.cairo new file mode 100644 index 000000000..a6c0269ea --- /dev/null +++ b/tests/nodes/deform_conv_with_multiple_offset_groups/input_1.cairo @@ -0,0 +1,23 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_1() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(2); + shape.append(2); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/deform_conv_with_multiple_offset_groups/input_2.cairo b/tests/nodes/deform_conv_with_multiple_offset_groups/input_2.cairo new file mode 100644 index 000000000..1c59d0824 --- /dev/null +++ b/tests/nodes/deform_conv_with_multiple_offset_groups/input_2.cairo @@ -0,0 +1,79 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_2() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(16); + shape.append(2); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 32768, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 6553, sign: true }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/deform_conv_with_multiple_offset_groups/output_0.cairo b/tests/nodes/deform_conv_with_multiple_offset_groups/output_0.cairo new file mode 100644 index 000000000..9483db7b7 --- /dev/null +++ b/tests/nodes/deform_conv_with_multiple_offset_groups/output_0.cairo @@ -0,0 +1,19 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(1); + shape.append(2); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 2195456, sign: false }); + data.append(FP16x16 { mag: 2103705, sign: false }); + data.append(FP16x16 { mag: 2097152, sign: false }); + data.append(FP16x16 { mag: 2097152, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/deform_conv_with_padding.cairo b/tests/nodes/deform_conv_with_padding.cairo new file mode 100644 index 000000000..553b33a28 --- /dev/null +++ b/tests/nodes/deform_conv_with_padding.cairo @@ -0,0 +1,36 @@ +mod input_0; +mod input_1; +mod input_2; +mod output_0; + + +use orion::numbers::FixedTrait; +use orion::operators::nn::NNTrait; +use orion::operators::nn::FP16x16NN; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::FP16x16TensorPartialEq; + +#[test] +#[available_gas(2000000000)] +fn test_deform_conv_with_padding() { + let input_0 = input_0::input_0(); + let input_1 = input_1::input_1(); + let input_2 = input_2::input_2(); + let z_0 = output_0::output_0(); + + let y_0 = NNTrait::deform_conv( + @input_0, + @input_1, + @input_2, + Option::None, + Option::None, + Option::None, + Option::None, + Option::Some(array![2, 2].span()), + Option::None, + Option::Some(array![1, 1, 1, 1].span()), + Option::None + ); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/deform_conv_with_padding/input_0.cairo b/tests/nodes/deform_conv_with_padding/input_0.cairo new file mode 100644 index 000000000..5208e1993 --- /dev/null +++ b/tests/nodes/deform_conv_with_padding/input_0.cairo @@ -0,0 +1,24 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(1); + shape.append(3); + shape.append(3); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 262144, sign: false }); + data.append(FP16x16 { mag: 327680, sign: false }); + data.append(FP16x16 { mag: 393216, sign: false }); + data.append(FP16x16 { mag: 458752, sign: false }); + data.append(FP16x16 { mag: 524288, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/deform_conv_with_padding/input_1.cairo b/tests/nodes/deform_conv_with_padding/input_1.cairo new file mode 100644 index 000000000..fd236fd56 --- /dev/null +++ b/tests/nodes/deform_conv_with_padding/input_1.cairo @@ -0,0 +1,19 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_1() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(1); + shape.append(2); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/deform_conv_with_padding/input_2.cairo b/tests/nodes/deform_conv_with_padding/input_2.cairo new file mode 100644 index 000000000..1c854d398 --- /dev/null +++ b/tests/nodes/deform_conv_with_padding/input_2.cairo @@ -0,0 +1,143 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_2() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(8); + shape.append(4); + shape.append(4); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 32768, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 6553, sign: true }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/deform_conv_with_padding/output_0.cairo b/tests/nodes/deform_conv_with_padding/output_0.cairo new file mode 100644 index 000000000..a5444d5fd --- /dev/null +++ b/tests/nodes/deform_conv_with_padding/output_0.cairo @@ -0,0 +1,31 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(1); + shape.append(4); + shape.append(4); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 524288, sign: false }); + data.append(FP16x16 { mag: 779878, sign: false }); + data.append(FP16x16 { mag: 458752, sign: false }); + data.append(FP16x16 { mag: 589824, sign: false }); + data.append(FP16x16 { mag: 1310720, sign: false }); + data.append(FP16x16 { mag: 1572864, sign: false }); + data.append(FP16x16 { mag: 851968, sign: false }); + data.append(FP16x16 { mag: 393216, sign: false }); + data.append(FP16x16 { mag: 851968, sign: false }); + data.append(FP16x16 { mag: 983040, sign: false }); + data.append(FP16x16 { mag: 524288, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/gather_i8_3d_axis1.cairo b/tests/nodes/export_center_crop_pad_crop.cairo similarity index 54% rename from tests/nodes/gather_i8_3d_axis1.cairo rename to tests/nodes/export_center_crop_pad_crop.cairo index 140608123..b2c58a6c8 100644 --- a/tests/nodes/gather_i8_3d_axis1.cairo +++ b/tests/nodes/export_center_crop_pad_crop.cairo @@ -1,24 +1,21 @@ mod input_0; -mod input_1; mod output_0; -use orion::operators::tensor::I8TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::operators::tensor::Complex64Tensor; use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{I8Tensor, I8TensorAdd}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::U32TensorPartialEq; +use orion::operators::tensor::Complex64TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; #[test] #[available_gas(2000000000)] -fn test_gather_i8_3d_axis1() { +fn test_export_center_crop_pad_crop() { let input_0 = input_0::input_0(); - let input_1 = input_1::input_1(); let z_0 = output_0::output_0(); - let y_0 = input_0.gather(indices: input_1, axis: Option::Some(1)); + let y_0 = input_0.center_crop_pad(TensorTrait::new(array![3].span(), array![10,7,3].span()), Option::None(())); assert_eq(y_0, z_0); } diff --git a/tests/nodes/export_center_crop_pad_crop/input_0.cairo b/tests/nodes/export_center_crop_pad_crop/input_0.cairo new file mode 100644 index 000000000..39bef3eb6 --- /dev/null +++ b/tests/nodes/export_center_crop_pad_crop/input_0.cairo @@ -0,0 +1,616 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::Complex64Tensor; +use orion::numbers::{NumberTrait, complex64}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::numbers::{FixedTrait, FP64x64}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(20); + shape.append(10); + shape.append(3); + + let mut data = ArrayTrait::new(); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 3, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 4, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 5, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 6, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 7, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 8, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 9, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 10, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 11, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 12, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 13, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 14, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 15, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 16, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 17, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 18, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 19, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 20, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 21, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 22, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 23, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 24, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 25, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 26, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 27, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 28, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 29, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 30, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 31, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 32, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 33, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 34, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 35, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 36, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 37, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 38, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 39, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 40, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 41, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 42, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 43, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 44, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 45, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 46, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 47, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 48, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 49, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 50, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 51, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 52, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 53, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 54, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 55, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 56, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 57, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 58, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 59, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 60, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 61, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 62, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 63, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 64, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 65, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 66, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 67, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 68, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 69, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 70, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 71, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 72, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 73, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 74, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 75, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 76, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 77, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 78, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 79, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 80, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 81, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 82, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 83, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 84, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 85, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 86, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 87, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 88, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 89, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 90, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 91, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 92, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 93, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 94, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 95, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 96, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 97, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 98, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 99, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 100, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 101, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 102, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 103, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 104, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 105, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 106, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 107, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 108, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 109, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 110, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 111, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 112, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 113, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 114, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 115, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 116, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 117, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 118, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 119, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 120, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 121, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 122, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 123, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 124, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 125, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 126, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 127, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 128, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 129, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 130, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 131, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 132, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 133, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 134, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 135, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 136, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 137, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 138, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 139, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 140, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 141, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 142, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 143, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 144, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 145, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 146, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 147, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 148, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 149, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 150, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 151, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 152, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 153, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 154, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 155, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 156, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 157, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 158, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 159, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 160, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 161, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 162, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 163, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 164, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 165, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 166, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 167, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 168, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 169, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 170, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 171, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 172, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 173, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 174, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 175, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 176, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 177, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 178, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 179, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 180, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 181, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 182, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 183, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 184, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 185, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 186, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 187, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 188, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 189, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 190, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 191, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 192, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 193, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 194, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 195, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 196, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 197, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 198, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 199, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 200, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 201, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 202, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 203, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 204, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 205, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 206, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 207, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 208, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 209, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 210, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 211, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 212, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 213, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 214, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 215, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 216, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 217, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 218, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 219, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 220, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 221, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 222, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 223, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 224, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 225, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 226, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 227, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 228, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 229, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 230, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 231, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 232, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 233, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 234, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 235, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 236, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 237, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 238, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 239, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 240, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 241, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 242, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 243, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 244, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 245, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 246, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 247, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 248, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 249, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 250, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 251, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 252, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 253, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 254, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 255, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 256, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 257, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 258, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 259, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 260, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 261, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 262, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 263, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 264, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 265, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 266, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 267, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 268, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 269, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 270, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 271, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 272, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 273, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 274, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 275, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 276, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 277, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 278, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 279, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 280, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 281, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 282, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 283, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 284, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 285, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 286, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 287, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 288, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 289, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 290, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 291, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 292, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 293, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 294, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 295, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 296, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 297, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 298, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 299, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 300, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 301, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 302, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 303, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 304, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 305, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 306, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 307, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 308, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 309, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 310, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 311, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 312, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 313, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 314, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 315, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 316, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 317, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 318, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 319, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 320, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 321, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 322, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 323, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 324, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 325, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 326, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 327, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 328, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 329, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 330, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 331, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 332, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 333, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 334, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 335, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 336, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 337, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 338, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 339, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 340, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 341, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 342, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 343, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 344, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 345, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 346, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 347, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 348, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 349, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 350, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 351, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 352, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 353, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 354, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 355, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 356, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 357, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 358, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 359, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 360, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 361, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 362, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 363, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 364, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 365, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 366, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 367, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 368, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 369, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 370, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 371, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 372, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 373, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 374, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 375, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 376, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 377, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 378, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 379, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 380, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 381, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 382, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 383, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 384, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 385, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 386, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 387, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 388, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 389, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 390, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 391, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 392, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 393, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 394, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 395, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 396, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 397, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 398, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 399, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 400, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 401, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 402, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 403, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 404, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 405, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 406, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 407, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 408, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 409, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 410, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 411, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 412, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 413, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 414, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 415, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 416, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 417, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 418, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 419, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 420, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 421, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 422, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 423, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 424, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 425, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 426, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 427, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 428, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 429, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 430, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 431, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 432, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 433, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 434, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 435, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 436, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 437, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 438, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 439, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 440, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 441, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 442, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 443, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 444, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 445, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 446, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 447, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 448, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 449, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 450, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 451, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 452, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 453, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 454, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 455, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 456, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 457, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 458, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 459, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 460, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 461, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 462, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 463, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 464, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 465, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 466, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 467, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 468, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 469, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 470, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 471, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 472, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 473, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 474, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 475, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 476, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 477, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 478, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 479, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 480, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 481, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 482, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 483, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 484, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 485, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 486, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 487, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 488, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 489, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 490, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 491, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 492, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 493, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 494, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 495, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 496, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 497, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 498, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 499, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 500, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 501, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 502, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 503, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 504, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 505, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 506, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 507, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 508, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 509, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 510, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 511, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 512, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 513, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 514, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 515, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 516, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 517, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 518, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 519, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 520, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 521, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 522, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 523, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 524, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 525, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 526, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 527, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 528, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 529, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 530, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 531, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 532, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 533, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 534, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 535, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 536, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 537, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 538, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 539, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 540, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 541, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 542, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 543, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 544, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 545, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 546, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 547, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 548, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 549, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 550, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 551, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 552, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 553, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 554, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 555, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 556, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 557, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 558, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 559, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 560, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 561, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 562, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 563, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 564, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 565, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 566, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 567, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 568, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 569, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 570, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 571, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 572, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 573, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 574, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 575, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 576, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 577, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 578, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 579, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 580, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 581, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 582, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 583, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 584, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 585, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 586, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 587, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 588, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 589, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 590, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 591, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 592, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 593, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 594, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 595, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 596, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 597, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 598, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 599, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/export_center_crop_pad_crop/output_0.cairo b/tests/nodes/export_center_crop_pad_crop/output_0.cairo new file mode 100644 index 000000000..74def2b6f --- /dev/null +++ b/tests/nodes/export_center_crop_pad_crop/output_0.cairo @@ -0,0 +1,226 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::Complex64Tensor; +use orion::numbers::{NumberTrait, complex64}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::numbers::{FixedTrait, FP64x64}; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(10); + shape.append(7); + shape.append(3); + + let mut data = ArrayTrait::new(); + data.append(complex64 { real: FP64x64 { mag: 153, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 154, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 155, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 156, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 157, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 158, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 159, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 160, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 161, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 162, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 163, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 164, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 165, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 166, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 167, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 168, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 169, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 170, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 171, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 172, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 173, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 183, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 184, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 185, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 186, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 187, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 188, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 189, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 190, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 191, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 192, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 193, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 194, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 195, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 196, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 197, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 198, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 199, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 200, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 201, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 202, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 203, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 213, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 214, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 215, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 216, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 217, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 218, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 219, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 220, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 221, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 222, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 223, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 224, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 225, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 226, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 227, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 228, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 229, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 230, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 231, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 232, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 233, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 243, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 244, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 245, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 246, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 247, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 248, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 249, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 250, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 251, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 252, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 253, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 254, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 255, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 256, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 257, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 258, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 259, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 260, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 261, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 262, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 263, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 273, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 274, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 275, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 276, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 277, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 278, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 279, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 280, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 281, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 282, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 283, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 284, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 285, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 286, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 287, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 288, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 289, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 290, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 291, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 292, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 293, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 303, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 304, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 305, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 306, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 307, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 308, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 309, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 310, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 311, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 312, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 313, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 314, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 315, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 316, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 317, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 318, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 319, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 320, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 321, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 322, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 323, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 333, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 334, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 335, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 336, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 337, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 338, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 339, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 340, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 341, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 342, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 343, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 344, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 345, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 346, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 347, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 348, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 349, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 350, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 351, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 352, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 353, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 363, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 364, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 365, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 366, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 367, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 368, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 369, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 370, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 371, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 372, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 373, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 374, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 375, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 376, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 377, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 378, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 379, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 380, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 381, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 382, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 383, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 393, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 394, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 395, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 396, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 397, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 398, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 399, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 400, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 401, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 402, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 403, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 404, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 405, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 406, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 407, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 408, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 409, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 410, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 411, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 412, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 413, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 423, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 424, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 425, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 426, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 427, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 428, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 429, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 430, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 431, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 432, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 433, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 434, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 435, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 436, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 437, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 438, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 439, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 440, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 441, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 442, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 443, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/export_center_crop_pad_crop_and_pad.cairo b/tests/nodes/export_center_crop_pad_crop_and_pad.cairo new file mode 100644 index 000000000..aba03947f --- /dev/null +++ b/tests/nodes/export_center_crop_pad_crop_and_pad.cairo @@ -0,0 +1,21 @@ +mod input_0; +mod output_0; + + +use orion::operators::tensor::Complex64Tensor; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::Complex64TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; + +#[test] +#[available_gas(2000000000)] +fn test_export_center_crop_pad_crop_and_pad() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let y_0 = input_0.center_crop_pad(TensorTrait::new(array![3].span(), array![10,10,3].span()), Option::None(())); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/export_center_crop_pad_crop_and_pad/input_0.cairo b/tests/nodes/export_center_crop_pad_crop_and_pad/input_0.cairo new file mode 100644 index 000000000..eaca95f70 --- /dev/null +++ b/tests/nodes/export_center_crop_pad_crop_and_pad/input_0.cairo @@ -0,0 +1,497 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::Complex64Tensor; +use orion::numbers::{NumberTrait, complex64}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::numbers::{FixedTrait, FP64x64}; + + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(20); + shape.append(8); + shape.append(3); + + let mut data = ArrayTrait::new(); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 3, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 3, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 3, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/export_center_crop_pad_crop_and_pad/output_0.cairo b/tests/nodes/export_center_crop_pad_crop_and_pad/output_0.cairo new file mode 100644 index 000000000..87ca4d987 --- /dev/null +++ b/tests/nodes/export_center_crop_pad_crop_and_pad/output_0.cairo @@ -0,0 +1,317 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::Complex64Tensor; +use orion::numbers::{NumberTrait, complex64}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::numbers::{FixedTrait, FP64x64}; + + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(10); + shape.append(10); + shape.append(3); + + let mut data = ArrayTrait::new(); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 3, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/export_center_crop_pad_crop_axes_chw.cairo b/tests/nodes/export_center_crop_pad_crop_axes_chw.cairo new file mode 100644 index 000000000..4ebff18f3 --- /dev/null +++ b/tests/nodes/export_center_crop_pad_crop_axes_chw.cairo @@ -0,0 +1,21 @@ +mod input_0; +mod output_0; + + +use orion::operators::tensor::Complex64Tensor; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::Complex64TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; + +#[test] +#[available_gas(2000000000)] +fn test_export_center_crop_pad_crop_axes_chw() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let y_0 = input_0.center_crop_pad(TensorTrait::new(array![2].span(), array![10,9].span()), Option::Some(array![1,2])); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/export_center_crop_pad_crop_axes_chw/input_0.cairo b/tests/nodes/export_center_crop_pad_crop_axes_chw/input_0.cairo new file mode 100644 index 000000000..81c18ab9b --- /dev/null +++ b/tests/nodes/export_center_crop_pad_crop_axes_chw/input_0.cairo @@ -0,0 +1,497 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::Complex64Tensor; +use orion::numbers::{NumberTrait, complex64}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::numbers::{FixedTrait, FP64x64}; + + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(3); + shape.append(20); + shape.append(8); + + let mut data = ArrayTrait::new(); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 3, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/export_center_crop_pad_crop_axes_chw/output_0.cairo b/tests/nodes/export_center_crop_pad_crop_axes_chw/output_0.cairo new file mode 100644 index 000000000..3bbab318c --- /dev/null +++ b/tests/nodes/export_center_crop_pad_crop_axes_chw/output_0.cairo @@ -0,0 +1,287 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::Complex64Tensor; +use orion::numbers::{NumberTrait, complex64}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::numbers::{FixedTrait, FP64x64}; + + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(3); + shape.append(10); + shape.append(9); + + let mut data = ArrayTrait::new(); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 3, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/export_center_crop_pad_crop_axes_hwc.cairo b/tests/nodes/export_center_crop_pad_crop_axes_hwc.cairo new file mode 100644 index 000000000..57614ffc3 --- /dev/null +++ b/tests/nodes/export_center_crop_pad_crop_axes_hwc.cairo @@ -0,0 +1,21 @@ +mod input_0; +mod output_0; + + +use orion::operators::tensor::Complex64Tensor; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::Complex64TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; + +#[test] +#[available_gas(2000000000)] +fn test_export_center_crop_pad_crop_axes_hwc() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let y_0 = input_0.center_crop_pad(TensorTrait::new(array![2].span(), array![10,9].span()), Option::Some(array![0,1])); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/export_center_crop_pad_crop_axes_hwc/input_0.cairo b/tests/nodes/export_center_crop_pad_crop_axes_hwc/input_0.cairo new file mode 100644 index 000000000..921a724bc --- /dev/null +++ b/tests/nodes/export_center_crop_pad_crop_axes_hwc/input_0.cairo @@ -0,0 +1,496 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::Complex64Tensor; +use orion::numbers::{NumberTrait, complex64}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::numbers::{FixedTrait, FP64x64}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(20); + shape.append(8); + shape.append(3); + + let mut data = ArrayTrait::new(); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/export_center_crop_pad_crop_axes_hwc/output_0.cairo b/tests/nodes/export_center_crop_pad_crop_axes_hwc/output_0.cairo new file mode 100644 index 000000000..2cb7243c2 --- /dev/null +++ b/tests/nodes/export_center_crop_pad_crop_axes_hwc/output_0.cairo @@ -0,0 +1,286 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::Complex64Tensor; +use orion::numbers::{NumberTrait, complex64}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::numbers::{FixedTrait, FP64x64}; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(10); + shape.append(9); + shape.append(3); + + let mut data = ArrayTrait::new(); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/export_center_crop_pad_crop_negative_axes_hwc.cairo b/tests/nodes/export_center_crop_pad_crop_negative_axes_hwc.cairo new file mode 100644 index 000000000..470700a6e --- /dev/null +++ b/tests/nodes/export_center_crop_pad_crop_negative_axes_hwc.cairo @@ -0,0 +1,21 @@ +mod input_0; +mod output_0; + + +use orion::operators::tensor::Complex64Tensor; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::Complex64TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; + +#[test] +#[available_gas(2000000000)] +fn test_export_center_crop_pad_crop_negative_axes_hwc() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let y_0 = input_0.center_crop_pad(TensorTrait::new(array![2].span(), array![10,9].span()), Option::Some(array![-3,-2])); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/export_center_crop_pad_crop_negative_axes_hwc/input_0.cairo b/tests/nodes/export_center_crop_pad_crop_negative_axes_hwc/input_0.cairo new file mode 100644 index 000000000..1135d5849 --- /dev/null +++ b/tests/nodes/export_center_crop_pad_crop_negative_axes_hwc/input_0.cairo @@ -0,0 +1,496 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::Complex64Tensor; +use orion::numbers::{NumberTrait, complex64}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::numbers::{FixedTrait, FP64x64}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(20); + shape.append(8); + shape.append(3); + + let mut data = ArrayTrait::new(); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 3, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/export_center_crop_pad_crop_negative_axes_hwc/output_0.cairo b/tests/nodes/export_center_crop_pad_crop_negative_axes_hwc/output_0.cairo new file mode 100644 index 000000000..e8147ab2f --- /dev/null +++ b/tests/nodes/export_center_crop_pad_crop_negative_axes_hwc/output_0.cairo @@ -0,0 +1,287 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::Complex64Tensor; +use orion::numbers::{NumberTrait, complex64}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::numbers::{FixedTrait, FP64x64}; + + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(10); + shape.append(9); + shape.append(3); + + let mut data = ArrayTrait::new(); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: true } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/export_center_crop_pad_pad.cairo b/tests/nodes/export_center_crop_pad_pad.cairo new file mode 100644 index 000000000..0345cd023 --- /dev/null +++ b/tests/nodes/export_center_crop_pad_pad.cairo @@ -0,0 +1,21 @@ +mod input_0; +mod output_0; + + +use orion::operators::tensor::Complex64Tensor; +use orion::operators::tensor::Complex64TensorPartialEq; +use orion::operators::tensor::{TensorTrait, Tensor}; +use core::array::{ArrayTrait, SpanTrait}; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; + +#[test] +#[available_gas(2000000000)] +fn test_export_center_crop_pad_pad() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let y_0 = input_0.center_crop_pad(TensorTrait::new(array![3].span(), array![20,10,3].span()), Option::None(())); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/export_center_crop_pad_pad/input_0.cairo b/tests/nodes/export_center_crop_pad_pad/input_0.cairo new file mode 100644 index 000000000..3f91bf544 --- /dev/null +++ b/tests/nodes/export_center_crop_pad_pad/input_0.cairo @@ -0,0 +1,226 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::Complex64Tensor; +use orion::numbers::{NumberTrait, complex64}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::numbers::{FixedTrait, FP64x64}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(10); + shape.append(7); + shape.append(3); + + let mut data = ArrayTrait::new(); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 3, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 4, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 5, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 6, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 7, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 8, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 9, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 10, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 11, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 12, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 13, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 14, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 15, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 16, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 17, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 18, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 19, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 20, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 21, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 22, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 23, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 24, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 25, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 26, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 27, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 28, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 29, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 30, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 31, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 32, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 33, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 34, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 35, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 36, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 37, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 38, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 39, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 40, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 41, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 42, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 43, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 44, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 45, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 46, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 47, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 48, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 49, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 50, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 51, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 52, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 53, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 54, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 55, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 56, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 57, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 58, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 59, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 60, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 61, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 62, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 63, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 64, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 65, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 66, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 67, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 68, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 69, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 70, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 71, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 72, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 73, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 74, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 75, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 76, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 77, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 78, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 79, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 80, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 81, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 82, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 83, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 84, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 85, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 86, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 87, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 88, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 89, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 90, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 91, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 92, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 93, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 94, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 95, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 96, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 97, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 98, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 99, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 100, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 101, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 102, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 103, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 104, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 105, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 106, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 107, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 108, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 109, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 110, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 111, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 112, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 113, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 114, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 115, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 116, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 117, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 118, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 119, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 120, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 121, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 122, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 123, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 124, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 125, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 126, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 127, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 128, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 129, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 130, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 131, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 132, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 133, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 134, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 135, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 136, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 137, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 138, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 139, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 140, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 141, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 142, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 143, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 144, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 145, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 146, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 147, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 148, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 149, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 150, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 151, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 152, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 153, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 154, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 155, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 156, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 157, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 158, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 159, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 160, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 161, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 162, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 163, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 164, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 165, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 166, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 167, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 168, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 169, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 170, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 171, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 172, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 173, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 174, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 175, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 176, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 177, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 178, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 179, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 180, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 181, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 182, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 183, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 184, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 185, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 186, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 187, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 188, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 189, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 190, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 191, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 192, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 193, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 194, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 195, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 196, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 197, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 198, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 199, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 200, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 201, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 202, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 203, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 204, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 205, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 206, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 207, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 208, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 209, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/export_center_crop_pad_pad/output_0.cairo b/tests/nodes/export_center_crop_pad_pad/output_0.cairo new file mode 100644 index 000000000..6ec454d46 --- /dev/null +++ b/tests/nodes/export_center_crop_pad_pad/output_0.cairo @@ -0,0 +1,616 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::Complex64Tensor; +use orion::numbers::{NumberTrait, complex64}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::numbers::{FixedTrait, FP64x64}; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(20); + shape.append(10); + shape.append(3); + + let mut data = ArrayTrait::new(); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 1, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 2, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 3, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 4, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 5, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 6, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 7, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 8, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 9, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 10, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 11, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 12, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 13, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 14, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 15, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 16, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 17, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 18, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 19, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 20, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 21, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 22, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 23, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 24, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 25, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 26, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 27, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 28, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 29, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 30, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 31, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 32, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 33, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 34, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 35, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 36, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 37, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 38, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 39, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 40, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 41, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 42, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 43, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 44, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 45, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 46, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 47, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 48, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 49, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 50, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 51, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 52, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 53, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 54, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 55, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 56, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 57, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 58, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 59, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 60, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 61, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 62, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 63, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 64, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 65, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 66, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 67, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 68, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 69, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 70, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 71, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 72, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 73, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 74, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 75, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 76, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 77, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 78, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 79, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 80, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 81, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 82, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 83, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 84, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 85, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 86, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 87, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 88, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 89, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 90, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 91, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 92, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 93, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 94, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 95, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 96, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 97, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 98, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 99, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 100, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 101, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 102, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 103, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 104, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 105, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 106, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 107, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 108, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 109, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 110, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 111, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 112, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 113, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 114, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 115, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 116, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 117, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 118, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 119, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 120, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 121, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 122, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 123, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 124, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 125, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 126, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 127, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 128, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 129, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 130, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 131, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 132, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 133, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 134, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 135, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 136, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 137, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 138, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 139, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 140, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 141, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 142, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 143, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 144, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 145, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 146, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 147, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 148, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 149, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 150, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 151, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 152, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 153, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 154, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 155, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 156, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 157, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 158, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 159, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 160, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 161, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 162, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 163, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 164, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 165, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 166, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 167, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 168, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 169, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 170, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 171, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 172, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 173, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 174, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 175, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 176, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 177, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 178, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 179, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 180, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 181, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 182, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 183, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 184, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 185, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 186, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 187, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 188, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 189, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 190, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 191, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 192, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 193, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 194, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 195, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 196, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 197, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 198, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 199, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 200, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 201, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 202, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 203, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 204, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 205, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 206, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 207, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 208, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 209, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + data.append(complex64 { real: FP64x64 { mag: 0, sign: false } , img: FP64x64 { mag: 0, sign: false } }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/gather_i32_3d_default.cairo b/tests/nodes/gather_elements_axis1.cairo similarity index 67% rename from tests/nodes/gather_i32_3d_default.cairo rename to tests/nodes/gather_elements_axis1.cairo index 4c0b9c9bd..82b08e271 100644 --- a/tests/nodes/gather_i32_3d_default.cairo +++ b/tests/nodes/gather_elements_axis1.cairo @@ -4,21 +4,21 @@ mod output_0; use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::operators::tensor::FP16x16TensorPartialEq; use orion::operators::tensor::{I32Tensor, I32TensorAdd}; use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::I32TensorPartialEq; -use orion::operators::tensor::U32TensorPartialEq; +use orion::operators::tensor::{TensorTrait, Tensor}; #[test] #[available_gas(2000000000)] -fn test_gather_i32_3d_default() { +fn test_gather_elements_axis1() { let input_0 = input_0::input_0(); let input_1 = input_1::input_1(); let z_0 = output_0::output_0(); - let y_0 = input_0.gather(indices: input_1, axis: Option::Some(0)); + let y_0 = input_0.gather_elements(indices:input_1, axis:Option::Some(1)); assert_eq(y_0, z_0); } diff --git a/tests/nodes/reduce_sum_fp16x16_2D_keepdims/input_0.cairo b/tests/nodes/gather_elements_axis1/input_0.cairo similarity index 81% rename from tests/nodes/reduce_sum_fp16x16_2D_keepdims/input_0.cairo rename to tests/nodes/gather_elements_axis1/input_0.cairo index 00c61e821..d74280ae9 100644 --- a/tests/nodes/reduce_sum_fp16x16_2D_keepdims/input_0.cairo +++ b/tests/nodes/gather_elements_axis1/input_0.cairo @@ -1,6 +1,6 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorMul}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; use orion::numbers::{FixedTrait, FP16x16}; fn input_0() -> Tensor { @@ -9,9 +9,9 @@ fn input_0() -> Tensor { shape.append(2); let mut data = ArrayTrait::new(); - data.append(FP16x16 { mag: 0, sign: false }); data.append(FP16x16 { mag: 65536, sign: false }); data.append(FP16x16 { mag: 131072, sign: false }); data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 262144, sign: false }); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/argmax_u32_3D_default/output_0.cairo b/tests/nodes/gather_elements_axis1/input_1.cairo similarity index 74% rename from tests/nodes/argmax_u32_3D_default/output_0.cairo rename to tests/nodes/gather_elements_axis1/input_1.cairo index e3da7dd7d..ef76c8bf4 100644 --- a/tests/nodes/argmax_u32_3D_default/output_0.cairo +++ b/tests/nodes/gather_elements_axis1/input_1.cairo @@ -1,10 +1,10 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn output_0() -> Tensor { +fn input_1() -> Tensor { let mut shape = ArrayTrait::::new(); - shape.append(1); shape.append(2); shape.append(2); diff --git a/tests/nodes/reduce_sum_fp16x16_2D_default/input_0.cairo b/tests/nodes/gather_elements_axis1/output_0.cairo similarity index 67% rename from tests/nodes/reduce_sum_fp16x16_2D_default/input_0.cairo rename to tests/nodes/gather_elements_axis1/output_0.cairo index 00c61e821..440047d6e 100644 --- a/tests/nodes/reduce_sum_fp16x16_2D_default/input_0.cairo +++ b/tests/nodes/gather_elements_axis1/output_0.cairo @@ -1,17 +1,17 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorMul}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; use orion::numbers::{FixedTrait, FP16x16}; -fn input_0() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(2); shape.append(2); let mut data = ArrayTrait::new(); - data.append(FP16x16 { mag: 0, sign: false }); data.append(FP16x16 { mag: 65536, sign: false }); - data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 262144, sign: false }); data.append(FP16x16 { mag: 196608, sign: false }); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/gather_elements_axis2.cairo b/tests/nodes/gather_elements_axis2.cairo new file mode 100644 index 000000000..0e0b7caea --- /dev/null +++ b/tests/nodes/gather_elements_axis2.cairo @@ -0,0 +1,24 @@ +mod input_0; +mod input_1; +mod output_0; + + +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::operators::tensor::FP16x16TensorPartialEq; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::I32TensorPartialEq; +use orion::operators::tensor::{TensorTrait, Tensor}; + +#[test] +#[available_gas(2000000000)] +fn test_gather_elements_axis2() { + let input_0 = input_0::input_0(); + let input_1 = input_1::input_1(); + let z_0 = output_0::output_0(); + + let y_0 = input_0.gather_elements(indices:input_1, axis:Option::Some(2)); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/gather_elements_fp16x16_3d_axis1/input_0.cairo b/tests/nodes/gather_elements_axis2/input_0.cairo similarity index 96% rename from tests/nodes/gather_elements_fp16x16_3d_axis1/input_0.cairo rename to tests/nodes/gather_elements_axis2/input_0.cairo index 2417c999e..5d8deafac 100644 --- a/tests/nodes/gather_elements_fp16x16_3d_axis1/input_0.cairo +++ b/tests/nodes/gather_elements_axis2/input_0.cairo @@ -1,6 +1,6 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorSub}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; use orion::numbers::{FixedTrait, FP16x16}; fn input_0() -> Tensor { diff --git a/tests/nodes/gather_elements_fp16x16_3d_axis2/input_1.cairo b/tests/nodes/gather_elements_axis2/input_1.cairo similarity index 83% rename from tests/nodes/gather_elements_fp16x16_3d_axis2/input_1.cairo rename to tests/nodes/gather_elements_axis2/input_1.cairo index d2c0a00b1..61f544307 100644 --- a/tests/nodes/gather_elements_fp16x16_3d_axis2/input_1.cairo +++ b/tests/nodes/gather_elements_axis2/input_1.cairo @@ -1,40 +1,41 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn input_1() -> Tensor { +fn input_1() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(3); shape.append(3); shape.append(3); let mut data = ArrayTrait::new(); - data.append(2); + data.append(1); + data.append(0); data.append(0); data.append(2); data.append(0); - data.append(1); data.append(0); - data.append(2); data.append(0); - data.append(1); - data.append(1); - data.append(2); data.append(2); data.append(0); - data.append(2); + data.append(1); data.append(0); data.append(2); - data.append(2); + data.append(1); data.append(0); data.append(2); - data.append(1); data.append(0); data.append(0); data.append(1); - data.append(0); + data.append(2); + data.append(2); + data.append(2); data.append(1); - data.append(0); + data.append(2); + data.append(2); + data.append(2); + data.append(2); data.append(0); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/gather_elements_axis2/output_0.cairo b/tests/nodes/gather_elements_axis2/output_0.cairo new file mode 100644 index 000000000..51cbca04f --- /dev/null +++ b/tests/nodes/gather_elements_axis2/output_0.cairo @@ -0,0 +1,41 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(3); + shape.append(3); + shape.append(3); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 327680, sign: false }); + data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 393216, sign: false }); + data.append(FP16x16 { mag: 524288, sign: false }); + data.append(FP16x16 { mag: 393216, sign: false }); + data.append(FP16x16 { mag: 655360, sign: false }); + data.append(FP16x16 { mag: 589824, sign: false }); + data.append(FP16x16 { mag: 720896, sign: false }); + data.append(FP16x16 { mag: 851968, sign: false }); + data.append(FP16x16 { mag: 786432, sign: false }); + data.append(FP16x16 { mag: 917504, sign: false }); + data.append(FP16x16 { mag: 983040, sign: false }); + data.append(FP16x16 { mag: 983040, sign: false }); + data.append(FP16x16 { mag: 1048576, sign: false }); + data.append(FP16x16 { mag: 1310720, sign: false }); + data.append(FP16x16 { mag: 1310720, sign: false }); + data.append(FP16x16 { mag: 1310720, sign: false }); + data.append(FP16x16 { mag: 1441792, sign: false }); + data.append(FP16x16 { mag: 1507328, sign: false }); + data.append(FP16x16 { mag: 1507328, sign: false }); + data.append(FP16x16 { mag: 1703936, sign: false }); + data.append(FP16x16 { mag: 1703936, sign: false }); + data.append(FP16x16 { mag: 1572864, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/gather_elements_default.cairo b/tests/nodes/gather_elements_default.cairo new file mode 100644 index 000000000..9d1a099c1 --- /dev/null +++ b/tests/nodes/gather_elements_default.cairo @@ -0,0 +1,24 @@ +mod input_0; +mod input_1; +mod output_0; + + +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::operators::tensor::FP16x16TensorPartialEq; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::I32TensorPartialEq; +use orion::operators::tensor::{TensorTrait, Tensor}; + +#[test] +#[available_gas(2000000000)] +fn test_gather_elements_default() { + let input_0 = input_0::input_0(); + let input_1 = input_1::input_1(); + let z_0 = output_0::output_0(); + + let y_0 = input_0.gather_elements(indices:input_1, axis:Option::Some(0)); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/gather_elements_fp16x16_3d_default/input_0.cairo b/tests/nodes/gather_elements_default/input_0.cairo similarity index 96% rename from tests/nodes/gather_elements_fp16x16_3d_default/input_0.cairo rename to tests/nodes/gather_elements_default/input_0.cairo index 2417c999e..5d8deafac 100644 --- a/tests/nodes/gather_elements_fp16x16_3d_default/input_0.cairo +++ b/tests/nodes/gather_elements_default/input_0.cairo @@ -1,6 +1,6 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorSub}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; use orion::numbers::{FixedTrait, FP16x16}; fn input_0() -> Tensor { diff --git a/tests/nodes/gather_elements_fp8x23_3d_default/input_1.cairo b/tests/nodes/gather_elements_default/input_1.cairo similarity index 87% rename from tests/nodes/gather_elements_fp8x23_3d_default/input_1.cairo rename to tests/nodes/gather_elements_default/input_1.cairo index 63526f247..707ba986d 100644 --- a/tests/nodes/gather_elements_fp8x23_3d_default/input_1.cairo +++ b/tests/nodes/gather_elements_default/input_1.cairo @@ -1,8 +1,9 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn input_1() -> Tensor { +fn input_1() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(3); shape.append(3); @@ -11,6 +12,8 @@ fn input_1() -> Tensor { let mut data = ArrayTrait::new(); data.append(1); data.append(0); + data.append(0); + data.append(1); data.append(1); data.append(0); data.append(0); @@ -20,21 +23,19 @@ fn input_1() -> Tensor { data.append(1); data.append(1); data.append(1); - data.append(0); - data.append(1); - data.append(1); data.append(1); data.append(0); data.append(1); data.append(0); data.append(0); - data.append(0); data.append(1); data.append(0); data.append(0); - data.append(1); data.append(0); data.append(0); data.append(0); + data.append(0); + data.append(1); + data.append(1); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/gather_elements_fp16x16_3d_default/output_0.cairo b/tests/nodes/gather_elements_default/output_0.cairo similarity index 70% rename from tests/nodes/gather_elements_fp16x16_3d_default/output_0.cairo rename to tests/nodes/gather_elements_default/output_0.cairo index d37ee87d6..0fb918722 100644 --- a/tests/nodes/gather_elements_fp16x16_3d_default/output_0.cairo +++ b/tests/nodes/gather_elements_default/output_0.cairo @@ -1,6 +1,6 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorSub}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; use orion::numbers::{FixedTrait, FP16x16}; fn output_0() -> Tensor { @@ -10,31 +10,31 @@ fn output_0() -> Tensor { shape.append(3); let mut data = ArrayTrait::new(); - data.append(FP16x16 { mag: 0, sign: false }); - data.append(FP16x16 { mag: 655360, sign: false }); + data.append(FP16x16 { mag: 589824, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); data.append(FP16x16 { mag: 131072, sign: false }); - data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 786432, sign: false }); data.append(FP16x16 { mag: 851968, sign: false }); - data.append(FP16x16 { mag: 917504, sign: false }); - data.append(FP16x16 { mag: 983040, sign: false }); - data.append(FP16x16 { mag: 1048576, sign: false }); - data.append(FP16x16 { mag: 1114112, sign: false }); + data.append(FP16x16 { mag: 327680, sign: false }); + data.append(FP16x16 { mag: 393216, sign: false }); + data.append(FP16x16 { mag: 458752, sign: false }); + data.append(FP16x16 { mag: 524288, sign: false }); data.append(FP16x16 { mag: 0, sign: false }); data.append(FP16x16 { mag: 655360, sign: false }); data.append(FP16x16 { mag: 720896, sign: false }); data.append(FP16x16 { mag: 786432, sign: false }); data.append(FP16x16 { mag: 851968, sign: false }); - data.append(FP16x16 { mag: 917504, sign: false }); - data.append(FP16x16 { mag: 393216, sign: false }); - data.append(FP16x16 { mag: 1048576, sign: false }); + data.append(FP16x16 { mag: 327680, sign: false }); + data.append(FP16x16 { mag: 983040, sign: false }); + data.append(FP16x16 { mag: 458752, sign: false }); data.append(FP16x16 { mag: 524288, sign: false }); data.append(FP16x16 { mag: 589824, sign: false }); data.append(FP16x16 { mag: 65536, sign: false }); data.append(FP16x16 { mag: 131072, sign: false }); - data.append(FP16x16 { mag: 786432, sign: false }); - data.append(FP16x16 { mag: 851968, sign: false }); + data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 262144, sign: false }); data.append(FP16x16 { mag: 327680, sign: false }); - data.append(FP16x16 { mag: 983040, sign: false }); + data.append(FP16x16 { mag: 393216, sign: false }); data.append(FP16x16 { mag: 1048576, sign: false }); data.append(FP16x16 { mag: 1114112, sign: false }); TensorTrait::new(shape.span(), data.span()) diff --git a/tests/nodes/gather_elements_fp16x16_3d_axis1.cairo b/tests/nodes/gather_elements_fp16x16_3d_axis1.cairo deleted file mode 100644 index 6107612c7..000000000 --- a/tests/nodes/gather_elements_fp16x16_3d_axis1.cairo +++ /dev/null @@ -1,24 +0,0 @@ -mod input_0; -mod input_1; -mod output_0; - - -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorSub}; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::operators::tensor::FP16x16TensorPartialEq; - -#[test] -#[available_gas(2000000000)] -fn test_gather_elements_fp16x16_3d_axis1() { - let input_0 = input_0::input_0(); - let input_1 = input_1::input_1(); - let z = output_0::output_0(); - - let y = input_0.gather_elements(indices: input_1, axis: Option::Some(1)); - - assert_eq(y, z); -} diff --git a/tests/nodes/gather_elements_fp16x16_3d_axis1/input_1.cairo b/tests/nodes/gather_elements_fp16x16_3d_axis1/input_1.cairo deleted file mode 100644 index a8dddea3d..000000000 --- a/tests/nodes/gather_elements_fp16x16_3d_axis1/input_1.cairo +++ /dev/null @@ -1,40 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; - -fn input_1() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(2); - data.append(0); - data.append(0); - data.append(0); - data.append(2); - data.append(1); - data.append(0); - data.append(2); - data.append(1); - data.append(1); - data.append(1); - data.append(0); - data.append(2); - data.append(1); - data.append(0); - data.append(0); - data.append(1); - data.append(0); - data.append(2); - data.append(2); - data.append(1); - data.append(0); - data.append(0); - data.append(0); - data.append(2); - data.append(2); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_fp16x16_3d_axis1/output_0.cairo b/tests/nodes/gather_elements_fp16x16_3d_axis1/output_0.cairo deleted file mode 100644 index 843805c3c..000000000 --- a/tests/nodes/gather_elements_fp16x16_3d_axis1/output_0.cairo +++ /dev/null @@ -1,41 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorSub}; -use orion::numbers::{FixedTrait, FP16x16}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(FP16x16 { mag: 0, sign: false }); - data.append(FP16x16 { mag: 458752, sign: false }); - data.append(FP16x16 { mag: 131072, sign: false }); - data.append(FP16x16 { mag: 0, sign: false }); - data.append(FP16x16 { mag: 65536, sign: false }); - data.append(FP16x16 { mag: 524288, sign: false }); - data.append(FP16x16 { mag: 196608, sign: false }); - data.append(FP16x16 { mag: 65536, sign: false }); - data.append(FP16x16 { mag: 524288, sign: false }); - data.append(FP16x16 { mag: 786432, sign: false }); - data.append(FP16x16 { mag: 851968, sign: false }); - data.append(FP16x16 { mag: 917504, sign: false }); - data.append(FP16x16 { mag: 589824, sign: false }); - data.append(FP16x16 { mag: 1048576, sign: false }); - data.append(FP16x16 { mag: 917504, sign: false }); - data.append(FP16x16 { mag: 589824, sign: false }); - data.append(FP16x16 { mag: 655360, sign: false }); - data.append(FP16x16 { mag: 917504, sign: false }); - data.append(FP16x16 { mag: 1179648, sign: false }); - data.append(FP16x16 { mag: 1638400, sign: false }); - data.append(FP16x16 { mag: 1703936, sign: false }); - data.append(FP16x16 { mag: 1376256, sign: false }); - data.append(FP16x16 { mag: 1245184, sign: false }); - data.append(FP16x16 { mag: 1310720, sign: false }); - data.append(FP16x16 { mag: 1179648, sign: false }); - data.append(FP16x16 { mag: 1638400, sign: false }); - data.append(FP16x16 { mag: 1703936, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_fp16x16_3d_axis2.cairo b/tests/nodes/gather_elements_fp16x16_3d_axis2.cairo deleted file mode 100644 index e44e6b6c1..000000000 --- a/tests/nodes/gather_elements_fp16x16_3d_axis2.cairo +++ /dev/null @@ -1,24 +0,0 @@ -mod input_0; -mod input_1; -mod output_0; - - -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorSub}; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::operators::tensor::FP16x16TensorPartialEq; - -#[test] -#[available_gas(2000000000)] -fn test_gather_elements_fp16x16_3d_axis2() { - let input_0 = input_0::input_0(); - let input_1 = input_1::input_1(); - let z = output_0::output_0(); - - let y = input_0.gather_elements(indices: input_1, axis: Option::Some(2)); - - assert_eq(y, z); -} diff --git a/tests/nodes/gather_elements_fp16x16_3d_default/input_1.cairo b/tests/nodes/gather_elements_fp16x16_3d_default/input_1.cairo deleted file mode 100644 index a8ee056f2..000000000 --- a/tests/nodes/gather_elements_fp16x16_3d_default/input_1.cairo +++ /dev/null @@ -1,40 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; - -fn input_1() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(0); - data.append(0); - data.append(1); - data.append(1); - data.append(1); - data.append(1); - data.append(1); - data.append(0); - data.append(1); - data.append(1); - data.append(1); - data.append(1); - data.append(1); - data.append(0); - data.append(1); - data.append(0); - data.append(1); - data.append(0); - data.append(0); - data.append(1); - data.append(1); - data.append(0); - data.append(1); - data.append(1); - data.append(1); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_fp8x23_3d_axis1.cairo b/tests/nodes/gather_elements_fp8x23_3d_axis1.cairo deleted file mode 100644 index fbecd8cd1..000000000 --- a/tests/nodes/gather_elements_fp8x23_3d_axis1.cairo +++ /dev/null @@ -1,24 +0,0 @@ -mod input_0; -mod input_1; -mod output_0; - - -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::FP8x23TensorPartialEq; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorSub}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::U32TensorPartialEq; - -#[test] -#[available_gas(2000000000)] -fn test_gather_elements_fp8x23_3d_axis1() { - let input_0 = input_0::input_0(); - let input_1 = input_1::input_1(); - let z = output_0::output_0(); - - let y = input_0.gather_elements(indices: input_1, axis: Option::Some(1)); - - assert_eq(y, z); -} diff --git a/tests/nodes/gather_elements_fp8x23_3d_axis1/input_0.cairo b/tests/nodes/gather_elements_fp8x23_3d_axis1/input_0.cairo deleted file mode 100644 index ed60e2f46..000000000 --- a/tests/nodes/gather_elements_fp8x23_3d_axis1/input_0.cairo +++ /dev/null @@ -1,41 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorSub}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 0, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 25165824, sign: false }); - data.append(FP8x23 { mag: 33554432, sign: false }); - data.append(FP8x23 { mag: 41943040, sign: false }); - data.append(FP8x23 { mag: 50331648, sign: false }); - data.append(FP8x23 { mag: 58720256, sign: false }); - data.append(FP8x23 { mag: 67108864, sign: false }); - data.append(FP8x23 { mag: 75497472, sign: false }); - data.append(FP8x23 { mag: 83886080, sign: false }); - data.append(FP8x23 { mag: 92274688, sign: false }); - data.append(FP8x23 { mag: 100663296, sign: false }); - data.append(FP8x23 { mag: 109051904, sign: false }); - data.append(FP8x23 { mag: 117440512, sign: false }); - data.append(FP8x23 { mag: 125829120, sign: false }); - data.append(FP8x23 { mag: 134217728, sign: false }); - data.append(FP8x23 { mag: 142606336, sign: false }); - data.append(FP8x23 { mag: 150994944, sign: false }); - data.append(FP8x23 { mag: 159383552, sign: false }); - data.append(FP8x23 { mag: 167772160, sign: false }); - data.append(FP8x23 { mag: 176160768, sign: false }); - data.append(FP8x23 { mag: 184549376, sign: false }); - data.append(FP8x23 { mag: 192937984, sign: false }); - data.append(FP8x23 { mag: 201326592, sign: false }); - data.append(FP8x23 { mag: 209715200, sign: false }); - data.append(FP8x23 { mag: 218103808, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_fp8x23_3d_axis1/input_1.cairo b/tests/nodes/gather_elements_fp8x23_3d_axis1/input_1.cairo deleted file mode 100644 index f9c244b79..000000000 --- a/tests/nodes/gather_elements_fp8x23_3d_axis1/input_1.cairo +++ /dev/null @@ -1,40 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; - -fn input_1() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(2); - data.append(0); - data.append(2); - data.append(2); - data.append(2); - data.append(0); - data.append(0); - data.append(2); - data.append(2); - data.append(0); - data.append(2); - data.append(2); - data.append(0); - data.append(2); - data.append(0); - data.append(2); - data.append(1); - data.append(2); - data.append(1); - data.append(2); - data.append(1); - data.append(2); - data.append(1); - data.append(0); - data.append(2); - data.append(2); - data.append(2); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_fp8x23_3d_axis1/output_0.cairo b/tests/nodes/gather_elements_fp8x23_3d_axis1/output_0.cairo deleted file mode 100644 index 126c55bfa..000000000 --- a/tests/nodes/gather_elements_fp8x23_3d_axis1/output_0.cairo +++ /dev/null @@ -1,41 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorSub}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 50331648, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 67108864, sign: false }); - data.append(FP8x23 { mag: 50331648, sign: false }); - data.append(FP8x23 { mag: 58720256, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 0, sign: false }); - data.append(FP8x23 { mag: 58720256, sign: false }); - data.append(FP8x23 { mag: 67108864, sign: false }); - data.append(FP8x23 { mag: 75497472, sign: false }); - data.append(FP8x23 { mag: 134217728, sign: false }); - data.append(FP8x23 { mag: 142606336, sign: false }); - data.append(FP8x23 { mag: 75497472, sign: false }); - data.append(FP8x23 { mag: 134217728, sign: false }); - data.append(FP8x23 { mag: 92274688, sign: false }); - data.append(FP8x23 { mag: 125829120, sign: false }); - data.append(FP8x23 { mag: 109051904, sign: false }); - data.append(FP8x23 { mag: 142606336, sign: false }); - data.append(FP8x23 { mag: 176160768, sign: false }); - data.append(FP8x23 { mag: 209715200, sign: false }); - data.append(FP8x23 { mag: 192937984, sign: false }); - data.append(FP8x23 { mag: 201326592, sign: false }); - data.append(FP8x23 { mag: 184549376, sign: false }); - data.append(FP8x23 { mag: 167772160, sign: false }); - data.append(FP8x23 { mag: 201326592, sign: false }); - data.append(FP8x23 { mag: 209715200, sign: false }); - data.append(FP8x23 { mag: 218103808, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_fp8x23_3d_axis2.cairo b/tests/nodes/gather_elements_fp8x23_3d_axis2.cairo deleted file mode 100644 index e08b0b07c..000000000 --- a/tests/nodes/gather_elements_fp8x23_3d_axis2.cairo +++ /dev/null @@ -1,24 +0,0 @@ -mod input_0; -mod input_1; -mod output_0; - - -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::FP8x23TensorPartialEq; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorSub}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::U32TensorPartialEq; - -#[test] -#[available_gas(2000000000)] -fn test_gather_elements_fp8x23_3d_axis2() { - let input_0 = input_0::input_0(); - let input_1 = input_1::input_1(); - let z = output_0::output_0(); - - let y = input_0.gather_elements(indices: input_1, axis: Option::Some(2)); - - assert_eq(y, z); -} diff --git a/tests/nodes/gather_elements_fp8x23_3d_axis2/input_0.cairo b/tests/nodes/gather_elements_fp8x23_3d_axis2/input_0.cairo deleted file mode 100644 index ed60e2f46..000000000 --- a/tests/nodes/gather_elements_fp8x23_3d_axis2/input_0.cairo +++ /dev/null @@ -1,41 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorSub}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 0, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 25165824, sign: false }); - data.append(FP8x23 { mag: 33554432, sign: false }); - data.append(FP8x23 { mag: 41943040, sign: false }); - data.append(FP8x23 { mag: 50331648, sign: false }); - data.append(FP8x23 { mag: 58720256, sign: false }); - data.append(FP8x23 { mag: 67108864, sign: false }); - data.append(FP8x23 { mag: 75497472, sign: false }); - data.append(FP8x23 { mag: 83886080, sign: false }); - data.append(FP8x23 { mag: 92274688, sign: false }); - data.append(FP8x23 { mag: 100663296, sign: false }); - data.append(FP8x23 { mag: 109051904, sign: false }); - data.append(FP8x23 { mag: 117440512, sign: false }); - data.append(FP8x23 { mag: 125829120, sign: false }); - data.append(FP8x23 { mag: 134217728, sign: false }); - data.append(FP8x23 { mag: 142606336, sign: false }); - data.append(FP8x23 { mag: 150994944, sign: false }); - data.append(FP8x23 { mag: 159383552, sign: false }); - data.append(FP8x23 { mag: 167772160, sign: false }); - data.append(FP8x23 { mag: 176160768, sign: false }); - data.append(FP8x23 { mag: 184549376, sign: false }); - data.append(FP8x23 { mag: 192937984, sign: false }); - data.append(FP8x23 { mag: 201326592, sign: false }); - data.append(FP8x23 { mag: 209715200, sign: false }); - data.append(FP8x23 { mag: 218103808, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_fp8x23_3d_axis2/input_1.cairo b/tests/nodes/gather_elements_fp8x23_3d_axis2/input_1.cairo deleted file mode 100644 index f36baa09d..000000000 --- a/tests/nodes/gather_elements_fp8x23_3d_axis2/input_1.cairo +++ /dev/null @@ -1,40 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; - -fn input_1() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(1); - data.append(0); - data.append(1); - data.append(0); - data.append(1); - data.append(0); - data.append(2); - data.append(2); - data.append(2); - data.append(1); - data.append(1); - data.append(0); - data.append(0); - data.append(1); - data.append(1); - data.append(1); - data.append(2); - data.append(1); - data.append(2); - data.append(0); - data.append(2); - data.append(1); - data.append(0); - data.append(0); - data.append(2); - data.append(1); - data.append(1); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_fp8x23_3d_axis2/output_0.cairo b/tests/nodes/gather_elements_fp8x23_3d_axis2/output_0.cairo deleted file mode 100644 index 1778c6ea3..000000000 --- a/tests/nodes/gather_elements_fp8x23_3d_axis2/output_0.cairo +++ /dev/null @@ -1,41 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorSub}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 0, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 25165824, sign: false }); - data.append(FP8x23 { mag: 33554432, sign: false }); - data.append(FP8x23 { mag: 25165824, sign: false }); - data.append(FP8x23 { mag: 67108864, sign: false }); - data.append(FP8x23 { mag: 67108864, sign: false }); - data.append(FP8x23 { mag: 67108864, sign: false }); - data.append(FP8x23 { mag: 83886080, sign: false }); - data.append(FP8x23 { mag: 83886080, sign: false }); - data.append(FP8x23 { mag: 75497472, sign: false }); - data.append(FP8x23 { mag: 100663296, sign: false }); - data.append(FP8x23 { mag: 109051904, sign: false }); - data.append(FP8x23 { mag: 109051904, sign: false }); - data.append(FP8x23 { mag: 134217728, sign: false }); - data.append(FP8x23 { mag: 142606336, sign: false }); - data.append(FP8x23 { mag: 134217728, sign: false }); - data.append(FP8x23 { mag: 167772160, sign: false }); - data.append(FP8x23 { mag: 150994944, sign: false }); - data.append(FP8x23 { mag: 167772160, sign: false }); - data.append(FP8x23 { mag: 184549376, sign: false }); - data.append(FP8x23 { mag: 176160768, sign: false }); - data.append(FP8x23 { mag: 176160768, sign: false }); - data.append(FP8x23 { mag: 218103808, sign: false }); - data.append(FP8x23 { mag: 209715200, sign: false }); - data.append(FP8x23 { mag: 209715200, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_fp8x23_3d_default.cairo b/tests/nodes/gather_elements_fp8x23_3d_default.cairo deleted file mode 100644 index ccf76f1f0..000000000 --- a/tests/nodes/gather_elements_fp8x23_3d_default.cairo +++ /dev/null @@ -1,24 +0,0 @@ -mod input_0; -mod input_1; -mod output_0; - - -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::FP8x23TensorPartialEq; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorSub}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::U32TensorPartialEq; - -#[test] -#[available_gas(2000000000)] -fn test_gather_elements_fp8x23_3d_default() { - let input_0 = input_0::input_0(); - let input_1 = input_1::input_1(); - let z = output_0::output_0(); - - let y = input_0.gather_elements(indices: input_1, axis: Option::Some(0)); - - assert_eq(y, z); -} diff --git a/tests/nodes/gather_elements_fp8x23_3d_default/input_0.cairo b/tests/nodes/gather_elements_fp8x23_3d_default/input_0.cairo deleted file mode 100644 index ed60e2f46..000000000 --- a/tests/nodes/gather_elements_fp8x23_3d_default/input_0.cairo +++ /dev/null @@ -1,41 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorSub}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 0, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 25165824, sign: false }); - data.append(FP8x23 { mag: 33554432, sign: false }); - data.append(FP8x23 { mag: 41943040, sign: false }); - data.append(FP8x23 { mag: 50331648, sign: false }); - data.append(FP8x23 { mag: 58720256, sign: false }); - data.append(FP8x23 { mag: 67108864, sign: false }); - data.append(FP8x23 { mag: 75497472, sign: false }); - data.append(FP8x23 { mag: 83886080, sign: false }); - data.append(FP8x23 { mag: 92274688, sign: false }); - data.append(FP8x23 { mag: 100663296, sign: false }); - data.append(FP8x23 { mag: 109051904, sign: false }); - data.append(FP8x23 { mag: 117440512, sign: false }); - data.append(FP8x23 { mag: 125829120, sign: false }); - data.append(FP8x23 { mag: 134217728, sign: false }); - data.append(FP8x23 { mag: 142606336, sign: false }); - data.append(FP8x23 { mag: 150994944, sign: false }); - data.append(FP8x23 { mag: 159383552, sign: false }); - data.append(FP8x23 { mag: 167772160, sign: false }); - data.append(FP8x23 { mag: 176160768, sign: false }); - data.append(FP8x23 { mag: 184549376, sign: false }); - data.append(FP8x23 { mag: 192937984, sign: false }); - data.append(FP8x23 { mag: 201326592, sign: false }); - data.append(FP8x23 { mag: 209715200, sign: false }); - data.append(FP8x23 { mag: 218103808, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_fp8x23_3d_default/output_0.cairo b/tests/nodes/gather_elements_fp8x23_3d_default/output_0.cairo deleted file mode 100644 index 4acfdfe3d..000000000 --- a/tests/nodes/gather_elements_fp8x23_3d_default/output_0.cairo +++ /dev/null @@ -1,41 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorSub}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 75497472, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 92274688, sign: false }); - data.append(FP8x23 { mag: 25165824, sign: false }); - data.append(FP8x23 { mag: 33554432, sign: false }); - data.append(FP8x23 { mag: 41943040, sign: false }); - data.append(FP8x23 { mag: 50331648, sign: false }); - data.append(FP8x23 { mag: 58720256, sign: false }); - data.append(FP8x23 { mag: 142606336, sign: false }); - data.append(FP8x23 { mag: 75497472, sign: false }); - data.append(FP8x23 { mag: 83886080, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 100663296, sign: false }); - data.append(FP8x23 { mag: 109051904, sign: false }); - data.append(FP8x23 { mag: 117440512, sign: false }); - data.append(FP8x23 { mag: 50331648, sign: false }); - data.append(FP8x23 { mag: 134217728, sign: false }); - data.append(FP8x23 { mag: 67108864, sign: false }); - data.append(FP8x23 { mag: 0, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 92274688, sign: false }); - data.append(FP8x23 { mag: 25165824, sign: false }); - data.append(FP8x23 { mag: 33554432, sign: false }); - data.append(FP8x23 { mag: 117440512, sign: false }); - data.append(FP8x23 { mag: 50331648, sign: false }); - data.append(FP8x23 { mag: 58720256, sign: false }); - data.append(FP8x23 { mag: 67108864, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_i32_3d_axis1.cairo b/tests/nodes/gather_elements_i32_3d_axis1.cairo deleted file mode 100644 index 4295d1451..000000000 --- a/tests/nodes/gather_elements_i32_3d_axis1.cairo +++ /dev/null @@ -1,24 +0,0 @@ -mod input_0; -mod input_1; -mod output_0; - - -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::I32TensorPartialEq; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorSub}; -use orion::operators::tensor::U32TensorPartialEq; - -#[test] -#[available_gas(2000000000)] -fn test_gather_elements_i32_3d_axis1() { - let input_0 = input_0::input_0(); - let input_1 = input_1::input_1(); - let z = output_0::output_0(); - - let y = input_0.gather_elements(indices: input_1, axis: Option::Some(1)); - - assert_eq(y, z); -} diff --git a/tests/nodes/gather_elements_i32_3d_axis1/input_0.cairo b/tests/nodes/gather_elements_i32_3d_axis1/input_0.cairo deleted file mode 100644 index a2ac80e2e..000000000 --- a/tests/nodes/gather_elements_i32_3d_axis1/input_0.cairo +++ /dev/null @@ -1,37 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorSub}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(4); - shape.append(2); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - data.append(4); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(9); - data.append(10); - data.append(11); - data.append(12); - data.append(13); - data.append(14); - data.append(15); - data.append(16); - data.append(17); - data.append(18); - data.append(19); - data.append(20); - data.append(21); - data.append(22); - data.append(23); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_i32_3d_axis1/output_0.cairo b/tests/nodes/gather_elements_i32_3d_axis1/output_0.cairo deleted file mode 100644 index dfd00a470..000000000 --- a/tests/nodes/gather_elements_i32_3d_axis1/output_0.cairo +++ /dev/null @@ -1,49 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorSub}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(4); - shape.append(3); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(0); - data.append(4); - data.append(2); - data.append(0); - data.append(1); - data.append(5); - data.append(6); - data.append(10); - data.append(11); - data.append(9); - data.append(7); - data.append(8); - data.append(6); - data.append(7); - data.append(8); - data.append(15); - data.append(16); - data.append(14); - data.append(12); - data.append(13); - data.append(14); - data.append(15); - data.append(16); - data.append(14); - data.append(18); - data.append(22); - data.append(20); - data.append(21); - data.append(22); - data.append(20); - data.append(21); - data.append(19); - data.append(20); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_i32_3d_axis2.cairo b/tests/nodes/gather_elements_i32_3d_axis2.cairo deleted file mode 100644 index 58dd1ce18..000000000 --- a/tests/nodes/gather_elements_i32_3d_axis2.cairo +++ /dev/null @@ -1,24 +0,0 @@ -mod input_0; -mod input_1; -mod output_0; - - -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::I32TensorPartialEq; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorSub}; -use orion::operators::tensor::U32TensorPartialEq; - -#[test] -#[available_gas(2000000000)] -fn test_gather_elements_i32_3d_axis2() { - let input_0 = input_0::input_0(); - let input_1 = input_1::input_1(); - let z = output_0::output_0(); - - let y = input_0.gather_elements(indices: input_1, axis: Option::Some(2)); - - assert_eq(y, z); -} diff --git a/tests/nodes/gather_elements_i32_3d_axis2/input_0.cairo b/tests/nodes/gather_elements_i32_3d_axis2/input_0.cairo deleted file mode 100644 index a2ac80e2e..000000000 --- a/tests/nodes/gather_elements_i32_3d_axis2/input_0.cairo +++ /dev/null @@ -1,37 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorSub}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(4); - shape.append(2); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - data.append(4); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(9); - data.append(10); - data.append(11); - data.append(12); - data.append(13); - data.append(14); - data.append(15); - data.append(16); - data.append(17); - data.append(18); - data.append(19); - data.append(20); - data.append(21); - data.append(22); - data.append(23); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_i32_3d_axis2/output_0.cairo b/tests/nodes/gather_elements_i32_3d_axis2/output_0.cairo deleted file mode 100644 index a20f34592..000000000 --- a/tests/nodes/gather_elements_i32_3d_axis2/output_0.cairo +++ /dev/null @@ -1,45 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorSub}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(4); - shape.append(2); - shape.append(4); - - let mut data = ArrayTrait::new(); - data.append(1); - data.append(0); - data.append(0); - data.append(0); - data.append(4); - data.append(4); - data.append(3); - data.append(3); - data.append(6); - data.append(7); - data.append(7); - data.append(6); - data.append(9); - data.append(10); - data.append(9); - data.append(9); - data.append(13); - data.append(12); - data.append(12); - data.append(13); - data.append(15); - data.append(16); - data.append(15); - data.append(16); - data.append(19); - data.append(19); - data.append(18); - data.append(18); - data.append(21); - data.append(22); - data.append(21); - data.append(21); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_i32_3d_default.cairo b/tests/nodes/gather_elements_i32_3d_default.cairo deleted file mode 100644 index c09b8ebe8..000000000 --- a/tests/nodes/gather_elements_i32_3d_default.cairo +++ /dev/null @@ -1,24 +0,0 @@ -mod input_0; -mod input_1; -mod output_0; - - -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::I32TensorPartialEq; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorSub}; -use orion::operators::tensor::U32TensorPartialEq; - -#[test] -#[available_gas(2000000000)] -fn test_gather_elements_i32_3d_default() { - let input_0 = input_0::input_0(); - let input_1 = input_1::input_1(); - let z = output_0::output_0(); - - let y = input_0.gather_elements(indices: input_1, axis: Option::Some(0)); - - assert_eq(y, z); -} diff --git a/tests/nodes/gather_elements_i32_3d_default/input_0.cairo b/tests/nodes/gather_elements_i32_3d_default/input_0.cairo deleted file mode 100644 index a2ac80e2e..000000000 --- a/tests/nodes/gather_elements_i32_3d_default/input_0.cairo +++ /dev/null @@ -1,37 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorSub}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(4); - shape.append(2); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - data.append(4); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(9); - data.append(10); - data.append(11); - data.append(12); - data.append(13); - data.append(14); - data.append(15); - data.append(16); - data.append(17); - data.append(18); - data.append(19); - data.append(20); - data.append(21); - data.append(22); - data.append(23); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_i32_3d_default/output_0.cairo b/tests/nodes/gather_elements_i32_3d_default/output_0.cairo deleted file mode 100644 index 244b8aac7..000000000 --- a/tests/nodes/gather_elements_i32_3d_default/output_0.cairo +++ /dev/null @@ -1,43 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorSub}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(5); - shape.append(2); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(7); - data.append(2); - data.append(9); - data.append(10); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(9); - data.append(4); - data.append(5); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - data.append(10); - data.append(5); - data.append(0); - data.append(7); - data.append(2); - data.append(3); - data.append(10); - data.append(5); - data.append(0); - data.append(7); - data.append(8); - data.append(9); - data.append(4); - data.append(11); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_i8_3d_axis1.cairo b/tests/nodes/gather_elements_i8_3d_axis1.cairo deleted file mode 100644 index c04ea22a4..000000000 --- a/tests/nodes/gather_elements_i8_3d_axis1.cairo +++ /dev/null @@ -1,24 +0,0 @@ -mod input_0; -mod input_1; -mod output_0; - - -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::I8TensorPartialEq; -use orion::operators::tensor::U32TensorPartialEq; -use orion::operators::tensor::{I8Tensor, I8TensorSub}; - -#[test] -#[available_gas(2000000000)] -fn test_gather_elements_i8_3d_axis1() { - let input_0 = input_0::input_0(); - let input_1 = input_1::input_1(); - let z = output_0::output_0(); - - let y = input_0.gather_elements(indices: input_1, axis: Option::Some(1)); - - assert_eq(y, z); -} diff --git a/tests/nodes/gather_elements_i8_3d_axis1/input_1.cairo b/tests/nodes/gather_elements_i8_3d_axis1/input_1.cairo deleted file mode 100644 index 477bcfe1d..000000000 --- a/tests/nodes/gather_elements_i8_3d_axis1/input_1.cairo +++ /dev/null @@ -1,21 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; - -fn input_1() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(0); - data.append(0); - data.append(1); - data.append(0); - data.append(1); - data.append(1); - data.append(1); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_i8_3d_default.cairo b/tests/nodes/gather_elements_i8_3d_default.cairo deleted file mode 100644 index 2ee5ae793..000000000 --- a/tests/nodes/gather_elements_i8_3d_default.cairo +++ /dev/null @@ -1,24 +0,0 @@ -mod input_0; -mod input_1; -mod output_0; - - -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::I8TensorPartialEq; -use orion::operators::tensor::U32TensorPartialEq; -use orion::operators::tensor::{I8Tensor, I8TensorSub}; - -#[test] -#[available_gas(2000000000)] -fn test_gather_elements_i8_3d_default() { - let input_0 = input_0::input_0(); - let input_1 = input_1::input_1(); - let z = output_0::output_0(); - - let y = input_0.gather_elements(indices: input_1, axis: Option::Some(0)); - - assert_eq(y, z); -} diff --git a/tests/nodes/gather_elements_i8_3d_default/input_1.cairo b/tests/nodes/gather_elements_i8_3d_default/input_1.cairo deleted file mode 100644 index f1fca4a90..000000000 --- a/tests/nodes/gather_elements_i8_3d_default/input_1.cairo +++ /dev/null @@ -1,21 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; - -fn input_1() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(1); - data.append(1); - data.append(0); - data.append(1); - data.append(0); - data.append(1); - data.append(1); - data.append(0); - data.append(0); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_i8_3d_default/output_0.cairo b/tests/nodes/gather_elements_i8_3d_default/output_0.cairo deleted file mode 100644 index 264b0285c..000000000 --- a/tests/nodes/gather_elements_i8_3d_default/output_0.cairo +++ /dev/null @@ -1,21 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I8Tensor, I8TensorSub}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(3); - data.append(4); - data.append(2); - data.append(3); - data.append(1); - data.append(5); - data.append(3); - data.append(1); - data.append(2); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_fp16x16_3d_default.cairo b/tests/nodes/gather_elements_negative_indices.cairo similarity index 52% rename from tests/nodes/gather_elements_fp16x16_3d_default.cairo rename to tests/nodes/gather_elements_negative_indices.cairo index 7d1c54b1e..0aff55566 100644 --- a/tests/nodes/gather_elements_fp16x16_3d_default.cairo +++ b/tests/nodes/gather_elements_negative_indices.cairo @@ -4,21 +4,21 @@ mod output_0; use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorSub}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::operators::tensor::FP16x16TensorPartialEq; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::I32TensorPartialEq; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::operators::tensor::FP16x16TensorPartialEq; #[test] #[available_gas(2000000000)] -fn test_gather_elements_fp16x16_3d_default() { +fn test_gather_elements_negative_indices() { let input_0 = input_0::input_0(); let input_1 = input_1::input_1(); - let z = output_0::output_0(); + let z_0 = output_0::output_0(); - let y = input_0.gather_elements(indices: input_1, axis: Option::Some(0)); + let y_0 = input_0.gather_elements(indices:input_1, axis:Option::Some(0)); - assert_eq(y, z); + assert_eq(y_0, z_0); } diff --git a/tests/nodes/gather_elements_negative_indices/input_0.cairo b/tests/nodes/gather_elements_negative_indices/input_0.cairo new file mode 100644 index 000000000..68c12b946 --- /dev/null +++ b/tests/nodes/gather_elements_negative_indices/input_0.cairo @@ -0,0 +1,22 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(3); + shape.append(3); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 262144, sign: false }); + data.append(FP16x16 { mag: 327680, sign: false }); + data.append(FP16x16 { mag: 393216, sign: false }); + data.append(FP16x16 { mag: 458752, sign: false }); + data.append(FP16x16 { mag: 524288, sign: false }); + data.append(FP16x16 { mag: 589824, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/gather_elements_negative_indices/input_1.cairo b/tests/nodes/gather_elements_negative_indices/input_1.cairo new file mode 100644 index 000000000..915663d52 --- /dev/null +++ b/tests/nodes/gather_elements_negative_indices/input_1.cairo @@ -0,0 +1,19 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; + +fn input_1() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(2); + shape.append(3); + + let mut data = ArrayTrait::new(); + data.append(-1); + data.append(-2); + data.append(0); + data.append(-2); + data.append(0); + data.append(0); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/reduce_sum_fp16x16_2D_default/output_0.cairo b/tests/nodes/gather_elements_negative_indices/output_0.cairo similarity index 59% rename from tests/nodes/reduce_sum_fp16x16_2D_default/output_0.cairo rename to tests/nodes/gather_elements_negative_indices/output_0.cairo index bbd646932..5f1934376 100644 --- a/tests/nodes/reduce_sum_fp16x16_2D_default/output_0.cairo +++ b/tests/nodes/gather_elements_negative_indices/output_0.cairo @@ -1,14 +1,19 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorMul}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; use orion::numbers::{FixedTrait, FP16x16}; fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(2); + shape.append(3); let mut data = ArrayTrait::new(); - data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 458752, sign: false }); + data.append(FP16x16 { mag: 327680, sign: false }); + data.append(FP16x16 { mag: 196608, sign: false }); data.append(FP16x16 { mag: 262144, sign: false }); + data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 196608, sign: false }); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/gather_elements_u32_axis1.cairo b/tests/nodes/gather_elements_u32_axis1.cairo deleted file mode 100644 index c1926f886..000000000 --- a/tests/nodes/gather_elements_u32_axis1.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod input_1; -mod output_0; - - -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::U32TensorPartialEq; - -#[test] -#[available_gas(2000000000)] -fn test_gather_elements_u32_axis1() { - let input_0 = input_0::input_0(); - let input_1 = input_1::input_1(); - let z = output_0::output_0(); - - let y = input_0.gather_elements(indices: input_1, axis: Option::Some(1)); - - assert_eq(y, z); -} diff --git a/tests/nodes/gather_elements_u32_axis1/input_0.cairo b/tests/nodes/gather_elements_u32_axis1/input_0.cairo deleted file mode 100644 index 448e91a7e..000000000 --- a/tests/nodes/gather_elements_u32_axis1/input_0.cairo +++ /dev/null @@ -1,122 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(4); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - data.append(4); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(9); - data.append(10); - data.append(11); - data.append(12); - data.append(13); - data.append(14); - data.append(15); - data.append(16); - data.append(17); - data.append(18); - data.append(19); - data.append(20); - data.append(21); - data.append(22); - data.append(23); - data.append(24); - data.append(25); - data.append(26); - data.append(27); - data.append(28); - data.append(29); - data.append(30); - data.append(31); - data.append(32); - data.append(33); - data.append(34); - data.append(35); - data.append(36); - data.append(37); - data.append(38); - data.append(39); - data.append(40); - data.append(41); - data.append(42); - data.append(43); - data.append(44); - data.append(45); - data.append(46); - data.append(47); - data.append(48); - data.append(49); - data.append(50); - data.append(51); - data.append(52); - data.append(53); - data.append(54); - data.append(55); - data.append(56); - data.append(57); - data.append(58); - data.append(59); - data.append(60); - data.append(61); - data.append(62); - data.append(63); - data.append(64); - data.append(65); - data.append(66); - data.append(67); - data.append(68); - data.append(69); - data.append(70); - data.append(71); - data.append(72); - data.append(73); - data.append(74); - data.append(75); - data.append(76); - data.append(77); - data.append(78); - data.append(79); - data.append(80); - data.append(81); - data.append(82); - data.append(83); - data.append(84); - data.append(85); - data.append(86); - data.append(87); - data.append(88); - data.append(89); - data.append(90); - data.append(91); - data.append(92); - data.append(93); - data.append(94); - data.append(95); - data.append(96); - data.append(97); - data.append(98); - data.append(99); - data.append(100); - data.append(101); - data.append(102); - data.append(103); - data.append(104); - data.append(105); - data.append(106); - data.append(107); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_u32_axis1/input_1.cairo b/tests/nodes/gather_elements_u32_axis1/input_1.cairo deleted file mode 100644 index ab2deb4c3..000000000 --- a/tests/nodes/gather_elements_u32_axis1/input_1.cairo +++ /dev/null @@ -1,194 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; - -fn input_1() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(5); - shape.append(4); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(2); - data.append(0); - data.append(2); - data.append(2); - data.append(1); - data.append(0); - data.append(2); - data.append(0); - data.append(0); - data.append(0); - data.append(0); - data.append(0); - data.append(1); - data.append(2); - data.append(1); - data.append(2); - data.append(0); - data.append(1); - data.append(1); - data.append(1); - data.append(0); - data.append(2); - data.append(2); - data.append(1); - data.append(0); - data.append(2); - data.append(2); - data.append(1); - data.append(0); - data.append(1); - data.append(0); - data.append(0); - data.append(2); - data.append(0); - data.append(1); - data.append(0); - data.append(1); - data.append(1); - data.append(0); - data.append(2); - data.append(2); - data.append(2); - data.append(1); - data.append(0); - data.append(0); - data.append(1); - data.append(2); - data.append(0); - data.append(0); - data.append(2); - data.append(2); - data.append(2); - data.append(1); - data.append(2); - data.append(2); - data.append(0); - data.append(2); - data.append(2); - data.append(0); - data.append(1); - data.append(1); - data.append(0); - data.append(1); - data.append(1); - data.append(2); - data.append(2); - data.append(0); - data.append(2); - data.append(2); - data.append(2); - data.append(2); - data.append(2); - data.append(2); - data.append(0); - data.append(0); - data.append(0); - data.append(0); - data.append(0); - data.append(0); - data.append(1); - data.append(1); - data.append(2); - data.append(0); - data.append(0); - data.append(2); - data.append(1); - data.append(2); - data.append(1); - data.append(1); - data.append(2); - data.append(0); - data.append(1); - data.append(0); - data.append(2); - data.append(1); - data.append(2); - data.append(2); - data.append(2); - data.append(0); - data.append(0); - data.append(1); - data.append(1); - data.append(0); - data.append(1); - data.append(2); - data.append(2); - data.append(0); - data.append(0); - data.append(0); - data.append(1); - data.append(0); - data.append(1); - data.append(2); - data.append(1); - data.append(2); - data.append(0); - data.append(0); - data.append(1); - data.append(2); - data.append(2); - data.append(1); - data.append(0); - data.append(1); - data.append(0); - data.append(0); - data.append(2); - data.append(2); - data.append(0); - data.append(2); - data.append(1); - data.append(1); - data.append(1); - data.append(0); - data.append(1); - data.append(2); - data.append(0); - data.append(2); - data.append(0); - data.append(1); - data.append(1); - data.append(1); - data.append(0); - data.append(1); - data.append(0); - data.append(2); - data.append(1); - data.append(1); - data.append(0); - data.append(1); - data.append(0); - data.append(2); - data.append(1); - data.append(1); - data.append(0); - data.append(2); - data.append(2); - data.append(1); - data.append(0); - data.append(1); - data.append(2); - data.append(0); - data.append(0); - data.append(1); - data.append(0); - data.append(1); - data.append(2); - data.append(2); - data.append(0); - data.append(2); - data.append(0); - data.append(2); - data.append(0); - data.append(2); - data.append(2); - data.append(2); - data.append(0); - data.append(0); - data.append(0); - data.append(2); - data.append(2); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_u32_axis1/output_0.cairo b/tests/nodes/gather_elements_u32_axis1/output_0.cairo deleted file mode 100644 index a059c88ba..000000000 --- a/tests/nodes/gather_elements_u32_axis1/output_0.cairo +++ /dev/null @@ -1,194 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(5); - shape.append(4); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(24); - data.append(1); - data.append(26); - data.append(27); - data.append(16); - data.append(5); - data.append(30); - data.append(7); - data.append(8); - data.append(9); - data.append(10); - data.append(11); - data.append(12); - data.append(25); - data.append(14); - data.append(27); - data.append(4); - data.append(17); - data.append(18); - data.append(19); - data.append(8); - data.append(33); - data.append(34); - data.append(23); - data.append(0); - data.append(25); - data.append(26); - data.append(15); - data.append(4); - data.append(17); - data.append(6); - data.append(7); - data.append(32); - data.append(9); - data.append(22); - data.append(11); - data.append(12); - data.append(13); - data.append(2); - data.append(27); - data.append(28); - data.append(29); - data.append(18); - data.append(7); - data.append(8); - data.append(21); - data.append(34); - data.append(11); - data.append(0); - data.append(25); - data.append(26); - data.append(27); - data.append(16); - data.append(29); - data.append(30); - data.append(7); - data.append(32); - data.append(33); - data.append(10); - data.append(23); - data.append(48); - data.append(37); - data.append(50); - data.append(51); - data.append(64); - data.append(65); - data.append(42); - data.append(67); - data.append(68); - data.append(69); - data.append(70); - data.append(71); - data.append(60); - data.append(37); - data.append(38); - data.append(39); - data.append(40); - data.append(41); - data.append(42); - data.append(55); - data.append(56); - data.append(69); - data.append(46); - data.append(47); - data.append(60); - data.append(49); - data.append(62); - data.append(51); - data.append(52); - data.append(65); - data.append(42); - data.append(55); - data.append(44); - data.append(69); - data.append(58); - data.append(71); - data.append(60); - data.append(61); - data.append(38); - data.append(39); - data.append(52); - data.append(53); - data.append(42); - data.append(55); - data.append(68); - data.append(69); - data.append(46); - data.append(47); - data.append(36); - data.append(49); - data.append(38); - data.append(51); - data.append(64); - data.append(53); - data.append(66); - data.append(43); - data.append(44); - data.append(57); - data.append(70); - data.append(71); - data.append(84); - data.append(73); - data.append(86); - data.append(75); - data.append(76); - data.append(101); - data.append(102); - data.append(79); - data.append(104); - data.append(93); - data.append(94); - data.append(95); - data.append(72); - data.append(85); - data.append(98); - data.append(75); - data.append(100); - data.append(77); - data.append(90); - data.append(91); - data.append(92); - data.append(81); - data.append(94); - data.append(83); - data.append(96); - data.append(85); - data.append(86); - data.append(75); - data.append(88); - data.append(77); - data.append(102); - data.append(91); - data.append(92); - data.append(81); - data.append(106); - data.append(107); - data.append(84); - data.append(73); - data.append(86); - data.append(99); - data.append(76); - data.append(77); - data.append(90); - data.append(79); - data.append(92); - data.append(105); - data.append(106); - data.append(83); - data.append(96); - data.append(73); - data.append(98); - data.append(75); - data.append(100); - data.append(101); - data.append(102); - data.append(79); - data.append(80); - data.append(81); - data.append(106); - data.append(107); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_u32_axis2.cairo b/tests/nodes/gather_elements_u32_axis2.cairo deleted file mode 100644 index 66a23c66b..000000000 --- a/tests/nodes/gather_elements_u32_axis2.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod input_1; -mod output_0; - - -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::U32TensorPartialEq; - -#[test] -#[available_gas(2000000000)] -fn test_gather_elements_u32_axis2() { - let input_0 = input_0::input_0(); - let input_1 = input_1::input_1(); - let z = output_0::output_0(); - - let y = input_0.gather_elements(indices: input_1, axis: Option::Some(2)); - - assert_eq(y, z); -} diff --git a/tests/nodes/gather_elements_u32_axis2/input_0.cairo b/tests/nodes/gather_elements_u32_axis2/input_0.cairo deleted file mode 100644 index 448e91a7e..000000000 --- a/tests/nodes/gather_elements_u32_axis2/input_0.cairo +++ /dev/null @@ -1,122 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(4); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - data.append(4); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(9); - data.append(10); - data.append(11); - data.append(12); - data.append(13); - data.append(14); - data.append(15); - data.append(16); - data.append(17); - data.append(18); - data.append(19); - data.append(20); - data.append(21); - data.append(22); - data.append(23); - data.append(24); - data.append(25); - data.append(26); - data.append(27); - data.append(28); - data.append(29); - data.append(30); - data.append(31); - data.append(32); - data.append(33); - data.append(34); - data.append(35); - data.append(36); - data.append(37); - data.append(38); - data.append(39); - data.append(40); - data.append(41); - data.append(42); - data.append(43); - data.append(44); - data.append(45); - data.append(46); - data.append(47); - data.append(48); - data.append(49); - data.append(50); - data.append(51); - data.append(52); - data.append(53); - data.append(54); - data.append(55); - data.append(56); - data.append(57); - data.append(58); - data.append(59); - data.append(60); - data.append(61); - data.append(62); - data.append(63); - data.append(64); - data.append(65); - data.append(66); - data.append(67); - data.append(68); - data.append(69); - data.append(70); - data.append(71); - data.append(72); - data.append(73); - data.append(74); - data.append(75); - data.append(76); - data.append(77); - data.append(78); - data.append(79); - data.append(80); - data.append(81); - data.append(82); - data.append(83); - data.append(84); - data.append(85); - data.append(86); - data.append(87); - data.append(88); - data.append(89); - data.append(90); - data.append(91); - data.append(92); - data.append(93); - data.append(94); - data.append(95); - data.append(96); - data.append(97); - data.append(98); - data.append(99); - data.append(100); - data.append(101); - data.append(102); - data.append(103); - data.append(104); - data.append(105); - data.append(106); - data.append(107); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_u32_axis2/input_1.cairo b/tests/nodes/gather_elements_u32_axis2/input_1.cairo deleted file mode 100644 index 172e6d020..000000000 --- a/tests/nodes/gather_elements_u32_axis2/input_1.cairo +++ /dev/null @@ -1,122 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; - -fn input_1() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(4); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(2); - data.append(2); - data.append(0); - data.append(1); - data.append(2); - data.append(1); - data.append(2); - data.append(1); - data.append(2); - data.append(0); - data.append(0); - data.append(2); - data.append(2); - data.append(2); - data.append(0); - data.append(0); - data.append(1); - data.append(1); - data.append(1); - data.append(0); - data.append(1); - data.append(1); - data.append(0); - data.append(2); - data.append(0); - data.append(2); - data.append(0); - data.append(1); - data.append(1); - data.append(2); - data.append(1); - data.append(0); - data.append(2); - data.append(2); - data.append(1); - data.append(0); - data.append(0); - data.append(0); - data.append(1); - data.append(0); - data.append(1); - data.append(2); - data.append(2); - data.append(0); - data.append(1); - data.append(0); - data.append(2); - data.append(2); - data.append(0); - data.append(1); - data.append(1); - data.append(0); - data.append(2); - data.append(1); - data.append(0); - data.append(0); - data.append(2); - data.append(1); - data.append(2); - data.append(2); - data.append(1); - data.append(1); - data.append(0); - data.append(1); - data.append(0); - data.append(0); - data.append(0); - data.append(0); - data.append(2); - data.append(1); - data.append(0); - data.append(1); - data.append(1); - data.append(0); - data.append(2); - data.append(1); - data.append(2); - data.append(1); - data.append(1); - data.append(0); - data.append(1); - data.append(0); - data.append(1); - data.append(0); - data.append(0); - data.append(1); - data.append(2); - data.append(1); - data.append(2); - data.append(1); - data.append(0); - data.append(0); - data.append(1); - data.append(2); - data.append(2); - data.append(1); - data.append(0); - data.append(2); - data.append(0); - data.append(1); - data.append(1); - data.append(1); - data.append(2); - data.append(2); - data.append(0); - data.append(0); - data.append(2); - data.append(2); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_u32_axis2/output_0.cairo b/tests/nodes/gather_elements_u32_axis2/output_0.cairo deleted file mode 100644 index da57b3055..000000000 --- a/tests/nodes/gather_elements_u32_axis2/output_0.cairo +++ /dev/null @@ -1,122 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(4); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(6); - data.append(7); - data.append(2); - data.append(3); - data.append(7); - data.append(5); - data.append(6); - data.append(4); - data.append(8); - data.append(0); - data.append(1); - data.append(8); - data.append(18); - data.append(19); - data.append(14); - data.append(12); - data.append(16); - data.append(17); - data.append(15); - data.append(13); - data.append(17); - data.append(15); - data.append(13); - data.append(20); - data.append(24); - data.append(31); - data.append(26); - data.append(27); - data.append(28); - data.append(32); - data.append(27); - data.append(25); - data.append(32); - data.append(30); - data.append(28); - data.append(26); - data.append(36); - data.append(37); - data.append(41); - data.append(36); - data.append(40); - data.append(44); - data.append(42); - data.append(37); - data.append(41); - data.append(36); - data.append(43); - data.append(44); - data.append(48); - data.append(52); - data.append(53); - data.append(48); - data.append(55); - data.append(53); - data.append(48); - data.append(49); - data.append(56); - data.append(51); - data.append(55); - data.append(56); - data.append(63); - data.append(64); - data.append(62); - data.append(63); - data.append(61); - data.append(62); - data.append(60); - data.append(61); - data.append(68); - data.append(63); - data.append(61); - data.append(65); - data.append(75); - data.append(73); - data.append(80); - data.append(75); - data.append(79); - data.append(77); - data.append(75); - data.append(73); - data.append(77); - data.append(72); - data.append(76); - data.append(74); - data.append(84); - data.append(88); - data.append(92); - data.append(87); - data.append(91); - data.append(89); - data.append(84); - data.append(85); - data.append(89); - data.append(90); - data.append(91); - data.append(89); - data.append(96); - data.append(103); - data.append(98); - data.append(99); - data.append(100); - data.append(101); - data.append(102); - data.append(103); - data.append(98); - data.append(96); - data.append(103); - data.append(104); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_u32_axis3.cairo b/tests/nodes/gather_elements_u32_axis3.cairo deleted file mode 100644 index 020d1f519..000000000 --- a/tests/nodes/gather_elements_u32_axis3.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod input_1; -mod output_0; - - -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::U32TensorPartialEq; - -#[test] -#[available_gas(2000000000)] -fn test_gather_elements_u32_axis3() { - let input_0 = input_0::input_0(); - let input_1 = input_1::input_1(); - let z = output_0::output_0(); - - let y = input_0.gather_elements(indices: input_1, axis: Option::Some(3)); - - assert_eq(y, z); -} diff --git a/tests/nodes/gather_elements_u32_axis3/input_0.cairo b/tests/nodes/gather_elements_u32_axis3/input_0.cairo deleted file mode 100644 index 448e91a7e..000000000 --- a/tests/nodes/gather_elements_u32_axis3/input_0.cairo +++ /dev/null @@ -1,122 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(4); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - data.append(4); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(9); - data.append(10); - data.append(11); - data.append(12); - data.append(13); - data.append(14); - data.append(15); - data.append(16); - data.append(17); - data.append(18); - data.append(19); - data.append(20); - data.append(21); - data.append(22); - data.append(23); - data.append(24); - data.append(25); - data.append(26); - data.append(27); - data.append(28); - data.append(29); - data.append(30); - data.append(31); - data.append(32); - data.append(33); - data.append(34); - data.append(35); - data.append(36); - data.append(37); - data.append(38); - data.append(39); - data.append(40); - data.append(41); - data.append(42); - data.append(43); - data.append(44); - data.append(45); - data.append(46); - data.append(47); - data.append(48); - data.append(49); - data.append(50); - data.append(51); - data.append(52); - data.append(53); - data.append(54); - data.append(55); - data.append(56); - data.append(57); - data.append(58); - data.append(59); - data.append(60); - data.append(61); - data.append(62); - data.append(63); - data.append(64); - data.append(65); - data.append(66); - data.append(67); - data.append(68); - data.append(69); - data.append(70); - data.append(71); - data.append(72); - data.append(73); - data.append(74); - data.append(75); - data.append(76); - data.append(77); - data.append(78); - data.append(79); - data.append(80); - data.append(81); - data.append(82); - data.append(83); - data.append(84); - data.append(85); - data.append(86); - data.append(87); - data.append(88); - data.append(89); - data.append(90); - data.append(91); - data.append(92); - data.append(93); - data.append(94); - data.append(95); - data.append(96); - data.append(97); - data.append(98); - data.append(99); - data.append(100); - data.append(101); - data.append(102); - data.append(103); - data.append(104); - data.append(105); - data.append(106); - data.append(107); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_u32_axis3/input_1.cairo b/tests/nodes/gather_elements_u32_axis3/input_1.cairo deleted file mode 100644 index 727fa793f..000000000 --- a/tests/nodes/gather_elements_u32_axis3/input_1.cairo +++ /dev/null @@ -1,230 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; - -fn input_1() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(4); - shape.append(6); - - let mut data = ArrayTrait::new(); - data.append(2); - data.append(2); - data.append(1); - data.append(1); - data.append(0); - data.append(0); - data.append(1); - data.append(1); - data.append(0); - data.append(2); - data.append(0); - data.append(1); - data.append(0); - data.append(2); - data.append(1); - data.append(2); - data.append(2); - data.append(0); - data.append(1); - data.append(1); - data.append(0); - data.append(1); - data.append(2); - data.append(0); - data.append(0); - data.append(2); - data.append(2); - data.append(2); - data.append(2); - data.append(1); - data.append(1); - data.append(0); - data.append(2); - data.append(2); - data.append(2); - data.append(0); - data.append(0); - data.append(2); - data.append(0); - data.append(2); - data.append(0); - data.append(1); - data.append(1); - data.append(2); - data.append(0); - data.append(0); - data.append(1); - data.append(0); - data.append(0); - data.append(0); - data.append(1); - data.append(2); - data.append(2); - data.append(0); - data.append(1); - data.append(1); - data.append(1); - data.append(1); - data.append(2); - data.append(2); - data.append(0); - data.append(0); - data.append(0); - data.append(2); - data.append(2); - data.append(2); - data.append(2); - data.append(2); - data.append(0); - data.append(1); - data.append(2); - data.append(0); - data.append(1); - data.append(0); - data.append(2); - data.append(2); - data.append(2); - data.append(0); - data.append(2); - data.append(0); - data.append(0); - data.append(2); - data.append(0); - data.append(0); - data.append(2); - data.append(1); - data.append(1); - data.append(2); - data.append(0); - data.append(2); - data.append(1); - data.append(0); - data.append(2); - data.append(0); - data.append(1); - data.append(0); - data.append(2); - data.append(0); - data.append(2); - data.append(0); - data.append(2); - data.append(1); - data.append(0); - data.append(1); - data.append(1); - data.append(0); - data.append(2); - data.append(1); - data.append(1); - data.append(0); - data.append(1); - data.append(1); - data.append(1); - data.append(0); - data.append(0); - data.append(1); - data.append(2); - data.append(2); - data.append(1); - data.append(1); - data.append(0); - data.append(1); - data.append(1); - data.append(2); - data.append(1); - data.append(1); - data.append(0); - data.append(2); - data.append(2); - data.append(1); - data.append(2); - data.append(2); - data.append(1); - data.append(2); - data.append(1); - data.append(2); - data.append(1); - data.append(2); - data.append(0); - data.append(2); - data.append(2); - data.append(0); - data.append(1); - data.append(0); - data.append(1); - data.append(0); - data.append(1); - data.append(0); - data.append(0); - data.append(2); - data.append(2); - data.append(2); - data.append(2); - data.append(1); - data.append(1); - data.append(2); - data.append(1); - data.append(0); - data.append(0); - data.append(2); - data.append(1); - data.append(1); - data.append(2); - data.append(0); - data.append(0); - data.append(1); - data.append(1); - data.append(2); - data.append(1); - data.append(1); - data.append(2); - data.append(1); - data.append(1); - data.append(2); - data.append(2); - data.append(0); - data.append(1); - data.append(1); - data.append(0); - data.append(0); - data.append(0); - data.append(2); - data.append(2); - data.append(0); - data.append(0); - data.append(1); - data.append(0); - data.append(2); - data.append(1); - data.append(0); - data.append(2); - data.append(2); - data.append(1); - data.append(1); - data.append(1); - data.append(1); - data.append(2); - data.append(0); - data.append(0); - data.append(2); - data.append(2); - data.append(2); - data.append(1); - data.append(1); - data.append(0); - data.append(1); - data.append(1); - data.append(1); - data.append(2); - data.append(0); - data.append(0); - data.append(0); - data.append(1); - data.append(1); - data.append(0); - data.append(1); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_u32_axis3/output_0.cairo b/tests/nodes/gather_elements_u32_axis3/output_0.cairo deleted file mode 100644 index eb4f17465..000000000 --- a/tests/nodes/gather_elements_u32_axis3/output_0.cairo +++ /dev/null @@ -1,230 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(4); - shape.append(6); - - let mut data = ArrayTrait::new(); - data.append(2); - data.append(2); - data.append(1); - data.append(1); - data.append(0); - data.append(0); - data.append(4); - data.append(4); - data.append(3); - data.append(5); - data.append(3); - data.append(4); - data.append(6); - data.append(8); - data.append(7); - data.append(8); - data.append(8); - data.append(6); - data.append(10); - data.append(10); - data.append(9); - data.append(10); - data.append(11); - data.append(9); - data.append(12); - data.append(14); - data.append(14); - data.append(14); - data.append(14); - data.append(13); - data.append(16); - data.append(15); - data.append(17); - data.append(17); - data.append(17); - data.append(15); - data.append(18); - data.append(20); - data.append(18); - data.append(20); - data.append(18); - data.append(19); - data.append(22); - data.append(23); - data.append(21); - data.append(21); - data.append(22); - data.append(21); - data.append(24); - data.append(24); - data.append(25); - data.append(26); - data.append(26); - data.append(24); - data.append(28); - data.append(28); - data.append(28); - data.append(28); - data.append(29); - data.append(29); - data.append(30); - data.append(30); - data.append(30); - data.append(32); - data.append(32); - data.append(32); - data.append(35); - data.append(35); - data.append(33); - data.append(34); - data.append(35); - data.append(33); - data.append(37); - data.append(36); - data.append(38); - data.append(38); - data.append(38); - data.append(36); - data.append(41); - data.append(39); - data.append(39); - data.append(41); - data.append(39); - data.append(39); - data.append(44); - data.append(43); - data.append(43); - data.append(44); - data.append(42); - data.append(44); - data.append(46); - data.append(45); - data.append(47); - data.append(45); - data.append(46); - data.append(45); - data.append(50); - data.append(48); - data.append(50); - data.append(48); - data.append(50); - data.append(49); - data.append(51); - data.append(52); - data.append(52); - data.append(51); - data.append(53); - data.append(52); - data.append(55); - data.append(54); - data.append(55); - data.append(55); - data.append(55); - data.append(54); - data.append(57); - data.append(58); - data.append(59); - data.append(59); - data.append(58); - data.append(58); - data.append(60); - data.append(61); - data.append(61); - data.append(62); - data.append(61); - data.append(61); - data.append(63); - data.append(65); - data.append(65); - data.append(64); - data.append(65); - data.append(65); - data.append(67); - data.append(68); - data.append(67); - data.append(68); - data.append(67); - data.append(68); - data.append(69); - data.append(71); - data.append(71); - data.append(69); - data.append(70); - data.append(69); - data.append(73); - data.append(72); - data.append(73); - data.append(72); - data.append(72); - data.append(74); - data.append(77); - data.append(77); - data.append(77); - data.append(76); - data.append(76); - data.append(77); - data.append(79); - data.append(78); - data.append(78); - data.append(80); - data.append(79); - data.append(79); - data.append(83); - data.append(81); - data.append(81); - data.append(82); - data.append(82); - data.append(83); - data.append(85); - data.append(85); - data.append(86); - data.append(85); - data.append(85); - data.append(86); - data.append(89); - data.append(87); - data.append(88); - data.append(88); - data.append(87); - data.append(87); - data.append(90); - data.append(92); - data.append(92); - data.append(90); - data.append(90); - data.append(91); - data.append(93); - data.append(95); - data.append(94); - data.append(93); - data.append(95); - data.append(95); - data.append(97); - data.append(97); - data.append(97); - data.append(97); - data.append(98); - data.append(96); - data.append(99); - data.append(101); - data.append(101); - data.append(101); - data.append(100); - data.append(100); - data.append(102); - data.append(103); - data.append(103); - data.append(103); - data.append(104); - data.append(102); - data.append(105); - data.append(105); - data.append(106); - data.append(106); - data.append(105); - data.append(106); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_u32_default.cairo b/tests/nodes/gather_elements_u32_default.cairo deleted file mode 100644 index 0674675d4..000000000 --- a/tests/nodes/gather_elements_u32_default.cairo +++ /dev/null @@ -1,22 +0,0 @@ -mod input_0; -mod input_1; -mod output_0; - - -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::U32TensorPartialEq; - -#[test] -#[available_gas(2000000000)] -fn test_gather_elements_u32_default() { - let input_0 = input_0::input_0(); - let input_1 = input_1::input_1(); - let z = output_0::output_0(); - - let y = input_0.gather_elements(indices: input_1, axis: Option::Some(0)); - - assert_eq(y, z); -} diff --git a/tests/nodes/gather_elements_u32_default/input_0.cairo b/tests/nodes/gather_elements_u32_default/input_0.cairo deleted file mode 100644 index 448e91a7e..000000000 --- a/tests/nodes/gather_elements_u32_default/input_0.cairo +++ /dev/null @@ -1,122 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(4); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - data.append(4); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(9); - data.append(10); - data.append(11); - data.append(12); - data.append(13); - data.append(14); - data.append(15); - data.append(16); - data.append(17); - data.append(18); - data.append(19); - data.append(20); - data.append(21); - data.append(22); - data.append(23); - data.append(24); - data.append(25); - data.append(26); - data.append(27); - data.append(28); - data.append(29); - data.append(30); - data.append(31); - data.append(32); - data.append(33); - data.append(34); - data.append(35); - data.append(36); - data.append(37); - data.append(38); - data.append(39); - data.append(40); - data.append(41); - data.append(42); - data.append(43); - data.append(44); - data.append(45); - data.append(46); - data.append(47); - data.append(48); - data.append(49); - data.append(50); - data.append(51); - data.append(52); - data.append(53); - data.append(54); - data.append(55); - data.append(56); - data.append(57); - data.append(58); - data.append(59); - data.append(60); - data.append(61); - data.append(62); - data.append(63); - data.append(64); - data.append(65); - data.append(66); - data.append(67); - data.append(68); - data.append(69); - data.append(70); - data.append(71); - data.append(72); - data.append(73); - data.append(74); - data.append(75); - data.append(76); - data.append(77); - data.append(78); - data.append(79); - data.append(80); - data.append(81); - data.append(82); - data.append(83); - data.append(84); - data.append(85); - data.append(86); - data.append(87); - data.append(88); - data.append(89); - data.append(90); - data.append(91); - data.append(92); - data.append(93); - data.append(94); - data.append(95); - data.append(96); - data.append(97); - data.append(98); - data.append(99); - data.append(100); - data.append(101); - data.append(102); - data.append(103); - data.append(104); - data.append(105); - data.append(106); - data.append(107); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_u32_default/input_1.cairo b/tests/nodes/gather_elements_u32_default/input_1.cairo deleted file mode 100644 index 75c7988d5..000000000 --- a/tests/nodes/gather_elements_u32_default/input_1.cairo +++ /dev/null @@ -1,374 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; - -fn input_1() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(10); - shape.append(3); - shape.append(4); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(1); - data.append(0); - data.append(0); - data.append(0); - data.append(2); - data.append(1); - data.append(1); - data.append(2); - data.append(1); - data.append(0); - data.append(1); - data.append(2); - data.append(0); - data.append(1); - data.append(0); - data.append(1); - data.append(2); - data.append(1); - data.append(1); - data.append(1); - data.append(0); - data.append(1); - data.append(1); - data.append(0); - data.append(2); - data.append(1); - data.append(1); - data.append(2); - data.append(1); - data.append(2); - data.append(2); - data.append(0); - data.append(1); - data.append(0); - data.append(2); - data.append(0); - data.append(1); - data.append(0); - data.append(1); - data.append(0); - data.append(0); - data.append(2); - data.append(2); - data.append(2); - data.append(0); - data.append(1); - data.append(0); - data.append(0); - data.append(0); - data.append(1); - data.append(2); - data.append(2); - data.append(1); - data.append(0); - data.append(2); - data.append(2); - data.append(2); - data.append(2); - data.append(0); - data.append(2); - data.append(1); - data.append(1); - data.append(1); - data.append(2); - data.append(0); - data.append(0); - data.append(1); - data.append(0); - data.append(1); - data.append(1); - data.append(1); - data.append(2); - data.append(2); - data.append(1); - data.append(1); - data.append(2); - data.append(0); - data.append(2); - data.append(1); - data.append(0); - data.append(1); - data.append(0); - data.append(0); - data.append(2); - data.append(1); - data.append(1); - data.append(0); - data.append(0); - data.append(2); - data.append(2); - data.append(2); - data.append(2); - data.append(2); - data.append(1); - data.append(1); - data.append(1); - data.append(2); - data.append(2); - data.append(2); - data.append(1); - data.append(0); - data.append(1); - data.append(1); - data.append(2); - data.append(2); - data.append(0); - data.append(0); - data.append(0); - data.append(1); - data.append(0); - data.append(1); - data.append(2); - data.append(1); - data.append(1); - data.append(1); - data.append(2); - data.append(1); - data.append(1); - data.append(2); - data.append(2); - data.append(0); - data.append(0); - data.append(1); - data.append(1); - data.append(0); - data.append(1); - data.append(0); - data.append(2); - data.append(1); - data.append(0); - data.append(1); - data.append(0); - data.append(1); - data.append(1); - data.append(1); - data.append(0); - data.append(0); - data.append(2); - data.append(2); - data.append(2); - data.append(2); - data.append(2); - data.append(2); - data.append(1); - data.append(1); - data.append(0); - data.append(0); - data.append(2); - data.append(0); - data.append(0); - data.append(2); - data.append(2); - data.append(2); - data.append(1); - data.append(2); - data.append(1); - data.append(0); - data.append(2); - data.append(2); - data.append(0); - data.append(2); - data.append(2); - data.append(0); - data.append(1); - data.append(0); - data.append(1); - data.append(0); - data.append(2); - data.append(2); - data.append(0); - data.append(1); - data.append(0); - data.append(1); - data.append(2); - data.append(0); - data.append(2); - data.append(0); - data.append(1); - data.append(0); - data.append(0); - data.append(2); - data.append(1); - data.append(2); - data.append(1); - data.append(1); - data.append(2); - data.append(0); - data.append(0); - data.append(0); - data.append(2); - data.append(2); - data.append(0); - data.append(2); - data.append(0); - data.append(1); - data.append(2); - data.append(2); - data.append(2); - data.append(1); - data.append(2); - data.append(0); - data.append(2); - data.append(2); - data.append(0); - data.append(0); - data.append(0); - data.append(2); - data.append(1); - data.append(0); - data.append(2); - data.append(0); - data.append(0); - data.append(0); - data.append(2); - data.append(1); - data.append(2); - data.append(1); - data.append(1); - data.append(2); - data.append(0); - data.append(1); - data.append(2); - data.append(1); - data.append(1); - data.append(0); - data.append(0); - data.append(0); - data.append(1); - data.append(2); - data.append(1); - data.append(2); - data.append(0); - data.append(1); - data.append(1); - data.append(1); - data.append(1); - data.append(0); - data.append(2); - data.append(2); - data.append(1); - data.append(0); - data.append(1); - data.append(2); - data.append(0); - data.append(2); - data.append(2); - data.append(1); - data.append(0); - data.append(2); - data.append(2); - data.append(1); - data.append(1); - data.append(0); - data.append(2); - data.append(0); - data.append(1); - data.append(0); - data.append(0); - data.append(1); - data.append(0); - data.append(0); - data.append(2); - data.append(1); - data.append(0); - data.append(2); - data.append(0); - data.append(2); - data.append(2); - data.append(0); - data.append(0); - data.append(1); - data.append(2); - data.append(2); - data.append(1); - data.append(2); - data.append(0); - data.append(2); - data.append(1); - data.append(2); - data.append(0); - data.append(2); - data.append(2); - data.append(1); - data.append(2); - data.append(2); - data.append(0); - data.append(2); - data.append(2); - data.append(2); - data.append(1); - data.append(0); - data.append(1); - data.append(1); - data.append(0); - data.append(2); - data.append(0); - data.append(1); - data.append(0); - data.append(2); - data.append(2); - data.append(0); - data.append(2); - data.append(1); - data.append(0); - data.append(0); - data.append(1); - data.append(0); - data.append(0); - data.append(2); - data.append(0); - data.append(1); - data.append(2); - data.append(1); - data.append(1); - data.append(1); - data.append(1); - data.append(1); - data.append(1); - data.append(0); - data.append(0); - data.append(0); - data.append(2); - data.append(0); - data.append(1); - data.append(0); - data.append(0); - data.append(1); - data.append(0); - data.append(2); - data.append(0); - data.append(2); - data.append(1); - data.append(2); - data.append(1); - data.append(1); - data.append(1); - data.append(1); - data.append(2); - data.append(1); - data.append(1); - data.append(1); - data.append(2); - data.append(0); - data.append(1); - data.append(2); - data.append(1); - data.append(2); - data.append(0); - data.append(0); - data.append(0); - data.append(1); - data.append(0); - data.append(0); - data.append(1); - data.append(1); - data.append(0); - data.append(0); - data.append(1); - data.append(2); - data.append(2); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_elements_u32_default/output_0.cairo b/tests/nodes/gather_elements_u32_default/output_0.cairo deleted file mode 100644 index 4e6add915..000000000 --- a/tests/nodes/gather_elements_u32_default/output_0.cairo +++ /dev/null @@ -1,374 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(10); - shape.append(3); - shape.append(4); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(36); - data.append(1); - data.append(2); - data.append(3); - data.append(76); - data.append(41); - data.append(42); - data.append(79); - data.append(44); - data.append(9); - data.append(46); - data.append(83); - data.append(12); - data.append(49); - data.append(14); - data.append(51); - data.append(88); - data.append(53); - data.append(54); - data.append(55); - data.append(20); - data.append(57); - data.append(58); - data.append(23); - data.append(96); - data.append(61); - data.append(62); - data.append(99); - data.append(64); - data.append(101); - data.append(102); - data.append(31); - data.append(68); - data.append(33); - data.append(106); - data.append(35); - data.append(36); - data.append(1); - data.append(38); - data.append(3); - data.append(4); - data.append(77); - data.append(78); - data.append(79); - data.append(8); - data.append(45); - data.append(10); - data.append(11); - data.append(12); - data.append(49); - data.append(86); - data.append(87); - data.append(52); - data.append(17); - data.append(90); - data.append(91); - data.append(92); - data.append(93); - data.append(22); - data.append(95); - data.append(60); - data.append(61); - data.append(62); - data.append(99); - data.append(28); - data.append(29); - data.append(66); - data.append(31); - data.append(68); - data.append(69); - data.append(70); - data.append(107); - data.append(72); - data.append(37); - data.append(38); - data.append(75); - data.append(4); - data.append(77); - data.append(42); - data.append(7); - data.append(44); - data.append(9); - data.append(10); - data.append(83); - data.append(48); - data.append(49); - data.append(14); - data.append(15); - data.append(88); - data.append(89); - data.append(90); - data.append(91); - data.append(92); - data.append(57); - data.append(58); - data.append(59); - data.append(96); - data.append(97); - data.append(98); - data.append(63); - data.append(28); - data.append(65); - data.append(66); - data.append(103); - data.append(104); - data.append(33); - data.append(34); - data.append(35); - data.append(36); - data.append(1); - data.append(38); - data.append(75); - data.append(40); - data.append(41); - data.append(42); - data.append(79); - data.append(44); - data.append(45); - data.append(82); - data.append(83); - data.append(12); - data.append(13); - data.append(50); - data.append(51); - data.append(16); - data.append(53); - data.append(18); - data.append(91); - data.append(56); - data.append(21); - data.append(58); - data.append(23); - data.append(60); - data.append(61); - data.append(62); - data.append(27); - data.append(28); - data.append(101); - data.append(102); - data.append(103); - data.append(104); - data.append(105); - data.append(106); - data.append(71); - data.append(36); - data.append(1); - data.append(2); - data.append(75); - data.append(4); - data.append(5); - data.append(78); - data.append(79); - data.append(80); - data.append(45); - data.append(82); - data.append(47); - data.append(12); - data.append(85); - data.append(86); - data.append(15); - data.append(88); - data.append(89); - data.append(18); - data.append(55); - data.append(20); - data.append(57); - data.append(22); - data.append(95); - data.append(96); - data.append(25); - data.append(62); - data.append(27); - data.append(64); - data.append(101); - data.append(30); - data.append(103); - data.append(32); - data.append(69); - data.append(34); - data.append(35); - data.append(72); - data.append(37); - data.append(74); - data.append(39); - data.append(40); - data.append(77); - data.append(6); - data.append(7); - data.append(8); - data.append(81); - data.append(82); - data.append(11); - data.append(84); - data.append(13); - data.append(50); - data.append(87); - data.append(88); - data.append(89); - data.append(54); - data.append(91); - data.append(20); - data.append(93); - data.append(94); - data.append(23); - data.append(24); - data.append(25); - data.append(98); - data.append(63); - data.append(28); - data.append(101); - data.append(30); - data.append(31); - data.append(32); - data.append(105); - data.append(70); - data.append(107); - data.append(36); - data.append(37); - data.append(74); - data.append(3); - data.append(40); - data.append(77); - data.append(42); - data.append(43); - data.append(8); - data.append(9); - data.append(10); - data.append(47); - data.append(84); - data.append(49); - data.append(86); - data.append(15); - data.append(52); - data.append(53); - data.append(54); - data.append(55); - data.append(20); - data.append(93); - data.append(94); - data.append(59); - data.append(24); - data.append(61); - data.append(98); - data.append(27); - data.append(100); - data.append(101); - data.append(66); - data.append(31); - data.append(104); - data.append(105); - data.append(70); - data.append(71); - data.append(0); - data.append(73); - data.append(2); - data.append(39); - data.append(4); - data.append(5); - data.append(42); - data.append(7); - data.append(8); - data.append(81); - data.append(46); - data.append(11); - data.append(84); - data.append(13); - data.append(86); - data.append(87); - data.append(16); - data.append(17); - data.append(54); - data.append(91); - data.append(92); - data.append(57); - data.append(94); - data.append(23); - data.append(96); - data.append(61); - data.append(98); - data.append(27); - data.append(100); - data.append(101); - data.append(66); - data.append(103); - data.append(104); - data.append(33); - data.append(106); - data.append(107); - data.append(72); - data.append(37); - data.append(2); - data.append(39); - data.append(40); - data.append(5); - data.append(78); - data.append(7); - data.append(44); - data.append(9); - data.append(82); - data.append(83); - data.append(12); - data.append(85); - data.append(50); - data.append(15); - data.append(16); - data.append(53); - data.append(18); - data.append(19); - data.append(92); - data.append(21); - data.append(58); - data.append(95); - data.append(60); - data.append(61); - data.append(62); - data.append(63); - data.append(64); - data.append(65); - data.append(30); - data.append(31); - data.append(32); - data.append(105); - data.append(34); - data.append(71); - data.append(0); - data.append(1); - data.append(38); - data.append(3); - data.append(76); - data.append(5); - data.append(78); - data.append(43); - data.append(80); - data.append(45); - data.append(46); - data.append(47); - data.append(48); - data.append(85); - data.append(50); - data.append(51); - data.append(52); - data.append(89); - data.append(18); - data.append(55); - data.append(92); - data.append(57); - data.append(94); - data.append(23); - data.append(24); - data.append(25); - data.append(62); - data.append(27); - data.append(28); - data.append(65); - data.append(66); - data.append(31); - data.append(32); - data.append(69); - data.append(106); - data.append(107); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_fp16x16_3d_axis1.cairo b/tests/nodes/gather_fp16x16_3d_axis1.cairo index 429d085d4..d10ab5245 100644 --- a/tests/nodes/gather_fp16x16_3d_axis1.cairo +++ b/tests/nodes/gather_fp16x16_3d_axis1.cairo @@ -3,13 +3,13 @@ mod input_1; mod output_0; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; use orion::operators::tensor::FP16x16TensorPartialEq; -use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::U32TensorPartialEq; +use orion::operators::tensor::I32TensorPartialEq; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; #[test] #[available_gas(2000000000)] @@ -18,7 +18,7 @@ fn test_gather_fp16x16_3d_axis1() { let input_1 = input_1::input_1(); let z_0 = output_0::output_0(); - let y_0 = input_0.gather(indices: input_1, axis: Option::Some(1)); + let y_0 = input_0.gather(indices:input_1, axis:Option::Some(1)); assert_eq(y_0, z_0); } diff --git a/tests/nodes/gather_fp16x16_3d_axis1/input_1.cairo b/tests/nodes/gather_fp16x16_3d_axis1/input_1.cairo index b30e2f0c2..d5bbc25be 100644 --- a/tests/nodes/gather_fp16x16_3d_axis1/input_1.cairo +++ b/tests/nodes/gather_fp16x16_3d_axis1/input_1.cairo @@ -1,9 +1,9 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; use orion::numbers::NumberTrait; -fn input_1() -> Tensor { +fn input_1() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(3); shape.append(2); diff --git a/tests/nodes/gather_fp16x16_3d_axis2.cairo b/tests/nodes/gather_fp16x16_3d_axis2.cairo index cfb8a61d2..40ef5691d 100644 --- a/tests/nodes/gather_fp16x16_3d_axis2.cairo +++ b/tests/nodes/gather_fp16x16_3d_axis2.cairo @@ -3,13 +3,13 @@ mod input_1; mod output_0; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; use orion::operators::tensor::FP16x16TensorPartialEq; -use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::U32TensorPartialEq; +use orion::operators::tensor::I32TensorPartialEq; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; #[test] #[available_gas(2000000000)] @@ -18,7 +18,7 @@ fn test_gather_fp16x16_3d_axis2() { let input_1 = input_1::input_1(); let z_0 = output_0::output_0(); - let y_0 = input_0.gather(indices: input_1, axis: Option::Some(2)); + let y_0 = input_0.gather(indices:input_1, axis:Option::Some(2)); assert_eq(y_0, z_0); } diff --git a/tests/nodes/gather_fp16x16_3d_axis2/input_1.cairo b/tests/nodes/gather_fp16x16_3d_axis2/input_1.cairo index b30e2f0c2..d5bbc25be 100644 --- a/tests/nodes/gather_fp16x16_3d_axis2/input_1.cairo +++ b/tests/nodes/gather_fp16x16_3d_axis2/input_1.cairo @@ -1,9 +1,9 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; use orion::numbers::NumberTrait; -fn input_1() -> Tensor { +fn input_1() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(3); shape.append(2); diff --git a/tests/nodes/gather_fp16x16_3d_default.cairo b/tests/nodes/gather_fp16x16_3d_default.cairo index ee49aac75..2003b0838 100644 --- a/tests/nodes/gather_fp16x16_3d_default.cairo +++ b/tests/nodes/gather_fp16x16_3d_default.cairo @@ -3,13 +3,13 @@ mod input_1; mod output_0; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; use orion::operators::tensor::FP16x16TensorPartialEq; -use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::U32TensorPartialEq; +use orion::operators::tensor::I32TensorPartialEq; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; #[test] #[available_gas(2000000000)] @@ -18,7 +18,7 @@ fn test_gather_fp16x16_3d_default() { let input_1 = input_1::input_1(); let z_0 = output_0::output_0(); - let y_0 = input_0.gather(indices: input_1, axis: Option::Some(0)); + let y_0 = input_0.gather(indices:input_1, axis:Option::Some(0)); assert_eq(y_0, z_0); } diff --git a/tests/nodes/gather_fp16x16_3d_default/input_1.cairo b/tests/nodes/gather_fp16x16_3d_default/input_1.cairo index b30e2f0c2..d5bbc25be 100644 --- a/tests/nodes/gather_fp16x16_3d_default/input_1.cairo +++ b/tests/nodes/gather_fp16x16_3d_default/input_1.cairo @@ -1,9 +1,9 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; use orion::numbers::NumberTrait; -fn input_1() -> Tensor { +fn input_1() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(3); shape.append(2); diff --git a/tests/nodes/gather_fp8x23_3d_axis1.cairo b/tests/nodes/gather_fp8x23_3d_axis1.cairo deleted file mode 100644 index c9c6dcf7f..000000000 --- a/tests/nodes/gather_fp8x23_3d_axis1.cairo +++ /dev/null @@ -1,24 +0,0 @@ -mod input_0; -mod input_1; -mod output_0; - - -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; -use orion::operators::tensor::FP8x23TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::U32TensorPartialEq; - -#[test] -#[available_gas(2000000000)] -fn test_gather_fp8x23_3d_axis1() { - let input_0 = input_0::input_0(); - let input_1 = input_1::input_1(); - let z_0 = output_0::output_0(); - - let y_0 = input_0.gather(indices: input_1, axis: Option::Some(1)); - - assert_eq(y_0, z_0); -} diff --git a/tests/nodes/gather_fp8x23_3d_axis1/input_0.cairo b/tests/nodes/gather_fp8x23_3d_axis1/input_0.cairo deleted file mode 100644 index faabab14c..000000000 --- a/tests/nodes/gather_fp8x23_3d_axis1/input_0.cairo +++ /dev/null @@ -1,41 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 0, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 25165824, sign: false }); - data.append(FP8x23 { mag: 33554432, sign: false }); - data.append(FP8x23 { mag: 41943040, sign: false }); - data.append(FP8x23 { mag: 50331648, sign: false }); - data.append(FP8x23 { mag: 58720256, sign: false }); - data.append(FP8x23 { mag: 67108864, sign: false }); - data.append(FP8x23 { mag: 75497472, sign: false }); - data.append(FP8x23 { mag: 83886080, sign: false }); - data.append(FP8x23 { mag: 92274688, sign: false }); - data.append(FP8x23 { mag: 100663296, sign: false }); - data.append(FP8x23 { mag: 109051904, sign: false }); - data.append(FP8x23 { mag: 117440512, sign: false }); - data.append(FP8x23 { mag: 125829120, sign: false }); - data.append(FP8x23 { mag: 134217728, sign: false }); - data.append(FP8x23 { mag: 142606336, sign: false }); - data.append(FP8x23 { mag: 150994944, sign: false }); - data.append(FP8x23 { mag: 159383552, sign: false }); - data.append(FP8x23 { mag: 167772160, sign: false }); - data.append(FP8x23 { mag: 176160768, sign: false }); - data.append(FP8x23 { mag: 184549376, sign: false }); - data.append(FP8x23 { mag: 192937984, sign: false }); - data.append(FP8x23 { mag: 201326592, sign: false }); - data.append(FP8x23 { mag: 209715200, sign: false }); - data.append(FP8x23 { mag: 218103808, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_fp8x23_3d_axis1/output_0.cairo b/tests/nodes/gather_fp8x23_3d_axis1/output_0.cairo deleted file mode 100644 index a7fc4bc2f..000000000 --- a/tests/nodes/gather_fp8x23_3d_axis1/output_0.cairo +++ /dev/null @@ -1,69 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(2); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 0, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 25165824, sign: false }); - data.append(FP8x23 { mag: 33554432, sign: false }); - data.append(FP8x23 { mag: 41943040, sign: false }); - data.append(FP8x23 { mag: 50331648, sign: false }); - data.append(FP8x23 { mag: 58720256, sign: false }); - data.append(FP8x23 { mag: 67108864, sign: false }); - data.append(FP8x23 { mag: 25165824, sign: false }); - data.append(FP8x23 { mag: 33554432, sign: false }); - data.append(FP8x23 { mag: 41943040, sign: false }); - data.append(FP8x23 { mag: 0, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 50331648, sign: false }); - data.append(FP8x23 { mag: 58720256, sign: false }); - data.append(FP8x23 { mag: 67108864, sign: false }); - data.append(FP8x23 { mag: 75497472, sign: false }); - data.append(FP8x23 { mag: 83886080, sign: false }); - data.append(FP8x23 { mag: 92274688, sign: false }); - data.append(FP8x23 { mag: 100663296, sign: false }); - data.append(FP8x23 { mag: 109051904, sign: false }); - data.append(FP8x23 { mag: 117440512, sign: false }); - data.append(FP8x23 { mag: 125829120, sign: false }); - data.append(FP8x23 { mag: 134217728, sign: false }); - data.append(FP8x23 { mag: 142606336, sign: false }); - data.append(FP8x23 { mag: 100663296, sign: false }); - data.append(FP8x23 { mag: 109051904, sign: false }); - data.append(FP8x23 { mag: 117440512, sign: false }); - data.append(FP8x23 { mag: 75497472, sign: false }); - data.append(FP8x23 { mag: 83886080, sign: false }); - data.append(FP8x23 { mag: 92274688, sign: false }); - data.append(FP8x23 { mag: 125829120, sign: false }); - data.append(FP8x23 { mag: 134217728, sign: false }); - data.append(FP8x23 { mag: 142606336, sign: false }); - data.append(FP8x23 { mag: 150994944, sign: false }); - data.append(FP8x23 { mag: 159383552, sign: false }); - data.append(FP8x23 { mag: 167772160, sign: false }); - data.append(FP8x23 { mag: 176160768, sign: false }); - data.append(FP8x23 { mag: 184549376, sign: false }); - data.append(FP8x23 { mag: 192937984, sign: false }); - data.append(FP8x23 { mag: 201326592, sign: false }); - data.append(FP8x23 { mag: 209715200, sign: false }); - data.append(FP8x23 { mag: 218103808, sign: false }); - data.append(FP8x23 { mag: 176160768, sign: false }); - data.append(FP8x23 { mag: 184549376, sign: false }); - data.append(FP8x23 { mag: 192937984, sign: false }); - data.append(FP8x23 { mag: 150994944, sign: false }); - data.append(FP8x23 { mag: 159383552, sign: false }); - data.append(FP8x23 { mag: 167772160, sign: false }); - data.append(FP8x23 { mag: 201326592, sign: false }); - data.append(FP8x23 { mag: 209715200, sign: false }); - data.append(FP8x23 { mag: 218103808, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_fp8x23_3d_axis2.cairo b/tests/nodes/gather_fp8x23_3d_axis2.cairo deleted file mode 100644 index 726411dd2..000000000 --- a/tests/nodes/gather_fp8x23_3d_axis2.cairo +++ /dev/null @@ -1,24 +0,0 @@ -mod input_0; -mod input_1; -mod output_0; - - -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; -use orion::operators::tensor::FP8x23TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::U32TensorPartialEq; - -#[test] -#[available_gas(2000000000)] -fn test_gather_fp8x23_3d_axis2() { - let input_0 = input_0::input_0(); - let input_1 = input_1::input_1(); - let z_0 = output_0::output_0(); - - let y_0 = input_0.gather(indices: input_1, axis: Option::Some(2)); - - assert_eq(y_0, z_0); -} diff --git a/tests/nodes/gather_fp8x23_3d_axis2/input_0.cairo b/tests/nodes/gather_fp8x23_3d_axis2/input_0.cairo deleted file mode 100644 index faabab14c..000000000 --- a/tests/nodes/gather_fp8x23_3d_axis2/input_0.cairo +++ /dev/null @@ -1,41 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 0, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 25165824, sign: false }); - data.append(FP8x23 { mag: 33554432, sign: false }); - data.append(FP8x23 { mag: 41943040, sign: false }); - data.append(FP8x23 { mag: 50331648, sign: false }); - data.append(FP8x23 { mag: 58720256, sign: false }); - data.append(FP8x23 { mag: 67108864, sign: false }); - data.append(FP8x23 { mag: 75497472, sign: false }); - data.append(FP8x23 { mag: 83886080, sign: false }); - data.append(FP8x23 { mag: 92274688, sign: false }); - data.append(FP8x23 { mag: 100663296, sign: false }); - data.append(FP8x23 { mag: 109051904, sign: false }); - data.append(FP8x23 { mag: 117440512, sign: false }); - data.append(FP8x23 { mag: 125829120, sign: false }); - data.append(FP8x23 { mag: 134217728, sign: false }); - data.append(FP8x23 { mag: 142606336, sign: false }); - data.append(FP8x23 { mag: 150994944, sign: false }); - data.append(FP8x23 { mag: 159383552, sign: false }); - data.append(FP8x23 { mag: 167772160, sign: false }); - data.append(FP8x23 { mag: 176160768, sign: false }); - data.append(FP8x23 { mag: 184549376, sign: false }); - data.append(FP8x23 { mag: 192937984, sign: false }); - data.append(FP8x23 { mag: 201326592, sign: false }); - data.append(FP8x23 { mag: 209715200, sign: false }); - data.append(FP8x23 { mag: 218103808, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_fp8x23_3d_axis2/output_0.cairo b/tests/nodes/gather_fp8x23_3d_axis2/output_0.cairo deleted file mode 100644 index 7ba68407b..000000000 --- a/tests/nodes/gather_fp8x23_3d_axis2/output_0.cairo +++ /dev/null @@ -1,69 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(3); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 0, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 0, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 25165824, sign: false }); - data.append(FP8x23 { mag: 33554432, sign: false }); - data.append(FP8x23 { mag: 41943040, sign: false }); - data.append(FP8x23 { mag: 33554432, sign: false }); - data.append(FP8x23 { mag: 25165824, sign: false }); - data.append(FP8x23 { mag: 41943040, sign: false }); - data.append(FP8x23 { mag: 50331648, sign: false }); - data.append(FP8x23 { mag: 58720256, sign: false }); - data.append(FP8x23 { mag: 67108864, sign: false }); - data.append(FP8x23 { mag: 58720256, sign: false }); - data.append(FP8x23 { mag: 50331648, sign: false }); - data.append(FP8x23 { mag: 67108864, sign: false }); - data.append(FP8x23 { mag: 75497472, sign: false }); - data.append(FP8x23 { mag: 83886080, sign: false }); - data.append(FP8x23 { mag: 92274688, sign: false }); - data.append(FP8x23 { mag: 83886080, sign: false }); - data.append(FP8x23 { mag: 75497472, sign: false }); - data.append(FP8x23 { mag: 92274688, sign: false }); - data.append(FP8x23 { mag: 100663296, sign: false }); - data.append(FP8x23 { mag: 109051904, sign: false }); - data.append(FP8x23 { mag: 117440512, sign: false }); - data.append(FP8x23 { mag: 109051904, sign: false }); - data.append(FP8x23 { mag: 100663296, sign: false }); - data.append(FP8x23 { mag: 117440512, sign: false }); - data.append(FP8x23 { mag: 125829120, sign: false }); - data.append(FP8x23 { mag: 134217728, sign: false }); - data.append(FP8x23 { mag: 142606336, sign: false }); - data.append(FP8x23 { mag: 134217728, sign: false }); - data.append(FP8x23 { mag: 125829120, sign: false }); - data.append(FP8x23 { mag: 142606336, sign: false }); - data.append(FP8x23 { mag: 150994944, sign: false }); - data.append(FP8x23 { mag: 159383552, sign: false }); - data.append(FP8x23 { mag: 167772160, sign: false }); - data.append(FP8x23 { mag: 159383552, sign: false }); - data.append(FP8x23 { mag: 150994944, sign: false }); - data.append(FP8x23 { mag: 167772160, sign: false }); - data.append(FP8x23 { mag: 176160768, sign: false }); - data.append(FP8x23 { mag: 184549376, sign: false }); - data.append(FP8x23 { mag: 192937984, sign: false }); - data.append(FP8x23 { mag: 184549376, sign: false }); - data.append(FP8x23 { mag: 176160768, sign: false }); - data.append(FP8x23 { mag: 192937984, sign: false }); - data.append(FP8x23 { mag: 201326592, sign: false }); - data.append(FP8x23 { mag: 209715200, sign: false }); - data.append(FP8x23 { mag: 218103808, sign: false }); - data.append(FP8x23 { mag: 209715200, sign: false }); - data.append(FP8x23 { mag: 201326592, sign: false }); - data.append(FP8x23 { mag: 218103808, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_fp8x23_3d_default.cairo b/tests/nodes/gather_fp8x23_3d_default.cairo deleted file mode 100644 index e844827f9..000000000 --- a/tests/nodes/gather_fp8x23_3d_default.cairo +++ /dev/null @@ -1,24 +0,0 @@ -mod input_0; -mod input_1; -mod output_0; - - -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; -use orion::operators::tensor::FP8x23TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::U32TensorPartialEq; - -#[test] -#[available_gas(2000000000)] -fn test_gather_fp8x23_3d_default() { - let input_0 = input_0::input_0(); - let input_1 = input_1::input_1(); - let z_0 = output_0::output_0(); - - let y_0 = input_0.gather(indices: input_1, axis: Option::Some(0)); - - assert_eq(y_0, z_0); -} diff --git a/tests/nodes/gather_fp8x23_3d_default/input_0.cairo b/tests/nodes/gather_fp8x23_3d_default/input_0.cairo deleted file mode 100644 index faabab14c..000000000 --- a/tests/nodes/gather_fp8x23_3d_default/input_0.cairo +++ /dev/null @@ -1,41 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 0, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 25165824, sign: false }); - data.append(FP8x23 { mag: 33554432, sign: false }); - data.append(FP8x23 { mag: 41943040, sign: false }); - data.append(FP8x23 { mag: 50331648, sign: false }); - data.append(FP8x23 { mag: 58720256, sign: false }); - data.append(FP8x23 { mag: 67108864, sign: false }); - data.append(FP8x23 { mag: 75497472, sign: false }); - data.append(FP8x23 { mag: 83886080, sign: false }); - data.append(FP8x23 { mag: 92274688, sign: false }); - data.append(FP8x23 { mag: 100663296, sign: false }); - data.append(FP8x23 { mag: 109051904, sign: false }); - data.append(FP8x23 { mag: 117440512, sign: false }); - data.append(FP8x23 { mag: 125829120, sign: false }); - data.append(FP8x23 { mag: 134217728, sign: false }); - data.append(FP8x23 { mag: 142606336, sign: false }); - data.append(FP8x23 { mag: 150994944, sign: false }); - data.append(FP8x23 { mag: 159383552, sign: false }); - data.append(FP8x23 { mag: 167772160, sign: false }); - data.append(FP8x23 { mag: 176160768, sign: false }); - data.append(FP8x23 { mag: 184549376, sign: false }); - data.append(FP8x23 { mag: 192937984, sign: false }); - data.append(FP8x23 { mag: 201326592, sign: false }); - data.append(FP8x23 { mag: 209715200, sign: false }); - data.append(FP8x23 { mag: 218103808, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_fp8x23_3d_default/output_0.cairo b/tests/nodes/gather_fp8x23_3d_default/output_0.cairo deleted file mode 100644 index 2d6dcdcf4..000000000 --- a/tests/nodes/gather_fp8x23_3d_default/output_0.cairo +++ /dev/null @@ -1,69 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(2); - shape.append(3); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 0, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 25165824, sign: false }); - data.append(FP8x23 { mag: 33554432, sign: false }); - data.append(FP8x23 { mag: 41943040, sign: false }); - data.append(FP8x23 { mag: 50331648, sign: false }); - data.append(FP8x23 { mag: 58720256, sign: false }); - data.append(FP8x23 { mag: 67108864, sign: false }); - data.append(FP8x23 { mag: 75497472, sign: false }); - data.append(FP8x23 { mag: 83886080, sign: false }); - data.append(FP8x23 { mag: 92274688, sign: false }); - data.append(FP8x23 { mag: 100663296, sign: false }); - data.append(FP8x23 { mag: 109051904, sign: false }); - data.append(FP8x23 { mag: 117440512, sign: false }); - data.append(FP8x23 { mag: 125829120, sign: false }); - data.append(FP8x23 { mag: 134217728, sign: false }); - data.append(FP8x23 { mag: 142606336, sign: false }); - data.append(FP8x23 { mag: 150994944, sign: false }); - data.append(FP8x23 { mag: 159383552, sign: false }); - data.append(FP8x23 { mag: 167772160, sign: false }); - data.append(FP8x23 { mag: 176160768, sign: false }); - data.append(FP8x23 { mag: 184549376, sign: false }); - data.append(FP8x23 { mag: 192937984, sign: false }); - data.append(FP8x23 { mag: 201326592, sign: false }); - data.append(FP8x23 { mag: 209715200, sign: false }); - data.append(FP8x23 { mag: 218103808, sign: false }); - data.append(FP8x23 { mag: 75497472, sign: false }); - data.append(FP8x23 { mag: 83886080, sign: false }); - data.append(FP8x23 { mag: 92274688, sign: false }); - data.append(FP8x23 { mag: 100663296, sign: false }); - data.append(FP8x23 { mag: 109051904, sign: false }); - data.append(FP8x23 { mag: 117440512, sign: false }); - data.append(FP8x23 { mag: 125829120, sign: false }); - data.append(FP8x23 { mag: 134217728, sign: false }); - data.append(FP8x23 { mag: 142606336, sign: false }); - data.append(FP8x23 { mag: 0, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 25165824, sign: false }); - data.append(FP8x23 { mag: 33554432, sign: false }); - data.append(FP8x23 { mag: 41943040, sign: false }); - data.append(FP8x23 { mag: 50331648, sign: false }); - data.append(FP8x23 { mag: 58720256, sign: false }); - data.append(FP8x23 { mag: 67108864, sign: false }); - data.append(FP8x23 { mag: 150994944, sign: false }); - data.append(FP8x23 { mag: 159383552, sign: false }); - data.append(FP8x23 { mag: 167772160, sign: false }); - data.append(FP8x23 { mag: 176160768, sign: false }); - data.append(FP8x23 { mag: 184549376, sign: false }); - data.append(FP8x23 { mag: 192937984, sign: false }); - data.append(FP8x23 { mag: 201326592, sign: false }); - data.append(FP8x23 { mag: 209715200, sign: false }); - data.append(FP8x23 { mag: 218103808, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_i32_3d_axis1/input_0.cairo b/tests/nodes/gather_i32_3d_axis1/input_0.cairo deleted file mode 100644 index 5562ac725..000000000 --- a/tests/nodes/gather_i32_3d_axis1/input_0.cairo +++ /dev/null @@ -1,41 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorAdd}; -use orion::numbers::NumberTrait; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - data.append(4); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(9); - data.append(10); - data.append(11); - data.append(12); - data.append(13); - data.append(14); - data.append(15); - data.append(16); - data.append(17); - data.append(18); - data.append(19); - data.append(20); - data.append(21); - data.append(22); - data.append(23); - data.append(24); - data.append(25); - data.append(26); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_i32_3d_axis1/output_0.cairo b/tests/nodes/gather_i32_3d_axis1/output_0.cairo deleted file mode 100644 index ec7de3b93..000000000 --- a/tests/nodes/gather_i32_3d_axis1/output_0.cairo +++ /dev/null @@ -1,69 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorAdd}; -use orion::numbers::NumberTrait; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(2); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - data.append(4); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(3); - data.append(4); - data.append(5); - data.append(0); - data.append(1); - data.append(2); - data.append(6); - data.append(7); - data.append(8); - data.append(9); - data.append(10); - data.append(11); - data.append(12); - data.append(13); - data.append(14); - data.append(15); - data.append(16); - data.append(17); - data.append(12); - data.append(13); - data.append(14); - data.append(9); - data.append(10); - data.append(11); - data.append(15); - data.append(16); - data.append(17); - data.append(18); - data.append(19); - data.append(20); - data.append(21); - data.append(22); - data.append(23); - data.append(24); - data.append(25); - data.append(26); - data.append(21); - data.append(22); - data.append(23); - data.append(18); - data.append(19); - data.append(20); - data.append(24); - data.append(25); - data.append(26); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_i32_3d_axis2/input_0.cairo b/tests/nodes/gather_i32_3d_axis2/input_0.cairo deleted file mode 100644 index 5562ac725..000000000 --- a/tests/nodes/gather_i32_3d_axis2/input_0.cairo +++ /dev/null @@ -1,41 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorAdd}; -use orion::numbers::NumberTrait; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - data.append(4); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(9); - data.append(10); - data.append(11); - data.append(12); - data.append(13); - data.append(14); - data.append(15); - data.append(16); - data.append(17); - data.append(18); - data.append(19); - data.append(20); - data.append(21); - data.append(22); - data.append(23); - data.append(24); - data.append(25); - data.append(26); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_i32_3d_axis2/input_1.cairo b/tests/nodes/gather_i32_3d_axis2/input_1.cairo deleted file mode 100644 index b30e2f0c2..000000000 --- a/tests/nodes/gather_i32_3d_axis2/input_1.cairo +++ /dev/null @@ -1,19 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::numbers::NumberTrait; - -fn input_1() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(1); - data.append(0); - data.append(2); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_i32_3d_axis2/output_0.cairo b/tests/nodes/gather_i32_3d_axis2/output_0.cairo deleted file mode 100644 index 6f2069a71..000000000 --- a/tests/nodes/gather_i32_3d_axis2/output_0.cairo +++ /dev/null @@ -1,69 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorAdd}; -use orion::numbers::NumberTrait; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(3); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(1); - data.append(0); - data.append(2); - data.append(3); - data.append(4); - data.append(5); - data.append(4); - data.append(3); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(7); - data.append(6); - data.append(8); - data.append(9); - data.append(10); - data.append(11); - data.append(10); - data.append(9); - data.append(11); - data.append(12); - data.append(13); - data.append(14); - data.append(13); - data.append(12); - data.append(14); - data.append(15); - data.append(16); - data.append(17); - data.append(16); - data.append(15); - data.append(17); - data.append(18); - data.append(19); - data.append(20); - data.append(19); - data.append(18); - data.append(20); - data.append(21); - data.append(22); - data.append(23); - data.append(22); - data.append(21); - data.append(23); - data.append(24); - data.append(25); - data.append(26); - data.append(25); - data.append(24); - data.append(26); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_i32_3d_default/input_0.cairo b/tests/nodes/gather_i32_3d_default/input_0.cairo deleted file mode 100644 index 5562ac725..000000000 --- a/tests/nodes/gather_i32_3d_default/input_0.cairo +++ /dev/null @@ -1,41 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorAdd}; -use orion::numbers::NumberTrait; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - data.append(4); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(9); - data.append(10); - data.append(11); - data.append(12); - data.append(13); - data.append(14); - data.append(15); - data.append(16); - data.append(17); - data.append(18); - data.append(19); - data.append(20); - data.append(21); - data.append(22); - data.append(23); - data.append(24); - data.append(25); - data.append(26); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_i32_3d_default/input_1.cairo b/tests/nodes/gather_i32_3d_default/input_1.cairo deleted file mode 100644 index b30e2f0c2..000000000 --- a/tests/nodes/gather_i32_3d_default/input_1.cairo +++ /dev/null @@ -1,19 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::numbers::NumberTrait; - -fn input_1() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(1); - data.append(0); - data.append(2); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_i32_3d_default/output_0.cairo b/tests/nodes/gather_i32_3d_default/output_0.cairo deleted file mode 100644 index aae477d9f..000000000 --- a/tests/nodes/gather_i32_3d_default/output_0.cairo +++ /dev/null @@ -1,69 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorAdd}; -use orion::numbers::NumberTrait; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(2); - shape.append(3); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - data.append(4); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(9); - data.append(10); - data.append(11); - data.append(12); - data.append(13); - data.append(14); - data.append(15); - data.append(16); - data.append(17); - data.append(18); - data.append(19); - data.append(20); - data.append(21); - data.append(22); - data.append(23); - data.append(24); - data.append(25); - data.append(26); - data.append(9); - data.append(10); - data.append(11); - data.append(12); - data.append(13); - data.append(14); - data.append(15); - data.append(16); - data.append(17); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - data.append(4); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(18); - data.append(19); - data.append(20); - data.append(21); - data.append(22); - data.append(23); - data.append(24); - data.append(25); - data.append(26); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_i8_3d_axis1/input_0.cairo b/tests/nodes/gather_i8_3d_axis1/input_0.cairo deleted file mode 100644 index 3e59c35b2..000000000 --- a/tests/nodes/gather_i8_3d_axis1/input_0.cairo +++ /dev/null @@ -1,41 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I8Tensor, I8TensorAdd}; -use orion::numbers::NumberTrait; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - data.append(4); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(9); - data.append(10); - data.append(11); - data.append(12); - data.append(13); - data.append(14); - data.append(15); - data.append(16); - data.append(17); - data.append(18); - data.append(19); - data.append(20); - data.append(21); - data.append(22); - data.append(23); - data.append(24); - data.append(25); - data.append(26); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_i8_3d_axis1/input_1.cairo b/tests/nodes/gather_i8_3d_axis1/input_1.cairo deleted file mode 100644 index b30e2f0c2..000000000 --- a/tests/nodes/gather_i8_3d_axis1/input_1.cairo +++ /dev/null @@ -1,19 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::numbers::NumberTrait; - -fn input_1() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(1); - data.append(0); - data.append(2); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_i8_3d_axis1/output_0.cairo b/tests/nodes/gather_i8_3d_axis1/output_0.cairo deleted file mode 100644 index 443ea5bb5..000000000 --- a/tests/nodes/gather_i8_3d_axis1/output_0.cairo +++ /dev/null @@ -1,69 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I8Tensor, I8TensorAdd}; -use orion::numbers::NumberTrait; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(2); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - data.append(4); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(3); - data.append(4); - data.append(5); - data.append(0); - data.append(1); - data.append(2); - data.append(6); - data.append(7); - data.append(8); - data.append(9); - data.append(10); - data.append(11); - data.append(12); - data.append(13); - data.append(14); - data.append(15); - data.append(16); - data.append(17); - data.append(12); - data.append(13); - data.append(14); - data.append(9); - data.append(10); - data.append(11); - data.append(15); - data.append(16); - data.append(17); - data.append(18); - data.append(19); - data.append(20); - data.append(21); - data.append(22); - data.append(23); - data.append(24); - data.append(25); - data.append(26); - data.append(21); - data.append(22); - data.append(23); - data.append(18); - data.append(19); - data.append(20); - data.append(24); - data.append(25); - data.append(26); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_i8_3d_axis2.cairo b/tests/nodes/gather_i8_3d_axis2.cairo deleted file mode 100644 index 992cee33e..000000000 --- a/tests/nodes/gather_i8_3d_axis2.cairo +++ /dev/null @@ -1,24 +0,0 @@ -mod input_0; -mod input_1; -mod output_0; - - -use orion::operators::tensor::I8TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{I8Tensor, I8TensorAdd}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::U32TensorPartialEq; - -#[test] -#[available_gas(2000000000)] -fn test_gather_i8_3d_axis2() { - let input_0 = input_0::input_0(); - let input_1 = input_1::input_1(); - let z_0 = output_0::output_0(); - - let y_0 = input_0.gather(indices: input_1, axis: Option::Some(2)); - - assert_eq(y_0, z_0); -} diff --git a/tests/nodes/gather_i8_3d_axis2/input_0.cairo b/tests/nodes/gather_i8_3d_axis2/input_0.cairo deleted file mode 100644 index 3e59c35b2..000000000 --- a/tests/nodes/gather_i8_3d_axis2/input_0.cairo +++ /dev/null @@ -1,41 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I8Tensor, I8TensorAdd}; -use orion::numbers::NumberTrait; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - data.append(4); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(9); - data.append(10); - data.append(11); - data.append(12); - data.append(13); - data.append(14); - data.append(15); - data.append(16); - data.append(17); - data.append(18); - data.append(19); - data.append(20); - data.append(21); - data.append(22); - data.append(23); - data.append(24); - data.append(25); - data.append(26); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_i8_3d_axis2/input_1.cairo b/tests/nodes/gather_i8_3d_axis2/input_1.cairo deleted file mode 100644 index b30e2f0c2..000000000 --- a/tests/nodes/gather_i8_3d_axis2/input_1.cairo +++ /dev/null @@ -1,19 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::numbers::NumberTrait; - -fn input_1() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(1); - data.append(0); - data.append(2); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_i8_3d_axis2/output_0.cairo b/tests/nodes/gather_i8_3d_axis2/output_0.cairo deleted file mode 100644 index 81d7430f1..000000000 --- a/tests/nodes/gather_i8_3d_axis2/output_0.cairo +++ /dev/null @@ -1,69 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I8Tensor, I8TensorAdd}; -use orion::numbers::NumberTrait; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(3); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(1); - data.append(0); - data.append(2); - data.append(3); - data.append(4); - data.append(5); - data.append(4); - data.append(3); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(7); - data.append(6); - data.append(8); - data.append(9); - data.append(10); - data.append(11); - data.append(10); - data.append(9); - data.append(11); - data.append(12); - data.append(13); - data.append(14); - data.append(13); - data.append(12); - data.append(14); - data.append(15); - data.append(16); - data.append(17); - data.append(16); - data.append(15); - data.append(17); - data.append(18); - data.append(19); - data.append(20); - data.append(19); - data.append(18); - data.append(20); - data.append(21); - data.append(22); - data.append(23); - data.append(22); - data.append(21); - data.append(23); - data.append(24); - data.append(25); - data.append(26); - data.append(25); - data.append(24); - data.append(26); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_i8_3d_default.cairo b/tests/nodes/gather_i8_3d_default.cairo deleted file mode 100644 index 0f8e6dec2..000000000 --- a/tests/nodes/gather_i8_3d_default.cairo +++ /dev/null @@ -1,24 +0,0 @@ -mod input_0; -mod input_1; -mod output_0; - - -use orion::operators::tensor::I8TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{I8Tensor, I8TensorAdd}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::U32TensorPartialEq; - -#[test] -#[available_gas(2000000000)] -fn test_gather_i8_3d_default() { - let input_0 = input_0::input_0(); - let input_1 = input_1::input_1(); - let z_0 = output_0::output_0(); - - let y_0 = input_0.gather(indices: input_1, axis: Option::Some(0)); - - assert_eq(y_0, z_0); -} diff --git a/tests/nodes/gather_i8_3d_default/input_0.cairo b/tests/nodes/gather_i8_3d_default/input_0.cairo deleted file mode 100644 index 3e59c35b2..000000000 --- a/tests/nodes/gather_i8_3d_default/input_0.cairo +++ /dev/null @@ -1,41 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I8Tensor, I8TensorAdd}; -use orion::numbers::NumberTrait; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - data.append(4); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(9); - data.append(10); - data.append(11); - data.append(12); - data.append(13); - data.append(14); - data.append(15); - data.append(16); - data.append(17); - data.append(18); - data.append(19); - data.append(20); - data.append(21); - data.append(22); - data.append(23); - data.append(24); - data.append(25); - data.append(26); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_i8_3d_default/input_1.cairo b/tests/nodes/gather_i8_3d_default/input_1.cairo deleted file mode 100644 index b30e2f0c2..000000000 --- a/tests/nodes/gather_i8_3d_default/input_1.cairo +++ /dev/null @@ -1,19 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::numbers::NumberTrait; - -fn input_1() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(1); - data.append(0); - data.append(2); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_i8_3d_default/output_0.cairo b/tests/nodes/gather_i8_3d_default/output_0.cairo deleted file mode 100644 index 6ec6b9b4a..000000000 --- a/tests/nodes/gather_i8_3d_default/output_0.cairo +++ /dev/null @@ -1,69 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I8Tensor, I8TensorAdd}; -use orion::numbers::NumberTrait; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(2); - shape.append(3); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - data.append(4); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(9); - data.append(10); - data.append(11); - data.append(12); - data.append(13); - data.append(14); - data.append(15); - data.append(16); - data.append(17); - data.append(18); - data.append(19); - data.append(20); - data.append(21); - data.append(22); - data.append(23); - data.append(24); - data.append(25); - data.append(26); - data.append(9); - data.append(10); - data.append(11); - data.append(12); - data.append(13); - data.append(14); - data.append(15); - data.append(16); - data.append(17); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - data.append(4); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(18); - data.append(19); - data.append(20); - data.append(21); - data.append(22); - data.append(23); - data.append(24); - data.append(25); - data.append(26); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_i32_3d_axis1.cairo b/tests/nodes/gather_negative_axis.cairo similarity index 67% rename from tests/nodes/gather_i32_3d_axis1.cairo rename to tests/nodes/gather_negative_axis.cairo index 6dbb78c47..27c511614 100644 --- a/tests/nodes/gather_i32_3d_axis1.cairo +++ b/tests/nodes/gather_negative_axis.cairo @@ -4,21 +4,21 @@ mod output_0; use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::{I32Tensor, I32TensorAdd}; -use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::operators::tensor::FP16x16TensorPartialEq; use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::I32TensorPartialEq; -use orion::operators::tensor::U32TensorPartialEq; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; #[test] #[available_gas(2000000000)] -fn test_gather_i32_3d_axis1() { +fn test_gather_negative_axis() { let input_0 = input_0::input_0(); let input_1 = input_1::input_1(); let z_0 = output_0::output_0(); - let y_0 = input_0.gather(indices: input_1, axis: Option::Some(1)); + let y_0 = input_0.gather(indices:input_1, axis:Option::Some(-1)); assert_eq(y_0, z_0); } diff --git a/tests/nodes/gather_elements_fp16x16_3d_axis2/input_0.cairo b/tests/nodes/gather_negative_axis/input_0.cairo similarity index 96% rename from tests/nodes/gather_elements_fp16x16_3d_axis2/input_0.cairo rename to tests/nodes/gather_negative_axis/input_0.cairo index 2417c999e..5d8deafac 100644 --- a/tests/nodes/gather_elements_fp16x16_3d_axis2/input_0.cairo +++ b/tests/nodes/gather_negative_axis/input_0.cairo @@ -1,6 +1,6 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorSub}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; use orion::numbers::{FixedTrait, FP16x16}; fn input_0() -> Tensor { diff --git a/tests/nodes/gather_fp8x23_3d_axis1/input_1.cairo b/tests/nodes/gather_negative_axis/input_1.cairo similarity index 83% rename from tests/nodes/gather_fp8x23_3d_axis1/input_1.cairo rename to tests/nodes/gather_negative_axis/input_1.cairo index b30e2f0c2..d5bbc25be 100644 --- a/tests/nodes/gather_fp8x23_3d_axis1/input_1.cairo +++ b/tests/nodes/gather_negative_axis/input_1.cairo @@ -1,9 +1,9 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; use orion::numbers::NumberTrait; -fn input_1() -> Tensor { +fn input_1() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(3); shape.append(2); diff --git a/tests/nodes/gather_negative_axis/output_0.cairo b/tests/nodes/gather_negative_axis/output_0.cairo new file mode 100644 index 000000000..147779c35 --- /dev/null +++ b/tests/nodes/gather_negative_axis/output_0.cairo @@ -0,0 +1,69 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(3); + shape.append(3); + shape.append(3); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 262144, sign: false }); + data.append(FP16x16 { mag: 327680, sign: false }); + data.append(FP16x16 { mag: 262144, sign: false }); + data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 327680, sign: false }); + data.append(FP16x16 { mag: 393216, sign: false }); + data.append(FP16x16 { mag: 458752, sign: false }); + data.append(FP16x16 { mag: 524288, sign: false }); + data.append(FP16x16 { mag: 458752, sign: false }); + data.append(FP16x16 { mag: 393216, sign: false }); + data.append(FP16x16 { mag: 524288, sign: false }); + data.append(FP16x16 { mag: 589824, sign: false }); + data.append(FP16x16 { mag: 655360, sign: false }); + data.append(FP16x16 { mag: 720896, sign: false }); + data.append(FP16x16 { mag: 655360, sign: false }); + data.append(FP16x16 { mag: 589824, sign: false }); + data.append(FP16x16 { mag: 720896, sign: false }); + data.append(FP16x16 { mag: 786432, sign: false }); + data.append(FP16x16 { mag: 851968, sign: false }); + data.append(FP16x16 { mag: 917504, sign: false }); + data.append(FP16x16 { mag: 851968, sign: false }); + data.append(FP16x16 { mag: 786432, sign: false }); + data.append(FP16x16 { mag: 917504, sign: false }); + data.append(FP16x16 { mag: 983040, sign: false }); + data.append(FP16x16 { mag: 1048576, sign: false }); + data.append(FP16x16 { mag: 1114112, sign: false }); + data.append(FP16x16 { mag: 1048576, sign: false }); + data.append(FP16x16 { mag: 983040, sign: false }); + data.append(FP16x16 { mag: 1114112, sign: false }); + data.append(FP16x16 { mag: 1179648, sign: false }); + data.append(FP16x16 { mag: 1245184, sign: false }); + data.append(FP16x16 { mag: 1310720, sign: false }); + data.append(FP16x16 { mag: 1245184, sign: false }); + data.append(FP16x16 { mag: 1179648, sign: false }); + data.append(FP16x16 { mag: 1310720, sign: false }); + data.append(FP16x16 { mag: 1376256, sign: false }); + data.append(FP16x16 { mag: 1441792, sign: false }); + data.append(FP16x16 { mag: 1507328, sign: false }); + data.append(FP16x16 { mag: 1441792, sign: false }); + data.append(FP16x16 { mag: 1376256, sign: false }); + data.append(FP16x16 { mag: 1507328, sign: false }); + data.append(FP16x16 { mag: 1572864, sign: false }); + data.append(FP16x16 { mag: 1638400, sign: false }); + data.append(FP16x16 { mag: 1703936, sign: false }); + data.append(FP16x16 { mag: 1638400, sign: false }); + data.append(FP16x16 { mag: 1572864, sign: false }); + data.append(FP16x16 { mag: 1703936, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/gather_i32_3d_axis2.cairo b/tests/nodes/gather_negative_indices.cairo similarity index 67% rename from tests/nodes/gather_i32_3d_axis2.cairo rename to tests/nodes/gather_negative_indices.cairo index 29bd217b3..559a276ea 100644 --- a/tests/nodes/gather_i32_3d_axis2.cairo +++ b/tests/nodes/gather_negative_indices.cairo @@ -4,21 +4,21 @@ mod output_0; use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::{I32Tensor, I32TensorAdd}; -use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::operators::tensor::FP16x16TensorPartialEq; use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::I32TensorPartialEq; -use orion::operators::tensor::U32TensorPartialEq; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; #[test] #[available_gas(2000000000)] -fn test_gather_i32_3d_axis2() { +fn test_gather_negative_indices() { let input_0 = input_0::input_0(); let input_1 = input_1::input_1(); let z_0 = output_0::output_0(); - let y_0 = input_0.gather(indices: input_1, axis: Option::Some(2)); + let y_0 = input_0.gather(indices:input_1, axis:Option::Some(0)); assert_eq(y_0, z_0); } diff --git a/tests/nodes/reduce_sum_fp16x16_2D_axis_1/input_0.cairo b/tests/nodes/gather_negative_indices/input_0.cairo similarity index 55% rename from tests/nodes/reduce_sum_fp16x16_2D_axis_1/input_0.cairo rename to tests/nodes/gather_negative_indices/input_0.cairo index 00c61e821..5f0a0a23c 100644 --- a/tests/nodes/reduce_sum_fp16x16_2D_axis_1/input_0.cairo +++ b/tests/nodes/gather_negative_indices/input_0.cairo @@ -1,17 +1,22 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorMul}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; use orion::numbers::{FixedTrait, FP16x16}; fn input_0() -> Tensor { let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); + shape.append(10); let mut data = ArrayTrait::new(); data.append(FP16x16 { mag: 0, sign: false }); data.append(FP16x16 { mag: 65536, sign: false }); data.append(FP16x16 { mag: 131072, sign: false }); data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 262144, sign: false }); + data.append(FP16x16 { mag: 327680, sign: false }); + data.append(FP16x16 { mag: 393216, sign: false }); + data.append(FP16x16 { mag: 458752, sign: false }); + data.append(FP16x16 { mag: 524288, sign: false }); + data.append(FP16x16 { mag: 589824, sign: false }); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/argmax_i32_1D_last_index/input_0.cairo b/tests/nodes/gather_negative_indices/input_1.cairo similarity index 71% rename from tests/nodes/argmax_i32_1D_last_index/input_0.cairo rename to tests/nodes/gather_negative_indices/input_1.cairo index fa967cdc9..b013cb6b7 100644 --- a/tests/nodes/argmax_i32_1D_last_index/input_0.cairo +++ b/tests/nodes/gather_negative_indices/input_1.cairo @@ -1,14 +1,15 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn input_0() -> Tensor { +fn input_1() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(3); let mut data = ArrayTrait::new(); - data.append(135); - data.append(148); - data.append(67); + data.append(0); + data.append(-9); + data.append(-10); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/reduce_sum_fp16x16_1D/input_0.cairo b/tests/nodes/gather_negative_indices/output_0.cairo similarity index 72% rename from tests/nodes/reduce_sum_fp16x16_1D/input_0.cairo rename to tests/nodes/gather_negative_indices/output_0.cairo index 38c052c06..65efd394d 100644 --- a/tests/nodes/reduce_sum_fp16x16_1D/input_0.cairo +++ b/tests/nodes/gather_negative_indices/output_0.cairo @@ -1,15 +1,15 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorMul}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; use orion::numbers::{FixedTrait, FP16x16}; -fn input_0() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(3); let mut data = ArrayTrait::new(); data.append(FP16x16 { mag: 0, sign: false }); data.append(FP16x16 { mag: 65536, sign: false }); - data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 0, sign: false }); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/gather_u32_3d_axis1/input_0.cairo b/tests/nodes/gather_u32_3d_axis1/input_0.cairo deleted file mode 100644 index d9508bf41..000000000 --- a/tests/nodes/gather_u32_3d_axis1/input_0.cairo +++ /dev/null @@ -1,50 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::numbers::NumberTrait; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(4); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - data.append(4); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(9); - data.append(10); - data.append(11); - data.append(12); - data.append(13); - data.append(14); - data.append(15); - data.append(16); - data.append(17); - data.append(18); - data.append(19); - data.append(20); - data.append(21); - data.append(22); - data.append(23); - data.append(24); - data.append(25); - data.append(26); - data.append(27); - data.append(28); - data.append(29); - data.append(30); - data.append(31); - data.append(32); - data.append(33); - data.append(34); - data.append(35); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_u32_3d_axis1/output_0.cairo b/tests/nodes/gather_u32_3d_axis1/output_0.cairo deleted file mode 100644 index 5ee2e2c5d..000000000 --- a/tests/nodes/gather_u32_3d_axis1/output_0.cairo +++ /dev/null @@ -1,69 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::numbers::NumberTrait; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(2); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - data.append(4); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(3); - data.append(4); - data.append(5); - data.append(3); - data.append(4); - data.append(5); - data.append(9); - data.append(10); - data.append(11); - data.append(12); - data.append(13); - data.append(14); - data.append(15); - data.append(16); - data.append(17); - data.append(18); - data.append(19); - data.append(20); - data.append(15); - data.append(16); - data.append(17); - data.append(15); - data.append(16); - data.append(17); - data.append(21); - data.append(22); - data.append(23); - data.append(24); - data.append(25); - data.append(26); - data.append(27); - data.append(28); - data.append(29); - data.append(30); - data.append(31); - data.append(32); - data.append(27); - data.append(28); - data.append(29); - data.append(27); - data.append(28); - data.append(29); - data.append(33); - data.append(34); - data.append(35); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_u32_3d_axis2/input_0.cairo b/tests/nodes/gather_u32_3d_axis2/input_0.cairo deleted file mode 100644 index d9508bf41..000000000 --- a/tests/nodes/gather_u32_3d_axis2/input_0.cairo +++ /dev/null @@ -1,50 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::numbers::NumberTrait; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(4); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - data.append(4); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(9); - data.append(10); - data.append(11); - data.append(12); - data.append(13); - data.append(14); - data.append(15); - data.append(16); - data.append(17); - data.append(18); - data.append(19); - data.append(20); - data.append(21); - data.append(22); - data.append(23); - data.append(24); - data.append(25); - data.append(26); - data.append(27); - data.append(28); - data.append(29); - data.append(30); - data.append(31); - data.append(32); - data.append(33); - data.append(34); - data.append(35); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_u32_3d_axis2/input_1.cairo b/tests/nodes/gather_u32_3d_axis2/input_1.cairo deleted file mode 100644 index ad29ac0bc..000000000 --- a/tests/nodes/gather_u32_3d_axis2/input_1.cairo +++ /dev/null @@ -1,19 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::numbers::NumberTrait; - -fn input_1() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(1); - data.append(1); - data.append(2); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_u32_3d_axis2/output_0.cairo b/tests/nodes/gather_u32_3d_axis2/output_0.cairo deleted file mode 100644 index 39c4b0eb3..000000000 --- a/tests/nodes/gather_u32_3d_axis2/output_0.cairo +++ /dev/null @@ -1,87 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::numbers::NumberTrait; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(4); - shape.append(3); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(1); - data.append(1); - data.append(2); - data.append(3); - data.append(4); - data.append(5); - data.append(4); - data.append(4); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(7); - data.append(7); - data.append(8); - data.append(9); - data.append(10); - data.append(11); - data.append(10); - data.append(10); - data.append(11); - data.append(12); - data.append(13); - data.append(14); - data.append(13); - data.append(13); - data.append(14); - data.append(15); - data.append(16); - data.append(17); - data.append(16); - data.append(16); - data.append(17); - data.append(18); - data.append(19); - data.append(20); - data.append(19); - data.append(19); - data.append(20); - data.append(21); - data.append(22); - data.append(23); - data.append(22); - data.append(22); - data.append(23); - data.append(24); - data.append(25); - data.append(26); - data.append(25); - data.append(25); - data.append(26); - data.append(27); - data.append(28); - data.append(29); - data.append(28); - data.append(28); - data.append(29); - data.append(30); - data.append(31); - data.append(32); - data.append(31); - data.append(31); - data.append(32); - data.append(33); - data.append(34); - data.append(35); - data.append(34); - data.append(34); - data.append(35); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_u32_3d_default/input_0.cairo b/tests/nodes/gather_u32_3d_default/input_0.cairo deleted file mode 100644 index d9508bf41..000000000 --- a/tests/nodes/gather_u32_3d_default/input_0.cairo +++ /dev/null @@ -1,50 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::numbers::NumberTrait; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(4); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - data.append(4); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(9); - data.append(10); - data.append(11); - data.append(12); - data.append(13); - data.append(14); - data.append(15); - data.append(16); - data.append(17); - data.append(18); - data.append(19); - data.append(20); - data.append(21); - data.append(22); - data.append(23); - data.append(24); - data.append(25); - data.append(26); - data.append(27); - data.append(28); - data.append(29); - data.append(30); - data.append(31); - data.append(32); - data.append(33); - data.append(34); - data.append(35); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_u32_3d_default/input_1.cairo b/tests/nodes/gather_u32_3d_default/input_1.cairo deleted file mode 100644 index b30e2f0c2..000000000 --- a/tests/nodes/gather_u32_3d_default/input_1.cairo +++ /dev/null @@ -1,19 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::numbers::NumberTrait; - -fn input_1() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(1); - data.append(0); - data.append(2); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_u32_3d_default/output_0.cairo b/tests/nodes/gather_u32_3d_default/output_0.cairo deleted file mode 100644 index b079689fd..000000000 --- a/tests/nodes/gather_u32_3d_default/output_0.cairo +++ /dev/null @@ -1,87 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::numbers::NumberTrait; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(2); - shape.append(4); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - data.append(4); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(9); - data.append(10); - data.append(11); - data.append(12); - data.append(13); - data.append(14); - data.append(15); - data.append(16); - data.append(17); - data.append(18); - data.append(19); - data.append(20); - data.append(21); - data.append(22); - data.append(23); - data.append(24); - data.append(25); - data.append(26); - data.append(27); - data.append(28); - data.append(29); - data.append(30); - data.append(31); - data.append(32); - data.append(33); - data.append(34); - data.append(35); - data.append(12); - data.append(13); - data.append(14); - data.append(15); - data.append(16); - data.append(17); - data.append(18); - data.append(19); - data.append(20); - data.append(21); - data.append(22); - data.append(23); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - data.append(4); - data.append(5); - data.append(6); - data.append(7); - data.append(8); - data.append(9); - data.append(10); - data.append(11); - data.append(24); - data.append(25); - data.append(26); - data.append(27); - data.append(28); - data.append(29); - data.append(30); - data.append(31); - data.append(32); - data.append(33); - data.append(34); - data.append(35); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/grid_sample_cubic.cairo b/tests/nodes/grid_sample_cubic.cairo index fc790006b..4fa55b3df 100644 --- a/tests/nodes/grid_sample_cubic.cairo +++ b/tests/nodes/grid_sample_cubic.cairo @@ -8,7 +8,7 @@ use orion::numbers::FixedTrait; use orion::operators::tensor::FP16x16TensorPartialEq; use orion::utils::{assert_eq, assert_seq_eq}; use orion::operators::nn::NNTrait; -use orion::operators::nn::functional::grid_sample::MODE; +use orion::operators::nn::{MODE}; #[test] #[available_gas(2000000000)] diff --git a/tests/nodes/grid_sample_nearest.cairo b/tests/nodes/grid_sample_nearest.cairo index 3a5dc4a07..8915f3468 100644 --- a/tests/nodes/grid_sample_nearest.cairo +++ b/tests/nodes/grid_sample_nearest.cairo @@ -8,7 +8,7 @@ use orion::numbers::FixedTrait; use orion::operators::tensor::FP16x16TensorPartialEq; use orion::utils::{assert_eq, assert_seq_eq}; use orion::operators::nn::NNTrait; -use orion::operators::nn::functional::grid_sample::MODE; +use orion::operators::nn::{MODE}; #[test] #[available_gas(2000000000)] diff --git a/tests/nodes/grid_sample_nearest_aligncorner.cairo b/tests/nodes/grid_sample_nearest_aligncorner.cairo index 6e24295b3..7731f867a 100644 --- a/tests/nodes/grid_sample_nearest_aligncorner.cairo +++ b/tests/nodes/grid_sample_nearest_aligncorner.cairo @@ -8,7 +8,7 @@ use orion::numbers::FixedTrait; use orion::operators::tensor::FP16x16TensorPartialEq; use orion::utils::{assert_eq, assert_seq_eq}; use orion::operators::nn::NNTrait; -use orion::operators::nn::functional::grid_sample::MODE; +use orion::operators::nn::{MODE}; #[test] #[available_gas(2000000000)] diff --git a/tests/nodes/grid_sample_padding_border.cairo b/tests/nodes/grid_sample_padding_border.cairo index 135b43eef..bff7b1461 100644 --- a/tests/nodes/grid_sample_padding_border.cairo +++ b/tests/nodes/grid_sample_padding_border.cairo @@ -8,7 +8,7 @@ use orion::numbers::FixedTrait; use orion::operators::tensor::FP16x16TensorPartialEq; use orion::utils::{assert_eq, assert_seq_eq}; use orion::operators::nn::NNTrait; -use orion::operators::nn::functional::grid_sample::PADDING_MODE; +use orion::operators::nn::{PADDING_MODE}; #[test] #[available_gas(2000000000)] diff --git a/tests/nodes/grid_sample_padding_reflection.cairo b/tests/nodes/grid_sample_padding_reflection.cairo index 54590e0ba..561780a87 100644 --- a/tests/nodes/grid_sample_padding_reflection.cairo +++ b/tests/nodes/grid_sample_padding_reflection.cairo @@ -8,7 +8,7 @@ use orion::numbers::FixedTrait; use orion::operators::tensor::FP16x16TensorPartialEq; use orion::utils::{assert_eq, assert_seq_eq}; use orion::operators::nn::NNTrait; -use orion::operators::nn::functional::grid_sample::PADDING_MODE; +use orion::operators::nn::{PADDING_MODE}; #[test] #[available_gas(2000000000)] diff --git a/tests/nodes/grid_sample_padding_zeros.cairo b/tests/nodes/grid_sample_padding_zeros.cairo index b7ff7c6b3..d3c7db69c 100644 --- a/tests/nodes/grid_sample_padding_zeros.cairo +++ b/tests/nodes/grid_sample_padding_zeros.cairo @@ -8,7 +8,7 @@ use orion::numbers::FixedTrait; use orion::operators::tensor::FP16x16TensorPartialEq; use orion::utils::{assert_eq, assert_seq_eq}; use orion::operators::nn::NNTrait; -use orion::operators::nn::functional::grid_sample::PADDING_MODE; +use orion::operators::nn::{PADDING_MODE}; #[test] #[available_gas(2000000000)] diff --git a/tests/nodes/less_equal_fp16x16.cairo b/tests/nodes/less_equal_fp16x16.cairo index 19fe42d2d..d08953d94 100644 --- a/tests/nodes/less_equal_fp16x16.cairo +++ b/tests/nodes/less_equal_fp16x16.cairo @@ -3,22 +3,22 @@ mod input_1; mod output_0; -use orion::operators::tensor::{U32Tensor, U32TensorDiv}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorDiv}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::operators::tensor::FP16x16TensorPartialEq; use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::I32TensorPartialEq; use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::operators::tensor::FP16x16TensorPartialEq; +use orion::operators::tensor::{TensorTrait, Tensor}; #[test] #[available_gas(2000000000)] fn test_less_equal_fp16x16() { let input_0 = input_0::input_0(); let input_1 = input_1::input_1(); - let z = output_0::output_0(); + let z_0 = output_0::output_0(); - let y = input_0.less_equal(@input_1); + let y_0 = input_0.less_equal(@input_1); - assert_eq(y, z); + assert_eq(y_0, z_0); } diff --git a/tests/nodes/less_equal_fp16x16/input_0.cairo b/tests/nodes/less_equal_fp16x16/input_0.cairo index ec0027d22..7d6981164 100644 --- a/tests/nodes/less_equal_fp16x16/input_0.cairo +++ b/tests/nodes/less_equal_fp16x16/input_0.cairo @@ -1,6 +1,6 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorDiv}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; use orion::numbers::{FixedTrait, FP16x16}; fn input_0() -> Tensor { @@ -9,9 +9,9 @@ fn input_0() -> Tensor { shape.append(2); let mut data = ArrayTrait::new(); - data.append(FP16x16 { mag: 0, sign: false }); - data.append(FP16x16 { mag: 131072, sign: false }); - data.append(FP16x16 { mag: 0, sign: false }); - data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 65536, sign: true }); + data.append(FP16x16 { mag: 196608, sign: true }); + data.append(FP16x16 { mag: 65536, sign: true }); + data.append(FP16x16 { mag: 131072, sign: true }); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_equal_fp16x16/input_1.cairo b/tests/nodes/less_equal_fp16x16/input_1.cairo index 5cc407dc5..1adb39195 100644 --- a/tests/nodes/less_equal_fp16x16/input_1.cairo +++ b/tests/nodes/less_equal_fp16x16/input_1.cairo @@ -1,6 +1,6 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorDiv}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; use orion::numbers::{FixedTrait, FP16x16}; fn input_1() -> Tensor { @@ -9,9 +9,9 @@ fn input_1() -> Tensor { shape.append(2); let mut data = ArrayTrait::new(); - data.append(FP16x16 { mag: 131072, sign: false }); - data.append(FP16x16 { mag: 131072, sign: false }); data.append(FP16x16 { mag: 131072, sign: true }); - data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: true }); + data.append(FP16x16 { mag: 131072, sign: false }); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_equal_fp16x16/output_0.cairo b/tests/nodes/less_equal_fp16x16/output_0.cairo index 7e2cee38d..b066124bb 100644 --- a/tests/nodes/less_equal_fp16x16/output_0.cairo +++ b/tests/nodes/less_equal_fp16x16/output_0.cairo @@ -1,16 +1,17 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorDiv}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn output_0() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(2); shape.append(2); let mut data = ArrayTrait::new(); + data.append(0); + data.append(1); data.append(1); data.append(1); - data.append(0); - data.append(0); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_equal_fp16x16_broadcast.cairo b/tests/nodes/less_equal_fp16x16_broadcast.cairo index 6ca29eb78..ef67204ff 100644 --- a/tests/nodes/less_equal_fp16x16_broadcast.cairo +++ b/tests/nodes/less_equal_fp16x16_broadcast.cairo @@ -3,22 +3,22 @@ mod input_1; mod output_0; -use orion::operators::tensor::{U32Tensor, U32TensorDiv}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorDiv}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::operators::tensor::FP16x16TensorPartialEq; use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::I32TensorPartialEq; use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::operators::tensor::FP16x16TensorPartialEq; +use orion::operators::tensor::{TensorTrait, Tensor}; #[test] #[available_gas(2000000000)] fn test_less_equal_fp16x16_broadcast() { let input_0 = input_0::input_0(); let input_1 = input_1::input_1(); - let z = output_0::output_0(); + let z_0 = output_0::output_0(); - let y = input_0.less_equal(@input_1); + let y_0 = input_0.less_equal(@input_1); - assert_eq(y, z); + assert_eq(y_0, z_0); } diff --git a/tests/nodes/less_equal_fp16x16_broadcast/input_0.cairo b/tests/nodes/less_equal_fp16x16_broadcast/input_0.cairo index 13261de0d..35099fc12 100644 --- a/tests/nodes/less_equal_fp16x16_broadcast/input_0.cairo +++ b/tests/nodes/less_equal_fp16x16_broadcast/input_0.cairo @@ -1,6 +1,6 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorDiv}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; use orion::numbers::{FixedTrait, FP16x16}; fn input_0() -> Tensor { @@ -9,9 +9,9 @@ fn input_0() -> Tensor { shape.append(2); let mut data = ArrayTrait::new(); - data.append(FP16x16 { mag: 65536, sign: true }); + data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 131072, sign: true }); + data.append(FP16x16 { mag: 65536, sign: false }); data.append(FP16x16 { mag: 65536, sign: false }); - data.append(FP16x16 { mag: 65536, sign: true }); - data.append(FP16x16 { mag: 196608, sign: true }); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_equal_fp16x16_broadcast/input_1.cairo b/tests/nodes/less_equal_fp16x16_broadcast/input_1.cairo index 25a595400..7e68b68a9 100644 --- a/tests/nodes/less_equal_fp16x16_broadcast/input_1.cairo +++ b/tests/nodes/less_equal_fp16x16_broadcast/input_1.cairo @@ -1,6 +1,6 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorDiv}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; use orion::numbers::{FixedTrait, FP16x16}; fn input_1() -> Tensor { @@ -10,6 +10,6 @@ fn input_1() -> Tensor { let mut data = ArrayTrait::new(); data.append(FP16x16 { mag: 0, sign: false }); - data.append(FP16x16 { mag: 196608, sign: true }); + data.append(FP16x16 { mag: 65536, sign: true }); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_equal_fp16x16_broadcast/output_0.cairo b/tests/nodes/less_equal_fp16x16_broadcast/output_0.cairo index 31cf673d4..abcbdb1de 100644 --- a/tests/nodes/less_equal_fp16x16_broadcast/output_0.cairo +++ b/tests/nodes/less_equal_fp16x16_broadcast/output_0.cairo @@ -1,16 +1,17 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorDiv}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn output_0() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(2); shape.append(2); let mut data = ArrayTrait::new(); data.append(1); - data.append(0); - data.append(1); data.append(1); + data.append(0); + data.append(0); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_equal_fp8x23.cairo b/tests/nodes/less_equal_fp8x23.cairo index 3ee472dce..0c18c9338 100644 --- a/tests/nodes/less_equal_fp8x23.cairo +++ b/tests/nodes/less_equal_fp8x23.cairo @@ -3,22 +3,22 @@ mod input_1; mod output_0; -use orion::operators::tensor::{U32Tensor, U32TensorDiv}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorDiv}; -use orion::operators::tensor::U32TensorPartialEq; use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; +use orion::operators::tensor::I32TensorPartialEq; use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; use orion::operators::tensor::FP8x23TensorPartialEq; +use orion::operators::tensor::{TensorTrait, Tensor}; #[test] #[available_gas(2000000000)] fn test_less_equal_fp8x23() { let input_0 = input_0::input_0(); let input_1 = input_1::input_1(); - let z = output_0::output_0(); + let z_0 = output_0::output_0(); - let y = input_0.less_equal(@input_1); + let y_0 = input_0.less_equal(@input_1); - assert_eq(y, z); + assert_eq(y_0, z_0); } diff --git a/tests/nodes/less_equal_fp8x23/input_0.cairo b/tests/nodes/less_equal_fp8x23/input_0.cairo index cac7e356e..110d6b273 100644 --- a/tests/nodes/less_equal_fp8x23/input_0.cairo +++ b/tests/nodes/less_equal_fp8x23/input_0.cairo @@ -1,6 +1,6 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorDiv}; +use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; use orion::numbers::{FixedTrait, FP8x23}; fn input_0() -> Tensor { @@ -9,9 +9,9 @@ fn input_0() -> Tensor { shape.append(2); let mut data = ArrayTrait::new(); + data.append(FP8x23 { mag: 0, sign: false }); + data.append(FP8x23 { mag: 0, sign: false }); + data.append(FP8x23 { mag: 16777216, sign: true }); data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 25165824, sign: true }); - data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: true }); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_equal_fp8x23/input_1.cairo b/tests/nodes/less_equal_fp8x23/input_1.cairo index 6a5e5a086..8804a2fb7 100644 --- a/tests/nodes/less_equal_fp8x23/input_1.cairo +++ b/tests/nodes/less_equal_fp8x23/input_1.cairo @@ -1,6 +1,6 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorDiv}; +use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; use orion::numbers::{FixedTrait, FP8x23}; fn input_1() -> Tensor { @@ -11,7 +11,7 @@ fn input_1() -> Tensor { let mut data = ArrayTrait::new(); data.append(FP8x23 { mag: 0, sign: false }); data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: true }); + data.append(FP8x23 { mag: 16777216, sign: true }); data.append(FP8x23 { mag: 16777216, sign: false }); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_equal_fp8x23/output_0.cairo b/tests/nodes/less_equal_fp8x23/output_0.cairo index 07948a48e..0367c57b6 100644 --- a/tests/nodes/less_equal_fp8x23/output_0.cairo +++ b/tests/nodes/less_equal_fp8x23/output_0.cairo @@ -1,16 +1,17 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorDiv}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn output_0() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(2); shape.append(2); let mut data = ArrayTrait::new(); - data.append(0); data.append(1); - data.append(0); + data.append(1); + data.append(1); data.append(1); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_equal_fp8x23_broadcast.cairo b/tests/nodes/less_equal_fp8x23_broadcast.cairo index 8cf36a6ba..12b528d3d 100644 --- a/tests/nodes/less_equal_fp8x23_broadcast.cairo +++ b/tests/nodes/less_equal_fp8x23_broadcast.cairo @@ -3,22 +3,22 @@ mod input_1; mod output_0; -use orion::operators::tensor::{U32Tensor, U32TensorDiv}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorDiv}; -use orion::operators::tensor::U32TensorPartialEq; use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; +use orion::operators::tensor::I32TensorPartialEq; use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; use orion::operators::tensor::FP8x23TensorPartialEq; +use orion::operators::tensor::{TensorTrait, Tensor}; #[test] #[available_gas(2000000000)] fn test_less_equal_fp8x23_broadcast() { let input_0 = input_0::input_0(); let input_1 = input_1::input_1(); - let z = output_0::output_0(); + let z_0 = output_0::output_0(); - let y = input_0.less_equal(@input_1); + let y_0 = input_0.less_equal(@input_1); - assert_eq(y, z); + assert_eq(y_0, z_0); } diff --git a/tests/nodes/less_equal_fp8x23_broadcast/input_0.cairo b/tests/nodes/less_equal_fp8x23_broadcast/input_0.cairo index 597e948e1..4ab421020 100644 --- a/tests/nodes/less_equal_fp8x23_broadcast/input_0.cairo +++ b/tests/nodes/less_equal_fp8x23_broadcast/input_0.cairo @@ -1,6 +1,6 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorDiv}; +use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; use orion::numbers::{FixedTrait, FP8x23}; fn input_0() -> Tensor { @@ -9,9 +9,9 @@ fn input_0() -> Tensor { shape.append(2); let mut data = ArrayTrait::new(); + data.append(FP8x23 { mag: 8388608, sign: false }); data.append(FP8x23 { mag: 0, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: true }); - data.append(FP8x23 { mag: 25165824, sign: true }); - data.append(FP8x23 { mag: 25165824, sign: true }); + data.append(FP8x23 { mag: 0, sign: false }); + data.append(FP8x23 { mag: 16777216, sign: false }); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_equal_fp8x23_broadcast/input_1.cairo b/tests/nodes/less_equal_fp8x23_broadcast/input_1.cairo index 6a7c55548..95b4fb754 100644 --- a/tests/nodes/less_equal_fp8x23_broadcast/input_1.cairo +++ b/tests/nodes/less_equal_fp8x23_broadcast/input_1.cairo @@ -1,6 +1,6 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorDiv}; +use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; use orion::numbers::{FixedTrait, FP8x23}; fn input_1() -> Tensor { @@ -9,7 +9,7 @@ fn input_1() -> Tensor { shape.append(2); let mut data = ArrayTrait::new(); + data.append(FP8x23 { mag: 25165824, sign: true }); data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: true }); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_equal_fp8x23_broadcast/output_0.cairo b/tests/nodes/less_equal_fp8x23_broadcast/output_0.cairo index 62010885f..5614176ce 100644 --- a/tests/nodes/less_equal_fp8x23_broadcast/output_0.cairo +++ b/tests/nodes/less_equal_fp8x23_broadcast/output_0.cairo @@ -1,16 +1,17 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorDiv}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn output_0() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(2); shape.append(2); let mut data = ArrayTrait::new(); + data.append(0); data.append(1); - data.append(1); - data.append(1); + data.append(0); data.append(1); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_equal_i32.cairo b/tests/nodes/less_equal_i32.cairo index 3072a59b0..474974374 100644 --- a/tests/nodes/less_equal_i32.cairo +++ b/tests/nodes/less_equal_i32.cairo @@ -3,22 +3,20 @@ mod input_1; mod output_0; -use orion::operators::tensor::{U32Tensor, U32TensorDiv}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::operators::tensor::I32TensorPartialEq; use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::I32TensorPartialEq; use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{I32Tensor, I32TensorDiv}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::operators::tensor::{TensorTrait, Tensor}; #[test] #[available_gas(2000000000)] fn test_less_equal_i32() { let input_0 = input_0::input_0(); let input_1 = input_1::input_1(); - let z = output_0::output_0(); + let z_0 = output_0::output_0(); - let y = input_0.less_equal(@input_1); + let y_0 = input_0.less_equal(@input_1); - assert_eq(y, z); + assert_eq(y_0, z_0); } diff --git a/tests/nodes/less_equal_i32/input_0.cairo b/tests/nodes/less_equal_i32/input_0.cairo index 11c8e73ff..cae2bd7f1 100644 --- a/tests/nodes/less_equal_i32/input_0.cairo +++ b/tests/nodes/less_equal_i32/input_0.cairo @@ -1,6 +1,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorDiv}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; fn input_0() -> Tensor { let mut shape = ArrayTrait::::new(); @@ -9,8 +10,8 @@ fn input_0() -> Tensor { let mut data = ArrayTrait::new(); data.append(-3); + data.append(2); data.append(-3); - data.append(-2); - data.append(1); + data.append(-1); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_equal_i32/input_1.cairo b/tests/nodes/less_equal_i32/input_1.cairo index 330426cd7..219f31bdc 100644 --- a/tests/nodes/less_equal_i32/input_1.cairo +++ b/tests/nodes/less_equal_i32/input_1.cairo @@ -1,6 +1,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorDiv}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; fn input_1() -> Tensor { let mut shape = ArrayTrait::::new(); @@ -8,9 +9,9 @@ fn input_1() -> Tensor { shape.append(2); let mut data = ArrayTrait::new(); + data.append(-2); data.append(2); - data.append(2); - data.append(-3); - data.append(1); + data.append(-2); + data.append(0); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_equal_i32/output_0.cairo b/tests/nodes/less_equal_i32/output_0.cairo index 8442d0d0c..0367c57b6 100644 --- a/tests/nodes/less_equal_i32/output_0.cairo +++ b/tests/nodes/less_equal_i32/output_0.cairo @@ -1,8 +1,9 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorDiv}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn output_0() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(2); shape.append(2); @@ -10,7 +11,7 @@ fn output_0() -> Tensor { let mut data = ArrayTrait::new(); data.append(1); data.append(1); - data.append(0); + data.append(1); data.append(1); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_equal_i32_broadcast.cairo b/tests/nodes/less_equal_i32_broadcast.cairo index 3657b38d9..7b498fc0d 100644 --- a/tests/nodes/less_equal_i32_broadcast.cairo +++ b/tests/nodes/less_equal_i32_broadcast.cairo @@ -3,22 +3,20 @@ mod input_1; mod output_0; -use orion::operators::tensor::{U32Tensor, U32TensorDiv}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::operators::tensor::I32TensorPartialEq; use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::I32TensorPartialEq; use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{I32Tensor, I32TensorDiv}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::operators::tensor::{TensorTrait, Tensor}; #[test] #[available_gas(2000000000)] fn test_less_equal_i32_broadcast() { let input_0 = input_0::input_0(); let input_1 = input_1::input_1(); - let z = output_0::output_0(); + let z_0 = output_0::output_0(); - let y = input_0.less_equal(@input_1); + let y_0 = input_0.less_equal(@input_1); - assert_eq(y, z); + assert_eq(y_0, z_0); } diff --git a/tests/nodes/less_equal_i32_broadcast/input_0.cairo b/tests/nodes/less_equal_i32_broadcast/input_0.cairo index 9f1d44f37..e6f5a6f14 100644 --- a/tests/nodes/less_equal_i32_broadcast/input_0.cairo +++ b/tests/nodes/less_equal_i32_broadcast/input_0.cairo @@ -1,6 +1,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorDiv}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; fn input_0() -> Tensor { let mut shape = ArrayTrait::::new(); @@ -9,8 +10,8 @@ fn input_0() -> Tensor { let mut data = ArrayTrait::new(); data.append(-2); - data.append(1); - data.append(-3); - data.append(-2); + data.append(2); + data.append(2); + data.append(-1); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_equal_i32_broadcast/input_1.cairo b/tests/nodes/less_equal_i32_broadcast/input_1.cairo index dc3c54f94..be5599aac 100644 --- a/tests/nodes/less_equal_i32_broadcast/input_1.cairo +++ b/tests/nodes/less_equal_i32_broadcast/input_1.cairo @@ -1,6 +1,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorDiv}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; fn input_1() -> Tensor { let mut shape = ArrayTrait::::new(); @@ -8,7 +9,7 @@ fn input_1() -> Tensor { shape.append(2); let mut data = ArrayTrait::new(); - data.append(-2); - data.append(-1); + data.append(2); + data.append(0); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_equal_i32_broadcast/output_0.cairo b/tests/nodes/less_equal_i32_broadcast/output_0.cairo index 31cf673d4..085034f13 100644 --- a/tests/nodes/less_equal_i32_broadcast/output_0.cairo +++ b/tests/nodes/less_equal_i32_broadcast/output_0.cairo @@ -1,8 +1,9 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorDiv}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn output_0() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(2); shape.append(2); diff --git a/tests/nodes/less_equal_i8.cairo b/tests/nodes/less_equal_i8.cairo index c86a70ec1..6594b7bd1 100644 --- a/tests/nodes/less_equal_i8.cairo +++ b/tests/nodes/less_equal_i8.cairo @@ -3,22 +3,22 @@ mod input_1; mod output_0; -use orion::operators::tensor::{U32Tensor, U32TensorDiv}; -use orion::operators::tensor::I8TensorPartialEq; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::U32TensorPartialEq; +use orion::operators::tensor::{I8Tensor, I8TensorAdd}; use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::I32TensorPartialEq; use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{I8Tensor, I8TensorDiv}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::operators::tensor::I8TensorPartialEq; +use orion::operators::tensor::{TensorTrait, Tensor}; #[test] #[available_gas(2000000000)] fn test_less_equal_i8() { let input_0 = input_0::input_0(); let input_1 = input_1::input_1(); - let z = output_0::output_0(); + let z_0 = output_0::output_0(); - let y = input_0.less_equal(@input_1); + let y_0 = input_0.less_equal(@input_1); - assert_eq(y, z); + assert_eq(y_0, z_0); } diff --git a/tests/nodes/less_equal_i8/input_0.cairo b/tests/nodes/less_equal_i8/input_0.cairo index 4f53a978e..ec1b63b85 100644 --- a/tests/nodes/less_equal_i8/input_0.cairo +++ b/tests/nodes/less_equal_i8/input_0.cairo @@ -1,6 +1,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I8Tensor, I8TensorDiv}; +use orion::operators::tensor::{I8Tensor, I8TensorAdd}; +use orion::numbers::NumberTrait; fn input_0() -> Tensor { let mut shape = ArrayTrait::::new(); @@ -9,7 +10,7 @@ fn input_0() -> Tensor { let mut data = ArrayTrait::new(); data.append(-3); - data.append(-1); + data.append(2); data.append(-1); data.append(-2); TensorTrait::new(shape.span(), data.span()) diff --git a/tests/nodes/less_equal_i8/input_1.cairo b/tests/nodes/less_equal_i8/input_1.cairo index 6cb982144..7389f1082 100644 --- a/tests/nodes/less_equal_i8/input_1.cairo +++ b/tests/nodes/less_equal_i8/input_1.cairo @@ -1,6 +1,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I8Tensor, I8TensorDiv}; +use orion::operators::tensor::{I8Tensor, I8TensorAdd}; +use orion::numbers::NumberTrait; fn input_1() -> Tensor { let mut shape = ArrayTrait::::new(); @@ -8,9 +9,9 @@ fn input_1() -> Tensor { shape.append(2); let mut data = ArrayTrait::new(); - data.append(0); data.append(-2); - data.append(1); + data.append(2); + data.append(-1); data.append(1); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_equal_i8/output_0.cairo b/tests/nodes/less_equal_i8/output_0.cairo index 31cf673d4..0367c57b6 100644 --- a/tests/nodes/less_equal_i8/output_0.cairo +++ b/tests/nodes/less_equal_i8/output_0.cairo @@ -1,15 +1,16 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorDiv}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn output_0() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(2); shape.append(2); let mut data = ArrayTrait::new(); data.append(1); - data.append(0); + data.append(1); data.append(1); data.append(1); TensorTrait::new(shape.span(), data.span()) diff --git a/tests/nodes/less_equal_i8_broadcast.cairo b/tests/nodes/less_equal_i8_broadcast.cairo index ac53e3aa6..070cd2f57 100644 --- a/tests/nodes/less_equal_i8_broadcast.cairo +++ b/tests/nodes/less_equal_i8_broadcast.cairo @@ -3,22 +3,22 @@ mod input_1; mod output_0; -use orion::operators::tensor::{U32Tensor, U32TensorDiv}; -use orion::operators::tensor::I8TensorPartialEq; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::U32TensorPartialEq; +use orion::operators::tensor::{I8Tensor, I8TensorAdd}; use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::I32TensorPartialEq; use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::{I8Tensor, I8TensorDiv}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::operators::tensor::I8TensorPartialEq; +use orion::operators::tensor::{TensorTrait, Tensor}; #[test] #[available_gas(2000000000)] fn test_less_equal_i8_broadcast() { let input_0 = input_0::input_0(); let input_1 = input_1::input_1(); - let z = output_0::output_0(); + let z_0 = output_0::output_0(); - let y = input_0.less_equal(@input_1); + let y_0 = input_0.less_equal(@input_1); - assert_eq(y, z); + assert_eq(y_0, z_0); } diff --git a/tests/nodes/less_equal_i8_broadcast/input_0.cairo b/tests/nodes/less_equal_i8_broadcast/input_0.cairo index 835e66354..f0422b9f4 100644 --- a/tests/nodes/less_equal_i8_broadcast/input_0.cairo +++ b/tests/nodes/less_equal_i8_broadcast/input_0.cairo @@ -1,6 +1,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I8Tensor, I8TensorDiv}; +use orion::operators::tensor::{I8Tensor, I8TensorAdd}; +use orion::numbers::NumberTrait; fn input_0() -> Tensor { let mut shape = ArrayTrait::::new(); @@ -8,9 +9,9 @@ fn input_0() -> Tensor { shape.append(2); let mut data = ArrayTrait::new(); - data.append(2); - data.append(2); - data.append(2); - data.append(-3); + data.append(-1); + data.append(0); + data.append(0); + data.append(-1); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_equal_i8_broadcast/input_1.cairo b/tests/nodes/less_equal_i8_broadcast/input_1.cairo index 02ff8facd..03f8b18c6 100644 --- a/tests/nodes/less_equal_i8_broadcast/input_1.cairo +++ b/tests/nodes/less_equal_i8_broadcast/input_1.cairo @@ -1,6 +1,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I8Tensor, I8TensorDiv}; +use orion::operators::tensor::{I8Tensor, I8TensorAdd}; +use orion::numbers::NumberTrait; fn input_1() -> Tensor { let mut shape = ArrayTrait::::new(); @@ -8,7 +9,7 @@ fn input_1() -> Tensor { shape.append(2); let mut data = ArrayTrait::new(); - data.append(-3); - data.append(-3); + data.append(2); + data.append(2); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_equal_i8_broadcast/output_0.cairo b/tests/nodes/less_equal_i8_broadcast/output_0.cairo index 9a2391c78..0367c57b6 100644 --- a/tests/nodes/less_equal_i8_broadcast/output_0.cairo +++ b/tests/nodes/less_equal_i8_broadcast/output_0.cairo @@ -1,16 +1,17 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorDiv}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn output_0() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(2); shape.append(2); let mut data = ArrayTrait::new(); - data.append(0); - data.append(0); - data.append(0); + data.append(1); + data.append(1); + data.append(1); data.append(1); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_equal_u32.cairo b/tests/nodes/less_equal_u32.cairo index 8a1e7aab4..c9ec171ca 100644 --- a/tests/nodes/less_equal_u32.cairo +++ b/tests/nodes/less_equal_u32.cairo @@ -3,20 +3,22 @@ mod input_1; mod output_0; -use orion::operators::tensor::{U32Tensor, U32TensorDiv}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::U32TensorPartialEq; use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::operators::tensor::I32TensorPartialEq; +use orion::operators::tensor::U32TensorPartialEq; +use orion::operators::tensor::{TensorTrait, Tensor}; #[test] #[available_gas(2000000000)] fn test_less_equal_u32() { let input_0 = input_0::input_0(); let input_1 = input_1::input_1(); - let z = output_0::output_0(); + let z_0 = output_0::output_0(); - let y = input_0.less_equal(@input_1); + let y_0 = input_0.less_equal(@input_1); - assert_eq(y, z); + assert_eq(y_0, z_0); } diff --git a/tests/nodes/less_equal_u32/input_0.cairo b/tests/nodes/less_equal_u32/input_0.cairo index 84b61d7cc..4f912fb5d 100644 --- a/tests/nodes/less_equal_u32/input_0.cairo +++ b/tests/nodes/less_equal_u32/input_0.cairo @@ -1,6 +1,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorDiv}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::numbers::NumberTrait; fn input_0() -> Tensor { let mut shape = ArrayTrait::::new(); @@ -8,9 +9,9 @@ fn input_0() -> Tensor { shape.append(2); let mut data = ArrayTrait::new(); - data.append(1); + data.append(0); data.append(2); - data.append(5); - data.append(5); + data.append(0); + data.append(0); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_equal_u32/input_1.cairo b/tests/nodes/less_equal_u32/input_1.cairo index fe6539464..05bf5f2e6 100644 --- a/tests/nodes/less_equal_u32/input_1.cairo +++ b/tests/nodes/less_equal_u32/input_1.cairo @@ -1,6 +1,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorDiv}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::numbers::NumberTrait; fn input_1() -> Tensor { let mut shape = ArrayTrait::::new(); @@ -8,9 +9,9 @@ fn input_1() -> Tensor { shape.append(2); let mut data = ArrayTrait::new(); - data.append(0); - data.append(4); + data.append(2); data.append(5); data.append(3); + data.append(2); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_equal_u32/output_0.cairo b/tests/nodes/less_equal_u32/output_0.cairo index de313d890..0367c57b6 100644 --- a/tests/nodes/less_equal_u32/output_0.cairo +++ b/tests/nodes/less_equal_u32/output_0.cairo @@ -1,16 +1,17 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorDiv}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn output_0() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(2); shape.append(2); let mut data = ArrayTrait::new(); - data.append(0); data.append(1); data.append(1); - data.append(0); + data.append(1); + data.append(1); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_equal_u32_broadcast.cairo b/tests/nodes/less_equal_u32_broadcast.cairo index dc695687d..b30f5cd1e 100644 --- a/tests/nodes/less_equal_u32_broadcast.cairo +++ b/tests/nodes/less_equal_u32_broadcast.cairo @@ -3,20 +3,22 @@ mod input_1; mod output_0; -use orion::operators::tensor::{U32Tensor, U32TensorDiv}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::U32TensorPartialEq; use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::operators::tensor::I32TensorPartialEq; +use orion::operators::tensor::U32TensorPartialEq; +use orion::operators::tensor::{TensorTrait, Tensor}; #[test] #[available_gas(2000000000)] fn test_less_equal_u32_broadcast() { let input_0 = input_0::input_0(); let input_1 = input_1::input_1(); - let z = output_0::output_0(); + let z_0 = output_0::output_0(); - let y = input_0.less_equal(@input_1); + let y_0 = input_0.less_equal(@input_1); - assert_eq(y, z); + assert_eq(y_0, z_0); } diff --git a/tests/nodes/less_equal_u32_broadcast/input_0.cairo b/tests/nodes/less_equal_u32_broadcast/input_0.cairo index a6bf00a7c..2d8435a2f 100644 --- a/tests/nodes/less_equal_u32_broadcast/input_0.cairo +++ b/tests/nodes/less_equal_u32_broadcast/input_0.cairo @@ -1,6 +1,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorDiv}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::numbers::NumberTrait; fn input_0() -> Tensor { let mut shape = ArrayTrait::::new(); @@ -9,8 +10,8 @@ fn input_0() -> Tensor { let mut data = ArrayTrait::new(); data.append(0); - data.append(5); - data.append(4); data.append(0); + data.append(3); + data.append(3); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_equal_u32_broadcast/input_1.cairo b/tests/nodes/less_equal_u32_broadcast/input_1.cairo index 8e7328b81..7ee1bbea4 100644 --- a/tests/nodes/less_equal_u32_broadcast/input_1.cairo +++ b/tests/nodes/less_equal_u32_broadcast/input_1.cairo @@ -1,6 +1,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorDiv}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::numbers::NumberTrait; fn input_1() -> Tensor { let mut shape = ArrayTrait::::new(); @@ -8,7 +9,7 @@ fn input_1() -> Tensor { shape.append(2); let mut data = ArrayTrait::new(); - data.append(1); - data.append(1); + data.append(3); + data.append(2); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_equal_u32_broadcast/output_0.cairo b/tests/nodes/less_equal_u32_broadcast/output_0.cairo index ef770fa07..897d076d9 100644 --- a/tests/nodes/less_equal_u32_broadcast/output_0.cairo +++ b/tests/nodes/less_equal_u32_broadcast/output_0.cairo @@ -1,16 +1,17 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorDiv}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn output_0() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(2); shape.append(2); let mut data = ArrayTrait::new(); data.append(1); - data.append(0); - data.append(0); data.append(1); + data.append(1); + data.append(0); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_fp16x16.cairo b/tests/nodes/less_fp16x16.cairo index 04ac88b63..49840aa1a 100644 --- a/tests/nodes/less_fp16x16.cairo +++ b/tests/nodes/less_fp16x16.cairo @@ -3,22 +3,22 @@ mod input_1; mod output_0; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorSub}; -use orion::utils::{assert_eq, assert_seq_eq}; use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::FP16x16TensorPartialEq; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::U32TensorPartialEq; +use orion::operators::tensor::I32TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; #[test] #[available_gas(2000000000)] fn test_less_fp16x16() { let input_0 = input_0::input_0(); let input_1 = input_1::input_1(); - let z = output_0::output_0(); + let z_0 = output_0::output_0(); - let y = input_0.less(@input_1); + let y_0 = input_0.less(@input_1); - assert_eq(y, z); + assert_eq(y_0, z_0); } diff --git a/tests/nodes/less_fp16x16/input_0.cairo b/tests/nodes/less_fp16x16/input_0.cairo index 41fa7524d..40500ebda 100644 --- a/tests/nodes/less_fp16x16/input_0.cairo +++ b/tests/nodes/less_fp16x16/input_0.cairo @@ -1,6 +1,6 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorSub}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; use orion::numbers::{FixedTrait, FP16x16}; fn input_0() -> Tensor { @@ -10,32 +10,32 @@ fn input_0() -> Tensor { shape.append(3); let mut data = ArrayTrait::new(); - data.append(FP16x16 { mag: 65536, sign: true }); - data.append(FP16x16 { mag: 65536, sign: true }); - data.append(FP16x16 { mag: 196608, sign: true }); - data.append(FP16x16 { mag: 65536, sign: true }); data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); data.append(FP16x16 { mag: 0, sign: false }); - data.append(FP16x16 { mag: 131072, sign: false }); - data.append(FP16x16 { mag: 131072, sign: true }); data.append(FP16x16 { mag: 131072, sign: true }); - data.append(FP16x16 { mag: 65536, sign: true }); data.append(FP16x16 { mag: 196608, sign: true }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: true }); + data.append(FP16x16 { mag: 65536, sign: true }); data.append(FP16x16 { mag: 0, sign: false }); data.append(FP16x16 { mag: 196608, sign: true }); + data.append(FP16x16 { mag: 65536, sign: true }); + data.append(FP16x16 { mag: 65536, sign: false }); data.append(FP16x16 { mag: 196608, sign: true }); - data.append(FP16x16 { mag: 131072, sign: true }); + data.append(FP16x16 { mag: 65536, sign: true }); data.append(FP16x16 { mag: 196608, sign: true }); - data.append(FP16x16 { mag: 0, sign: false }); data.append(FP16x16 { mag: 65536, sign: true }); + data.append(FP16x16 { mag: 131072, sign: true }); data.append(FP16x16 { mag: 131072, sign: false }); - data.append(FP16x16 { mag: 65536, sign: false }); - data.append(FP16x16 { mag: 65536, sign: true }); data.append(FP16x16 { mag: 0, sign: false }); data.append(FP16x16 { mag: 131072, sign: true }); - data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 131072, sign: true }); data.append(FP16x16 { mag: 196608, sign: true }); + data.append(FP16x16 { mag: 65536, sign: true }); + data.append(FP16x16 { mag: 65536, sign: true }); data.append(FP16x16 { mag: 65536, sign: false }); - data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 196608, sign: true }); + data.append(FP16x16 { mag: 0, sign: false }); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_fp16x16/input_1.cairo b/tests/nodes/less_fp16x16/input_1.cairo index fe0e56e41..c28c2a921 100644 --- a/tests/nodes/less_fp16x16/input_1.cairo +++ b/tests/nodes/less_fp16x16/input_1.cairo @@ -1,6 +1,6 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorSub}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; use orion::numbers::{FixedTrait, FP16x16}; fn input_1() -> Tensor { @@ -10,32 +10,32 @@ fn input_1() -> Tensor { shape.append(3); let mut data = ArrayTrait::new(); - data.append(FP16x16 { mag: 65536, sign: false }); - data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 131072, sign: true }); data.append(FP16x16 { mag: 196608, sign: true }); - data.append(FP16x16 { mag: 0, sign: false }); data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: true }); data.append(FP16x16 { mag: 131072, sign: true }); data.append(FP16x16 { mag: 65536, sign: false }); - data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 131072, sign: true }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); data.append(FP16x16 { mag: 65536, sign: false }); - data.append(FP16x16 { mag: 131072, sign: false }); - data.append(FP16x16 { mag: 196608, sign: true }); data.append(FP16x16 { mag: 65536, sign: false }); - data.append(FP16x16 { mag: 131072, sign: false }); - data.append(FP16x16 { mag: 0, sign: false }); - data.append(FP16x16 { mag: 131072, sign: true }); - data.append(FP16x16 { mag: 0, sign: false }); data.append(FP16x16 { mag: 65536, sign: true }); - data.append(FP16x16 { mag: 0, sign: false }); - data.append(FP16x16 { mag: 131072, sign: false }); - data.append(FP16x16 { mag: 131072, sign: false }); data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 65536, sign: true }); data.append(FP16x16 { mag: 131072, sign: true }); + data.append(FP16x16 { mag: 131072, sign: true }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); data.append(FP16x16 { mag: 0, sign: false }); data.append(FP16x16 { mag: 0, sign: false }); - data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 65536, sign: true }); + data.append(FP16x16 { mag: 131072, sign: false }); data.append(FP16x16 { mag: 65536, sign: false }); - data.append(FP16x16 { mag: 196608, sign: true }); + data.append(FP16x16 { mag: 131072, sign: false }); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_fp16x16/output_0.cairo b/tests/nodes/less_fp16x16/output_0.cairo index ff7a8e63d..d6da68806 100644 --- a/tests/nodes/less_fp16x16/output_0.cairo +++ b/tests/nodes/less_fp16x16/output_0.cairo @@ -1,20 +1,22 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn output_0() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(3); shape.append(3); shape.append(3); let mut data = ArrayTrait::new(); - data.append(1); - data.append(1); data.append(0); + data.append(0); + data.append(1); data.append(1); data.append(1); data.append(0); + data.append(1); data.append(0); data.append(1); data.append(1); @@ -23,18 +25,17 @@ fn output_0() -> Tensor { data.append(1); data.append(1); data.append(1); - data.append(0); data.append(1); - data.append(0); data.append(1); data.append(0); + data.append(0); data.append(1); data.append(1); - data.append(0); data.append(1); - data.append(0); data.append(1); data.append(0); - data.append(0); + data.append(1); + data.append(1); + data.append(1); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_fp16x16_broadcast.cairo b/tests/nodes/less_fp16x16_broadcast.cairo index 787c07448..0673dc984 100644 --- a/tests/nodes/less_fp16x16_broadcast.cairo +++ b/tests/nodes/less_fp16x16_broadcast.cairo @@ -3,22 +3,22 @@ mod input_1; mod output_0; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorSub}; -use orion::utils::{assert_eq, assert_seq_eq}; use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::FP16x16TensorPartialEq; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::U32TensorPartialEq; +use orion::operators::tensor::I32TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; #[test] #[available_gas(2000000000)] fn test_less_fp16x16_broadcast() { let input_0 = input_0::input_0(); let input_1 = input_1::input_1(); - let z = output_0::output_0(); + let z_0 = output_0::output_0(); - let y = input_0.less(@input_1); + let y_0 = input_0.less(@input_1); - assert_eq(y, z); + assert_eq(y_0, z_0); } diff --git a/tests/nodes/less_fp16x16_broadcast/input_0.cairo b/tests/nodes/less_fp16x16_broadcast/input_0.cairo index 18782c0dd..24f7ea113 100644 --- a/tests/nodes/less_fp16x16_broadcast/input_0.cairo +++ b/tests/nodes/less_fp16x16_broadcast/input_0.cairo @@ -1,6 +1,6 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorSub}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; use orion::numbers::{FixedTrait, FP16x16}; fn input_0() -> Tensor { @@ -10,32 +10,32 @@ fn input_0() -> Tensor { shape.append(3); let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); data.append(FP16x16 { mag: 131072, sign: true }); data.append(FP16x16 { mag: 131072, sign: false }); - data.append(FP16x16 { mag: 131072, sign: false }); - data.append(FP16x16 { mag: 0, sign: false }); - data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 65536, sign: true }); + data.append(FP16x16 { mag: 196608, sign: true }); + data.append(FP16x16 { mag: 131072, sign: true }); + data.append(FP16x16 { mag: 196608, sign: true }); + data.append(FP16x16 { mag: 65536, sign: false }); data.append(FP16x16 { mag: 131072, sign: false }); data.append(FP16x16 { mag: 196608, sign: true }); + data.append(FP16x16 { mag: 196608, sign: true }); data.append(FP16x16 { mag: 131072, sign: false }); - data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 65536, sign: true }); + data.append(FP16x16 { mag: 65536, sign: true }); data.append(FP16x16 { mag: 65536, sign: false }); - data.append(FP16x16 { mag: 131072, sign: false }); - data.append(FP16x16 { mag: 131072, sign: true }); data.append(FP16x16 { mag: 65536, sign: false }); - data.append(FP16x16 { mag: 131072, sign: true }); data.append(FP16x16 { mag: 65536, sign: true }); - data.append(FP16x16 { mag: 196608, sign: true }); - data.append(FP16x16 { mag: 0, sign: false }); - data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 131072, sign: false }); data.append(FP16x16 { mag: 65536, sign: false }); data.append(FP16x16 { mag: 65536, sign: true }); - data.append(FP16x16 { mag: 131072, sign: true }); - data.append(FP16x16 { mag: 0, sign: false }); - data.append(FP16x16 { mag: 196608, sign: true }); data.append(FP16x16 { mag: 131072, sign: false }); data.append(FP16x16 { mag: 0, sign: false }); - data.append(FP16x16 { mag: 0, sign: false }); - data.append(FP16x16 { mag: 196608, sign: true }); + data.append(FP16x16 { mag: 131072, sign: true }); + data.append(FP16x16 { mag: 65536, sign: true }); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_fp16x16_broadcast/input_1.cairo b/tests/nodes/less_fp16x16_broadcast/input_1.cairo index 743355c3d..9c396d8cc 100644 --- a/tests/nodes/less_fp16x16_broadcast/input_1.cairo +++ b/tests/nodes/less_fp16x16_broadcast/input_1.cairo @@ -1,6 +1,6 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorSub}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; use orion::numbers::{FixedTrait, FP16x16}; fn input_1() -> Tensor { @@ -10,8 +10,8 @@ fn input_1() -> Tensor { shape.append(1); let mut data = ArrayTrait::new(); - data.append(FP16x16 { mag: 65536, sign: false }); data.append(FP16x16 { mag: 131072, sign: false }); - data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 131072, sign: true }); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_fp16x16_broadcast/output_0.cairo b/tests/nodes/less_fp16x16_broadcast/output_0.cairo index 7d4613a88..4d540be9d 100644 --- a/tests/nodes/less_fp16x16_broadcast/output_0.cairo +++ b/tests/nodes/less_fp16x16_broadcast/output_0.cairo @@ -1,8 +1,9 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn output_0() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(3); shape.append(3); @@ -10,31 +11,31 @@ fn output_0() -> Tensor { let mut data = ArrayTrait::new(); data.append(1); - data.append(0); - data.append(0); data.append(1); - data.append(0); - data.append(0); data.append(1); data.append(0); + data.append(1); + data.append(1); data.append(0); + data.append(1); data.append(0); data.append(0); data.append(1); data.append(1); - data.append(1); + data.append(0); data.append(1); data.append(1); data.append(0); data.append(0); data.append(0); - data.append(1); - data.append(1); - data.append(1); - data.append(1); + data.append(0); data.append(0); data.append(0); data.append(0); data.append(1); + data.append(0); + data.append(0); + data.append(0); + data.append(0); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_fp8x23.cairo b/tests/nodes/less_fp8x23.cairo index 6fe7b08b8..5cee9f0a6 100644 --- a/tests/nodes/less_fp8x23.cairo +++ b/tests/nodes/less_fp8x23.cairo @@ -3,22 +3,22 @@ mod input_1; mod output_0; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::FP8x23TensorPartialEq; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorSub}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::U32TensorPartialEq; +use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; +use orion::operators::tensor::FP8x23TensorPartialEq; +use orion::operators::tensor::I32TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; #[test] #[available_gas(2000000000)] fn test_less_fp8x23() { let input_0 = input_0::input_0(); let input_1 = input_1::input_1(); - let z = output_0::output_0(); + let z_0 = output_0::output_0(); - let y = input_0.less(@input_1); + let y_0 = input_0.less(@input_1); - assert_eq(y, z); + assert_eq(y_0, z_0); } diff --git a/tests/nodes/less_fp8x23/input_0.cairo b/tests/nodes/less_fp8x23/input_0.cairo index fbcd9f2a8..8100a6b6c 100644 --- a/tests/nodes/less_fp8x23/input_0.cairo +++ b/tests/nodes/less_fp8x23/input_0.cairo @@ -1,6 +1,6 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorSub}; +use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; use orion::numbers::{FixedTrait, FP8x23}; fn input_0() -> Tensor { @@ -10,32 +10,32 @@ fn input_0() -> Tensor { shape.append(3); let mut data = ArrayTrait::new(); + data.append(FP8x23 { mag: 16777216, sign: true }); data.append(FP8x23 { mag: 25165824, sign: true }); - data.append(FP8x23 { mag: 8388608, sign: true }); + data.append(FP8x23 { mag: 8388608, sign: false }); data.append(FP8x23 { mag: 0, sign: false }); + data.append(FP8x23 { mag: 8388608, sign: true }); data.append(FP8x23 { mag: 8388608, sign: false }); data.append(FP8x23 { mag: 25165824, sign: true }); - data.append(FP8x23 { mag: 16777216, sign: true }); data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 0, sign: false }); - data.append(FP8x23 { mag: 0, sign: false }); - data.append(FP8x23 { mag: 25165824, sign: true }); - data.append(FP8x23 { mag: 8388608, sign: false }); data.append(FP8x23 { mag: 16777216, sign: true }); - data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 25165824, sign: true }); data.append(FP8x23 { mag: 0, sign: false }); data.append(FP8x23 { mag: 8388608, sign: true }); + data.append(FP8x23 { mag: 8388608, sign: true }); + data.append(FP8x23 { mag: 8388608, sign: true }); + data.append(FP8x23 { mag: 8388608, sign: true }); data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: true }); - data.append(FP8x23 { mag: 25165824, sign: true }); - data.append(FP8x23 { mag: 16777216, sign: true }); - data.append(FP8x23 { mag: 16777216, sign: true }); - data.append(FP8x23 { mag: 16777216, sign: true }); + data.append(FP8x23 { mag: 8388608, sign: true }); + data.append(FP8x23 { mag: 8388608, sign: false }); + data.append(FP8x23 { mag: 0, sign: false }); + data.append(FP8x23 { mag: 8388608, sign: true }); + data.append(FP8x23 { mag: 8388608, sign: true }); + data.append(FP8x23 { mag: 8388608, sign: true }); + data.append(FP8x23 { mag: 16777216, sign: false }); + data.append(FP8x23 { mag: 8388608, sign: true }); data.append(FP8x23 { mag: 25165824, sign: true }); + data.append(FP8x23 { mag: 0, sign: false }); + data.append(FP8x23 { mag: 16777216, sign: false }); data.append(FP8x23 { mag: 8388608, sign: false }); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_fp8x23/input_1.cairo b/tests/nodes/less_fp8x23/input_1.cairo index e27ba84da..01c04d7c3 100644 --- a/tests/nodes/less_fp8x23/input_1.cairo +++ b/tests/nodes/less_fp8x23/input_1.cairo @@ -1,6 +1,6 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorSub}; +use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; use orion::numbers::{FixedTrait, FP8x23}; fn input_1() -> Tensor { @@ -10,32 +10,32 @@ fn input_1() -> Tensor { shape.append(3); let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: true }); - data.append(FP8x23 { mag: 8388608, sign: true }); data.append(FP8x23 { mag: 16777216, sign: true }); - data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: false }); + data.append(FP8x23 { mag: 25165824, sign: true }); + data.append(FP8x23 { mag: 25165824, sign: true }); data.append(FP8x23 { mag: 25165824, sign: true }); data.append(FP8x23 { mag: 0, sign: false }); data.append(FP8x23 { mag: 16777216, sign: true }); - data.append(FP8x23 { mag: 0, sign: false }); + data.append(FP8x23 { mag: 8388608, sign: true }); + data.append(FP8x23 { mag: 25165824, sign: true }); data.append(FP8x23 { mag: 0, sign: false }); data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 0, sign: false }); + data.append(FP8x23 { mag: 8388608, sign: false }); data.append(FP8x23 { mag: 8388608, sign: true }); + data.append(FP8x23 { mag: 8388608, sign: false }); data.append(FP8x23 { mag: 0, sign: false }); data.append(FP8x23 { mag: 8388608, sign: true }); data.append(FP8x23 { mag: 0, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: true }); - data.append(FP8x23 { mag: 16777216, sign: false }); data.append(FP8x23 { mag: 25165824, sign: true }); - data.append(FP8x23 { mag: 0, sign: false }); + data.append(FP8x23 { mag: 8388608, sign: false }); + data.append(FP8x23 { mag: 16777216, sign: false }); data.append(FP8x23 { mag: 8388608, sign: false }); data.append(FP8x23 { mag: 8388608, sign: false }); data.append(FP8x23 { mag: 16777216, sign: false }); + data.append(FP8x23 { mag: 16777216, sign: false }); + data.append(FP8x23 { mag: 16777216, sign: false }); + data.append(FP8x23 { mag: 8388608, sign: true }); data.append(FP8x23 { mag: 0, sign: false }); + data.append(FP8x23 { mag: 16777216, sign: false }); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_fp8x23/output_0.cairo b/tests/nodes/less_fp8x23/output_0.cairo index 33906ca90..d926a66e9 100644 --- a/tests/nodes/less_fp8x23/output_0.cairo +++ b/tests/nodes/less_fp8x23/output_0.cairo @@ -1,20 +1,15 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn output_0() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(3); shape.append(3); shape.append(3); let mut data = ArrayTrait::new(); - data.append(1); - data.append(0); - data.append(0); - data.append(0); - data.append(1); - data.append(1); data.append(0); data.append(0); data.append(0); @@ -23,18 +18,24 @@ fn output_0() -> Tensor { data.append(0); data.append(1); data.append(0); - data.append(0); - data.append(0); data.append(1); data.append(1); data.append(1); data.append(0); data.append(1); + data.append(1); + data.append(0); + data.append(1); data.append(0); data.append(1); data.append(1); data.append(1); data.append(1); data.append(0); + data.append(1); + data.append(1); + data.append(0); + data.append(0); + data.append(1); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_fp8x23_broadcast.cairo b/tests/nodes/less_fp8x23_broadcast.cairo index e8b3155c5..65b5079f0 100644 --- a/tests/nodes/less_fp8x23_broadcast.cairo +++ b/tests/nodes/less_fp8x23_broadcast.cairo @@ -3,22 +3,22 @@ mod input_1; mod output_0; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::FP8x23TensorPartialEq; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorSub}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::U32TensorPartialEq; +use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; +use orion::operators::tensor::FP8x23TensorPartialEq; +use orion::operators::tensor::I32TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; #[test] #[available_gas(2000000000)] fn test_less_fp8x23_broadcast() { let input_0 = input_0::input_0(); let input_1 = input_1::input_1(); - let z = output_0::output_0(); + let z_0 = output_0::output_0(); - let y = input_0.less(@input_1); + let y_0 = input_0.less(@input_1); - assert_eq(y, z); + assert_eq(y_0, z_0); } diff --git a/tests/nodes/less_fp8x23_broadcast/input_0.cairo b/tests/nodes/less_fp8x23_broadcast/input_0.cairo index 88ad7277b..86bd47a49 100644 --- a/tests/nodes/less_fp8x23_broadcast/input_0.cairo +++ b/tests/nodes/less_fp8x23_broadcast/input_0.cairo @@ -1,6 +1,6 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorSub}; +use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; use orion::numbers::{FixedTrait, FP8x23}; fn input_0() -> Tensor { @@ -10,32 +10,32 @@ fn input_0() -> Tensor { shape.append(3); let mut data = ArrayTrait::new(); + data.append(FP8x23 { mag: 16777216, sign: true }); + data.append(FP8x23 { mag: 25165824, sign: true }); + data.append(FP8x23 { mag: 25165824, sign: true }); data.append(FP8x23 { mag: 8388608, sign: true }); - data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: false }); data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: false }); + data.append(FP8x23 { mag: 16777216, sign: true }); data.append(FP8x23 { mag: 0, sign: false }); + data.append(FP8x23 { mag: 25165824, sign: true }); data.append(FP8x23 { mag: 16777216, sign: false }); data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: true }); + data.append(FP8x23 { mag: 0, sign: false }); data.append(FP8x23 { mag: 16777216, sign: true }); - data.append(FP8x23 { mag: 25165824, sign: true }); - data.append(FP8x23 { mag: 8388608, sign: true }); data.append(FP8x23 { mag: 16777216, sign: true }); - data.append(FP8x23 { mag: 0, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: false }); data.append(FP8x23 { mag: 8388608, sign: true }); data.append(FP8x23 { mag: 16777216, sign: true }); data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: true }); - data.append(FP8x23 { mag: 8388608, sign: true }); - data.append(FP8x23 { mag: 16777216, sign: true }); data.append(FP8x23 { mag: 25165824, sign: true }); data.append(FP8x23 { mag: 25165824, sign: true }); + data.append(FP8x23 { mag: 16777216, sign: true }); + data.append(FP8x23 { mag: 0, sign: false }); + data.append(FP8x23 { mag: 8388608, sign: true }); + data.append(FP8x23 { mag: 25165824, sign: true }); + data.append(FP8x23 { mag: 8388608, sign: false }); data.append(FP8x23 { mag: 16777216, sign: false }); + data.append(FP8x23 { mag: 8388608, sign: true }); + data.append(FP8x23 { mag: 0, sign: false }); + data.append(FP8x23 { mag: 0, sign: false }); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_fp8x23_broadcast/input_1.cairo b/tests/nodes/less_fp8x23_broadcast/input_1.cairo index 29b68e7c3..fa68c319a 100644 --- a/tests/nodes/less_fp8x23_broadcast/input_1.cairo +++ b/tests/nodes/less_fp8x23_broadcast/input_1.cairo @@ -1,6 +1,6 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorSub}; +use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorAdd}; use orion::numbers::{FixedTrait, FP8x23}; fn input_1() -> Tensor { @@ -10,8 +10,8 @@ fn input_1() -> Tensor { shape.append(1); let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 0, sign: false }); + data.append(FP8x23 { mag: 16777216, sign: false }); + data.append(FP8x23 { mag: 25165824, sign: true }); data.append(FP8x23 { mag: 25165824, sign: true }); - data.append(FP8x23 { mag: 8388608, sign: true }); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_fp8x23_broadcast/output_0.cairo b/tests/nodes/less_fp8x23_broadcast/output_0.cairo index fbf242193..1f24d9fbf 100644 --- a/tests/nodes/less_fp8x23_broadcast/output_0.cairo +++ b/tests/nodes/less_fp8x23_broadcast/output_0.cairo @@ -1,8 +1,9 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn output_0() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(3); shape.append(3); @@ -10,6 +11,8 @@ fn output_0() -> Tensor { let mut data = ArrayTrait::new(); data.append(1); + data.append(1); + data.append(1); data.append(0); data.append(0); data.append(0); @@ -17,24 +20,22 @@ fn output_0() -> Tensor { data.append(0); data.append(0); data.append(0); + data.append(1); + data.append(1); data.append(0); data.append(0); data.append(0); - data.append(1); data.append(0); data.append(0); data.append(0); data.append(1); - data.append(0); - data.append(0); data.append(1); data.append(1); data.append(0); data.append(0); data.append(0); data.append(0); - data.append(1); - data.append(1); + data.append(0); data.append(0); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_i32.cairo b/tests/nodes/less_i32.cairo index 4a251b995..d68e38bc0 100644 --- a/tests/nodes/less_i32.cairo +++ b/tests/nodes/less_i32.cairo @@ -3,22 +3,20 @@ mod input_1; mod output_0; -use orion::operators::tensor::{I32Tensor, I32TensorSub}; -use orion::utils::{assert_eq, assert_seq_eq}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::I32TensorPartialEq; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::U32TensorPartialEq; +use orion::operators::tensor::I32TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; #[test] #[available_gas(2000000000)] fn test_less_i32() { let input_0 = input_0::input_0(); let input_1 = input_1::input_1(); - let z = output_0::output_0(); + let z_0 = output_0::output_0(); - let y = input_0.less(@input_1); + let y_0 = input_0.less(@input_1); - assert_eq(y, z); + assert_eq(y_0, z_0); } diff --git a/tests/nodes/less_i32/input_0.cairo b/tests/nodes/less_i32/input_0.cairo index ab59d73f2..78d199299 100644 --- a/tests/nodes/less_i32/input_0.cairo +++ b/tests/nodes/less_i32/input_0.cairo @@ -1,6 +1,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorSub}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; fn input_0() -> Tensor { let mut shape = ArrayTrait::::new(); @@ -9,32 +10,32 @@ fn input_0() -> Tensor { shape.append(3); let mut data = ArrayTrait::new(); + data.append(1); + data.append(-3); data.append(-1); - data.append(-2); - data.append(2); - data.append(2); + data.append(-3); data.append(2); - data.append(-2); - data.append(1); data.append(1); - data.append(1); - data.append(0); data.append(-2); - data.append(-3); - data.append(-1); - data.append(-1); data.append(-2); + data.append(-1); data.append(2); data.append(-2); - data.append(-1); - data.append(-3); - data.append(0); data.append(0); + data.append(2); data.append(-3); - data.append(-3); + data.append(-1); data.append(-2); - data.append(2); data.append(-3); + data.append(-1); data.append(0); + data.append(-2); + data.append(1); + data.append(-1); + data.append(2); + data.append(1); + data.append(1); + data.append(2); + data.append(-1); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_i32/input_1.cairo b/tests/nodes/less_i32/input_1.cairo index cadacc785..3454aab15 100644 --- a/tests/nodes/less_i32/input_1.cairo +++ b/tests/nodes/less_i32/input_1.cairo @@ -1,6 +1,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorSub}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; fn input_1() -> Tensor { let mut shape = ArrayTrait::::new(); @@ -9,32 +10,32 @@ fn input_1() -> Tensor { shape.append(3); let mut data = ArrayTrait::new(); + data.append(2); data.append(0); - data.append(-1); data.append(0); - data.append(-2); data.append(2); data.append(1); - data.append(-1); data.append(-3); - data.append(-3); - data.append(-2); - data.append(-2); - data.append(2); - data.append(-1); - data.append(-3); - data.append(2); data.append(1); - data.append(-2); + data.append(1); data.append(-1); + data.append(0); + data.append(0); data.append(-2); - data.append(1); - data.append(-3); data.append(-1); + data.append(1); + data.append(2); data.append(0); + data.append(2); + data.append(2); + data.append(0); + data.append(1); data.append(1); data.append(0); data.append(2); + data.append(2); + data.append(-2); + data.append(0); data.append(0); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_i32/output_0.cairo b/tests/nodes/less_i32/output_0.cairo index bff093e8b..8e38fd1fd 100644 --- a/tests/nodes/less_i32/output_0.cairo +++ b/tests/nodes/less_i32/output_0.cairo @@ -1,8 +1,9 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn output_0() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(3); shape.append(3); @@ -11,30 +12,30 @@ fn output_0() -> Tensor { let mut data = ArrayTrait::new(); data.append(1); data.append(1); - data.append(0); - data.append(0); - data.append(0); + data.append(1); data.append(1); data.append(0); data.append(0); - data.append(0); - data.append(0); - data.append(0); + data.append(1); data.append(1); data.append(0); data.append(0); data.append(1); data.append(0); data.append(0); - data.append(0); data.append(1); data.append(1); - data.append(0); data.append(1); data.append(1); data.append(1); data.append(0); data.append(1); data.append(0); + data.append(1); + data.append(0); + data.append(1); + data.append(0); + data.append(0); + data.append(1); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_i32_broadcast.cairo b/tests/nodes/less_i32_broadcast.cairo index 552150976..437596143 100644 --- a/tests/nodes/less_i32_broadcast.cairo +++ b/tests/nodes/less_i32_broadcast.cairo @@ -3,22 +3,20 @@ mod input_1; mod output_0; -use orion::operators::tensor::{I32Tensor, I32TensorSub}; -use orion::utils::{assert_eq, assert_seq_eq}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::I32TensorPartialEq; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::U32TensorPartialEq; +use orion::operators::tensor::I32TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; #[test] #[available_gas(2000000000)] fn test_less_i32_broadcast() { let input_0 = input_0::input_0(); let input_1 = input_1::input_1(); - let z = output_0::output_0(); + let z_0 = output_0::output_0(); - let y = input_0.less(@input_1); + let y_0 = input_0.less(@input_1); - assert_eq(y, z); + assert_eq(y_0, z_0); } diff --git a/tests/nodes/less_i32_broadcast/input_0.cairo b/tests/nodes/less_i32_broadcast/input_0.cairo index e49eaf809..a4eacc274 100644 --- a/tests/nodes/less_i32_broadcast/input_0.cairo +++ b/tests/nodes/less_i32_broadcast/input_0.cairo @@ -1,6 +1,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorSub}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; fn input_0() -> Tensor { let mut shape = ArrayTrait::::new(); @@ -9,32 +10,32 @@ fn input_0() -> Tensor { shape.append(3); let mut data = ArrayTrait::new(); + data.append(-1); + data.append(-1); + data.append(-1); + data.append(1); + data.append(2); data.append(-3); data.append(-2); - data.append(1); data.append(-3); - data.append(2); data.append(-1); data.append(-3); data.append(0); - data.append(2); - data.append(1); + data.append(-3); + data.append(-1); data.append(-1); + data.append(2); data.append(0); - data.append(1); - data.append(1); data.append(0); - data.append(1); data.append(-3); + data.append(-2); data.append(2); - data.append(1); + data.append(-3); + data.append(-3); data.append(2); - data.append(0); - data.append(0); - data.append(0); data.append(-3); data.append(0); + data.append(-3); data.append(2); - data.append(-2); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_i32_broadcast/input_1.cairo b/tests/nodes/less_i32_broadcast/input_1.cairo index 99c50d44f..eaf75c0c9 100644 --- a/tests/nodes/less_i32_broadcast/input_1.cairo +++ b/tests/nodes/less_i32_broadcast/input_1.cairo @@ -1,6 +1,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorSub}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; fn input_1() -> Tensor { let mut shape = ArrayTrait::::new(); @@ -10,7 +11,7 @@ fn input_1() -> Tensor { let mut data = ArrayTrait::new(); data.append(-3); - data.append(0); - data.append(1); + data.append(-3); + data.append(-1); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_i32_broadcast/output_0.cairo b/tests/nodes/less_i32_broadcast/output_0.cairo index 79967537c..ba4559935 100644 --- a/tests/nodes/less_i32_broadcast/output_0.cairo +++ b/tests/nodes/less_i32_broadcast/output_0.cairo @@ -1,8 +1,9 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn output_0() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(3); shape.append(3); @@ -12,9 +13,9 @@ fn output_0() -> Tensor { data.append(0); data.append(0); data.append(0); - data.append(1); data.append(0); - data.append(1); + data.append(0); + data.append(0); data.append(1); data.append(1); data.append(0); @@ -25,6 +26,7 @@ fn output_0() -> Tensor { data.append(0); data.append(0); data.append(0); + data.append(0); data.append(1); data.append(0); data.append(0); @@ -32,9 +34,8 @@ fn output_0() -> Tensor { data.append(0); data.append(0); data.append(0); - data.append(1); - data.append(1); data.append(0); data.append(1); + data.append(0); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_i8.cairo b/tests/nodes/less_i8.cairo index 085a6da35..78f839f5b 100644 --- a/tests/nodes/less_i8.cairo +++ b/tests/nodes/less_i8.cairo @@ -3,22 +3,22 @@ mod input_1; mod output_0; -use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{I8Tensor, I8TensorAdd}; use orion::operators::tensor::I8TensorPartialEq; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{I8Tensor, I8TensorSub}; -use orion::operators::tensor::U32TensorPartialEq; +use orion::operators::tensor::I32TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; #[test] #[available_gas(2000000000)] fn test_less_i8() { let input_0 = input_0::input_0(); let input_1 = input_1::input_1(); - let z = output_0::output_0(); + let z_0 = output_0::output_0(); - let y = input_0.less(@input_1); + let y_0 = input_0.less(@input_1); - assert_eq(y, z); + assert_eq(y_0, z_0); } diff --git a/tests/nodes/less_i8/input_0.cairo b/tests/nodes/less_i8/input_0.cairo index 28dd5a905..1a4e34dba 100644 --- a/tests/nodes/less_i8/input_0.cairo +++ b/tests/nodes/less_i8/input_0.cairo @@ -1,6 +1,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I8Tensor, I8TensorSub}; +use orion::operators::tensor::{I8Tensor, I8TensorAdd}; +use orion::numbers::NumberTrait; fn input_0() -> Tensor { let mut shape = ArrayTrait::::new(); @@ -9,32 +10,32 @@ fn input_0() -> Tensor { shape.append(3); let mut data = ArrayTrait::new(); - data.append(-3); - data.append(0); - data.append(-3); data.append(-2); + data.append(1); + data.append(0); data.append(-1); - data.append(2); - data.append(-1); - data.append(-3); - data.append(-1); - data.append(-3); - data.append(-3); - data.append(-1); - data.append(-1); + data.append(1); + data.append(1); data.append(-2); + data.append(2); data.append(-2); data.append(-3); + data.append(-2); data.append(-1); - data.append(1); data.append(-2); + data.append(-1); + data.append(2); data.append(0); - data.append(-3); + data.append(-1); data.append(2); - data.append(-3); - data.append(-2); data.append(2); + data.append(1); data.append(0); - data.append(0); + data.append(2); + data.append(2); + data.append(-1); + data.append(1); + data.append(-1); + data.append(-3); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_i8/input_1.cairo b/tests/nodes/less_i8/input_1.cairo index 9dc4e7a6c..c9ff24a41 100644 --- a/tests/nodes/less_i8/input_1.cairo +++ b/tests/nodes/less_i8/input_1.cairo @@ -1,6 +1,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I8Tensor, I8TensorSub}; +use orion::operators::tensor::{I8Tensor, I8TensorAdd}; +use orion::numbers::NumberTrait; fn input_1() -> Tensor { let mut shape = ArrayTrait::::new(); @@ -9,32 +10,32 @@ fn input_1() -> Tensor { shape.append(3); let mut data = ArrayTrait::new(); - data.append(-3); + data.append(0); data.append(1); - data.append(-2); - data.append(-3); data.append(2); + data.append(1); + data.append(1); + data.append(1); data.append(-1); - data.append(0); + data.append(1); + data.append(-3); + data.append(-3); + data.append(2); + data.append(-3); + data.append(-2); data.append(-1); data.append(-2); data.append(1); - data.append(0); + data.append(-3); + data.append(2); data.append(2); - data.append(-2); data.append(1); - data.append(-2); data.append(-3); data.append(2); - data.append(0); - data.append(-1); + data.append(1); data.append(0); data.append(0); - data.append(-2); - data.append(2); - data.append(-1); data.append(2); - data.append(0); - data.append(-3); + data.append(-2); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_i8/output_0.cairo b/tests/nodes/less_i8/output_0.cairo index 9398cc8d3..7c87f420d 100644 --- a/tests/nodes/less_i8/output_0.cairo +++ b/tests/nodes/less_i8/output_0.cairo @@ -1,40 +1,41 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn output_0() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(3); shape.append(3); shape.append(3); let mut data = ArrayTrait::new(); + data.append(1); data.append(0); data.append(1); data.append(1); data.append(0); - data.append(1); data.append(0); data.append(1); - data.append(1); data.append(0); - data.append(1); - data.append(1); - data.append(1); + data.append(0); data.append(0); data.append(1); data.append(0); data.append(0); - data.append(1); data.append(0); - data.append(1); data.append(0); data.append(1); data.append(0); - data.append(1); - data.append(1); data.append(0); data.append(0); data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(1); + data.append(0); + data.append(1); + data.append(1); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_i8_broadcast.cairo b/tests/nodes/less_i8_broadcast.cairo index fb705a81d..f44a3f78b 100644 --- a/tests/nodes/less_i8_broadcast.cairo +++ b/tests/nodes/less_i8_broadcast.cairo @@ -3,22 +3,22 @@ mod input_1; mod output_0; -use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{I8Tensor, I8TensorAdd}; use orion::operators::tensor::I8TensorPartialEq; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{I8Tensor, I8TensorSub}; -use orion::operators::tensor::U32TensorPartialEq; +use orion::operators::tensor::I32TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; #[test] #[available_gas(2000000000)] fn test_less_i8_broadcast() { let input_0 = input_0::input_0(); let input_1 = input_1::input_1(); - let z = output_0::output_0(); + let z_0 = output_0::output_0(); - let y = input_0.less(@input_1); + let y_0 = input_0.less(@input_1); - assert_eq(y, z); + assert_eq(y_0, z_0); } diff --git a/tests/nodes/less_i8_broadcast/input_0.cairo b/tests/nodes/less_i8_broadcast/input_0.cairo index eac6c02fd..7bac81f85 100644 --- a/tests/nodes/less_i8_broadcast/input_0.cairo +++ b/tests/nodes/less_i8_broadcast/input_0.cairo @@ -1,6 +1,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I8Tensor, I8TensorSub}; +use orion::operators::tensor::{I8Tensor, I8TensorAdd}; +use orion::numbers::NumberTrait; fn input_0() -> Tensor { let mut shape = ArrayTrait::::new(); @@ -9,32 +10,32 @@ fn input_0() -> Tensor { shape.append(3); let mut data = ArrayTrait::new(); - data.append(-2); - data.append(-2); + data.append(2); data.append(1); + data.append(-3); data.append(1); - data.append(0); - data.append(0); data.append(-1); - data.append(-3); - data.append(0); + data.append(-1); data.append(2); - data.append(-3); - data.append(1); - data.append(1); data.append(2); - data.append(-3); data.append(2); - data.append(-3); data.append(2); - data.append(1); - data.append(0); - data.append(-1); data.append(0); data.append(-1); + data.append(-3); data.append(1); - data.append(0); + data.append(-1); + data.append(-3); + data.append(-1); data.append(-2); data.append(2); + data.append(0); + data.append(1); + data.append(1); + data.append(2); + data.append(-1); + data.append(2); + data.append(-2); + data.append(-1); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_i8_broadcast/input_1.cairo b/tests/nodes/less_i8_broadcast/input_1.cairo index d593d06e4..484627d12 100644 --- a/tests/nodes/less_i8_broadcast/input_1.cairo +++ b/tests/nodes/less_i8_broadcast/input_1.cairo @@ -1,6 +1,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I8Tensor, I8TensorSub}; +use orion::operators::tensor::{I8Tensor, I8TensorAdd}; +use orion::numbers::NumberTrait; fn input_1() -> Tensor { let mut shape = ArrayTrait::::new(); @@ -9,8 +10,8 @@ fn input_1() -> Tensor { shape.append(1); let mut data = ArrayTrait::new(); + data.append(-2); data.append(-1); data.append(-2); - data.append(-3); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_i8_broadcast/output_0.cairo b/tests/nodes/less_i8_broadcast/output_0.cairo index f68e15ea8..aeda2f157 100644 --- a/tests/nodes/less_i8_broadcast/output_0.cairo +++ b/tests/nodes/less_i8_broadcast/output_0.cairo @@ -1,31 +1,32 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn output_0() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(3); shape.append(3); shape.append(3); let mut data = ArrayTrait::new(); - data.append(1); - data.append(1); data.append(0); data.append(0); + data.append(1); data.append(0); data.append(0); data.append(0); data.append(0); data.append(0); data.append(0); - data.append(1); data.append(0); data.append(0); data.append(0); data.append(1); data.append(0); data.append(0); + data.append(1); + data.append(0); data.append(0); data.append(0); data.append(0); diff --git a/tests/nodes/less_u32.cairo b/tests/nodes/less_u32.cairo index 412895527..a48774701 100644 --- a/tests/nodes/less_u32.cairo +++ b/tests/nodes/less_u32.cairo @@ -3,20 +3,22 @@ mod input_1; mod output_0; -use orion::utils::{assert_eq, assert_seq_eq}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; -use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; use orion::operators::tensor::U32TensorPartialEq; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::I32TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; #[test] #[available_gas(2000000000)] fn test_less_u32() { let input_0 = input_0::input_0(); let input_1 = input_1::input_1(); - let z = output_0::output_0(); + let z_0 = output_0::output_0(); - let y = input_0.less(@input_1); + let y_0 = input_0.less(@input_1); - assert_eq(y, z); + assert_eq(y_0, z_0); } diff --git a/tests/nodes/less_u32/input_0.cairo b/tests/nodes/less_u32/input_0.cairo index 15b2924f3..d75275db5 100644 --- a/tests/nodes/less_u32/input_0.cairo +++ b/tests/nodes/less_u32/input_0.cairo @@ -1,6 +1,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::numbers::NumberTrait; fn input_0() -> Tensor { let mut shape = ArrayTrait::::new(); @@ -9,32 +10,32 @@ fn input_0() -> Tensor { shape.append(3); let mut data = ArrayTrait::new(); - data.append(0); - data.append(2); - data.append(0); + data.append(3); + data.append(3); data.append(4); - data.append(5); + data.append(1); + data.append(1); + data.append(1); data.append(0); data.append(4); - data.append(4); data.append(1); + data.append(4); + data.append(4); data.append(5); + data.append(4); + data.append(1); + data.append(2); data.append(3); data.append(3); - data.append(2); - data.append(5); - data.append(5); data.append(4); data.append(1); + data.append(5); data.append(1); + data.append(1); + data.append(5); data.append(4); - data.append(4); - data.append(2); - data.append(2); + data.append(1); data.append(2); - data.append(4); - data.append(4); data.append(3); - data.append(5); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_u32/input_1.cairo b/tests/nodes/less_u32/input_1.cairo index e540f7f40..65cf93685 100644 --- a/tests/nodes/less_u32/input_1.cairo +++ b/tests/nodes/less_u32/input_1.cairo @@ -1,6 +1,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::numbers::NumberTrait; fn input_1() -> Tensor { let mut shape = ArrayTrait::::new(); @@ -9,32 +10,32 @@ fn input_1() -> Tensor { shape.append(3); let mut data = ArrayTrait::new(); - data.append(0); data.append(1); + data.append(0); + data.append(2); data.append(5); data.append(5); data.append(2); - data.append(1); - data.append(1); data.append(2); - data.append(1); - data.append(3); - data.append(3); - data.append(0); - data.append(5); data.append(2); + data.append(5); + data.append(4); + data.append(5); data.append(0); + data.append(3); + data.append(1); data.append(0); data.append(0); - data.append(4); - data.append(1); + data.append(2); + data.append(2); data.append(1); - data.append(5); - data.append(4); + data.append(0); data.append(4); - data.append(2); + data.append(0); + data.append(3); + data.append(0); + data.append(0); data.append(3); - data.append(2); data.append(5); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_u32/output_0.cairo b/tests/nodes/less_u32/output_0.cairo index 75a278131..44d3797af 100644 --- a/tests/nodes/less_u32/output_0.cairo +++ b/tests/nodes/less_u32/output_0.cairo @@ -1,8 +1,9 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn output_0() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(3); shape.append(3); @@ -11,30 +12,30 @@ fn output_0() -> Tensor { let mut data = ArrayTrait::new(); data.append(0); data.append(0); + data.append(0); + data.append(1); data.append(1); data.append(1); - data.append(0); data.append(1); data.append(0); + data.append(1); data.append(0); + data.append(1); data.append(0); data.append(0); data.append(0); data.append(0); - data.append(1); - data.append(0); data.append(0); data.append(0); data.append(0); - data.append(1); data.append(0); data.append(0); data.append(1); - data.append(1); - data.append(1); data.append(0); data.append(0); data.append(0); data.append(0); + data.append(1); + data.append(1); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_u32_broadcast.cairo b/tests/nodes/less_u32_broadcast.cairo index 9a7ac7a22..215eb22d0 100644 --- a/tests/nodes/less_u32_broadcast.cairo +++ b/tests/nodes/less_u32_broadcast.cairo @@ -3,20 +3,22 @@ mod input_1; mod output_0; -use orion::utils::{assert_eq, assert_seq_eq}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; -use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; use orion::operators::tensor::U32TensorPartialEq; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::I32TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; #[test] #[available_gas(2000000000)] fn test_less_u32_broadcast() { let input_0 = input_0::input_0(); let input_1 = input_1::input_1(); - let z = output_0::output_0(); + let z_0 = output_0::output_0(); - let y = input_0.less(@input_1); + let y_0 = input_0.less(@input_1); - assert_eq(y, z); + assert_eq(y_0, z_0); } diff --git a/tests/nodes/less_u32_broadcast/input_0.cairo b/tests/nodes/less_u32_broadcast/input_0.cairo index 655814fc8..738e0e9a7 100644 --- a/tests/nodes/less_u32_broadcast/input_0.cairo +++ b/tests/nodes/less_u32_broadcast/input_0.cairo @@ -1,6 +1,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::numbers::NumberTrait; fn input_0() -> Tensor { let mut shape = ArrayTrait::::new(); @@ -9,32 +10,32 @@ fn input_0() -> Tensor { shape.append(3); let mut data = ArrayTrait::new(); + data.append(2); + data.append(2); + data.append(2); + data.append(0); data.append(5); data.append(5); - data.append(3); - data.append(4); - data.append(4); + data.append(1); data.append(5); - data.append(3); - data.append(0); data.append(5); - data.append(3); + data.append(2); + data.append(4); + data.append(4); data.append(3); data.append(0); data.append(4); - data.append(1); - data.append(5); - data.append(0); data.append(2); + data.append(1); + data.append(3); + data.append(1); data.append(2); + data.append(3); data.append(1); data.append(3); - data.append(5); - data.append(5); - data.append(5); data.append(4); - data.append(5); - data.append(5); data.append(2); + data.append(3); + data.append(5); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_u32_broadcast/input_1.cairo b/tests/nodes/less_u32_broadcast/input_1.cairo index bcb20d101..ddd3e1af4 100644 --- a/tests/nodes/less_u32_broadcast/input_1.cairo +++ b/tests/nodes/less_u32_broadcast/input_1.cairo @@ -1,6 +1,7 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::numbers::NumberTrait; fn input_1() -> Tensor { let mut shape = ArrayTrait::::new(); @@ -9,8 +10,8 @@ fn input_1() -> Tensor { shape.append(1); let mut data = ArrayTrait::new(); - data.append(3); - data.append(0); data.append(0); + data.append(4); + data.append(5); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/less_u32_broadcast/output_0.cairo b/tests/nodes/less_u32_broadcast/output_0.cairo index ad7acc0af..2496ad222 100644 --- a/tests/nodes/less_u32_broadcast/output_0.cairo +++ b/tests/nodes/less_u32_broadcast/output_0.cairo @@ -1,8 +1,9 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn output_0() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(3); shape.append(3); @@ -12,12 +13,7 @@ fn output_0() -> Tensor { data.append(0); data.append(0); data.append(0); - data.append(0); - data.append(0); - data.append(0); - data.append(0); - data.append(0); - data.append(0); + data.append(1); data.append(0); data.append(0); data.append(1); @@ -26,15 +22,20 @@ fn output_0() -> Tensor { data.append(0); data.append(0); data.append(0); - data.append(0); + data.append(1); data.append(1); data.append(0); + data.append(1); + data.append(1); + data.append(1); data.append(0); data.append(0); data.append(0); + data.append(1); + data.append(1); data.append(0); - data.append(0); - data.append(0); + data.append(1); + data.append(1); data.append(0); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/maxpool_1d.cairo b/tests/nodes/maxpool_1d.cairo new file mode 100644 index 000000000..e9ef475f8 --- /dev/null +++ b/tests/nodes/maxpool_1d.cairo @@ -0,0 +1,30 @@ +mod input_0; +mod output_0; + + +use orion::operators::nn::NNTrait; +use orion::numbers::FixedTrait; +use orion::operators::tensor::FP16x16TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::nn::FP16x16NN; + +#[test] +#[available_gas(2000000000)] +fn test_maxpool_1d() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let (y_0, _) = NNTrait::max_pool( + @input_0, + Option::None, + Option::None, + Option::None, + array![2].span(), + Option::None, + Option::None, + Option::Some(array![2].span()), + 1 + ); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/maxpool_1d/input_0.cairo b/tests/nodes/maxpool_1d/input_0.cairo new file mode 100644 index 000000000..3e92bf1d2 --- /dev/null +++ b/tests/nodes/maxpool_1d/input_0.cairo @@ -0,0 +1,110 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(3); + shape.append(32); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 61884, sign: true }); + data.append(FP16x16 { mag: 66202, sign: true }); + data.append(FP16x16 { mag: 63102, sign: false }); + data.append(FP16x16 { mag: 70834, sign: false }); + data.append(FP16x16 { mag: 84277, sign: true }); + data.append(FP16x16 { mag: 15414, sign: true }); + data.append(FP16x16 { mag: 69938, sign: true }); + data.append(FP16x16 { mag: 63283, sign: true }); + data.append(FP16x16 { mag: 43864, sign: false }); + data.append(FP16x16 { mag: 80777, sign: false }); + data.append(FP16x16 { mag: 62331, sign: false }); + data.append(FP16x16 { mag: 67865, sign: true }); + data.append(FP16x16 { mag: 24630, sign: true }); + data.append(FP16x16 { mag: 36245, sign: false }); + data.append(FP16x16 { mag: 134644, sign: true }); + data.append(FP16x16 { mag: 43793, sign: false }); + data.append(FP16x16 { mag: 86411, sign: false }); + data.append(FP16x16 { mag: 86146, sign: true }); + data.append(FP16x16 { mag: 16382, sign: true }); + data.append(FP16x16 { mag: 146017, sign: false }); + data.append(FP16x16 { mag: 7647, sign: true }); + data.append(FP16x16 { mag: 45163, sign: true }); + data.append(FP16x16 { mag: 104406, sign: false }); + data.append(FP16x16 { mag: 45462, sign: false }); + data.append(FP16x16 { mag: 86222, sign: false }); + data.append(FP16x16 { mag: 9912, sign: true }); + data.append(FP16x16 { mag: 22960, sign: true }); + data.append(FP16x16 { mag: 55123, sign: true }); + data.append(FP16x16 { mag: 124655, sign: true }); + data.append(FP16x16 { mag: 31465, sign: false }); + data.append(FP16x16 { mag: 61922, sign: false }); + data.append(FP16x16 { mag: 163238, sign: true }); + data.append(FP16x16 { mag: 34228, sign: true }); + data.append(FP16x16 { mag: 4475, sign: false }); + data.append(FP16x16 { mag: 56673, sign: true }); + data.append(FP16x16 { mag: 90552, sign: true }); + data.append(FP16x16 { mag: 66213, sign: false }); + data.append(FP16x16 { mag: 214831, sign: true }); + data.append(FP16x16 { mag: 77997, sign: true }); + data.append(FP16x16 { mag: 704, sign: true }); + data.append(FP16x16 { mag: 33211, sign: true }); + data.append(FP16x16 { mag: 12139, sign: true }); + data.append(FP16x16 { mag: 18185, sign: false }); + data.append(FP16x16 { mag: 90981, sign: true }); + data.append(FP16x16 { mag: 37230, sign: false }); + data.append(FP16x16 { mag: 15860, sign: true }); + data.append(FP16x16 { mag: 38407, sign: true }); + data.append(FP16x16 { mag: 16248, sign: false }); + data.append(FP16x16 { mag: 109129, sign: false }); + data.append(FP16x16 { mag: 52730, sign: true }); + data.append(FP16x16 { mag: 48858, sign: false }); + data.append(FP16x16 { mag: 72554, sign: false }); + data.append(FP16x16 { mag: 89600, sign: false }); + data.append(FP16x16 { mag: 61833, sign: true }); + data.append(FP16x16 { mag: 9863, sign: false }); + data.append(FP16x16 { mag: 2754, sign: false }); + data.append(FP16x16 { mag: 85035, sign: false }); + data.append(FP16x16 { mag: 47440, sign: true }); + data.append(FP16x16 { mag: 176235, sign: false }); + data.append(FP16x16 { mag: 77741, sign: false }); + data.append(FP16x16 { mag: 18683, sign: true }); + data.append(FP16x16 { mag: 8069, sign: true }); + data.append(FP16x16 { mag: 30891, sign: true }); + data.append(FP16x16 { mag: 26682, sign: true }); + data.append(FP16x16 { mag: 32658, sign: true }); + data.append(FP16x16 { mag: 1956, sign: true }); + data.append(FP16x16 { mag: 96803, sign: false }); + data.append(FP16x16 { mag: 61321, sign: false }); + data.append(FP16x16 { mag: 33065, sign: true }); + data.append(FP16x16 { mag: 59893, sign: false }); + data.append(FP16x16 { mag: 157662, sign: false }); + data.append(FP16x16 { mag: 52334, sign: true }); + data.append(FP16x16 { mag: 46043, sign: true }); + data.append(FP16x16 { mag: 152484, sign: false }); + data.append(FP16x16 { mag: 27460, sign: false }); + data.append(FP16x16 { mag: 1553, sign: false }); + data.append(FP16x16 { mag: 29415, sign: true }); + data.append(FP16x16 { mag: 26375, sign: false }); + data.append(FP16x16 { mag: 21889, sign: false }); + data.append(FP16x16 { mag: 80932, sign: true }); + data.append(FP16x16 { mag: 2233, sign: false }); + data.append(FP16x16 { mag: 42479, sign: false }); + data.append(FP16x16 { mag: 1156, sign: false }); + data.append(FP16x16 { mag: 158107, sign: false }); + data.append(FP16x16 { mag: 34271, sign: false }); + data.append(FP16x16 { mag: 86694, sign: true }); + data.append(FP16x16 { mag: 89544, sign: true }); + data.append(FP16x16 { mag: 29105, sign: true }); + data.append(FP16x16 { mag: 21337, sign: false }); + data.append(FP16x16 { mag: 12441, sign: true }); + data.append(FP16x16 { mag: 24034, sign: true }); + data.append(FP16x16 { mag: 24040, sign: true }); + data.append(FP16x16 { mag: 73971, sign: true }); + data.append(FP16x16 { mag: 700, sign: false }); + data.append(FP16x16 { mag: 99358, sign: true }); + data.append(FP16x16 { mag: 109591, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/maxpool_1d/output_0.cairo b/tests/nodes/maxpool_1d/output_0.cairo new file mode 100644 index 000000000..97ac3b8de --- /dev/null +++ b/tests/nodes/maxpool_1d/output_0.cairo @@ -0,0 +1,62 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(3); + shape.append(16); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 61884, sign: true }); + data.append(FP16x16 { mag: 70834, sign: false }); + data.append(FP16x16 { mag: 15414, sign: true }); + data.append(FP16x16 { mag: 63283, sign: true }); + data.append(FP16x16 { mag: 80777, sign: false }); + data.append(FP16x16 { mag: 62331, sign: false }); + data.append(FP16x16 { mag: 36245, sign: false }); + data.append(FP16x16 { mag: 43793, sign: false }); + data.append(FP16x16 { mag: 86411, sign: false }); + data.append(FP16x16 { mag: 146017, sign: false }); + data.append(FP16x16 { mag: 7647, sign: true }); + data.append(FP16x16 { mag: 104406, sign: false }); + data.append(FP16x16 { mag: 86222, sign: false }); + data.append(FP16x16 { mag: 22960, sign: true }); + data.append(FP16x16 { mag: 31465, sign: false }); + data.append(FP16x16 { mag: 61922, sign: false }); + data.append(FP16x16 { mag: 4475, sign: false }); + data.append(FP16x16 { mag: 56673, sign: true }); + data.append(FP16x16 { mag: 66213, sign: false }); + data.append(FP16x16 { mag: 704, sign: true }); + data.append(FP16x16 { mag: 12139, sign: true }); + data.append(FP16x16 { mag: 18185, sign: false }); + data.append(FP16x16 { mag: 37230, sign: false }); + data.append(FP16x16 { mag: 16248, sign: false }); + data.append(FP16x16 { mag: 109129, sign: false }); + data.append(FP16x16 { mag: 72554, sign: false }); + data.append(FP16x16 { mag: 89600, sign: false }); + data.append(FP16x16 { mag: 9863, sign: false }); + data.append(FP16x16 { mag: 85035, sign: false }); + data.append(FP16x16 { mag: 176235, sign: false }); + data.append(FP16x16 { mag: 8069, sign: true }); + data.append(FP16x16 { mag: 26682, sign: true }); + data.append(FP16x16 { mag: 1956, sign: true }); + data.append(FP16x16 { mag: 96803, sign: false }); + data.append(FP16x16 { mag: 59893, sign: false }); + data.append(FP16x16 { mag: 157662, sign: false }); + data.append(FP16x16 { mag: 152484, sign: false }); + data.append(FP16x16 { mag: 27460, sign: false }); + data.append(FP16x16 { mag: 26375, sign: false }); + data.append(FP16x16 { mag: 21889, sign: false }); + data.append(FP16x16 { mag: 42479, sign: false }); + data.append(FP16x16 { mag: 158107, sign: false }); + data.append(FP16x16 { mag: 34271, sign: false }); + data.append(FP16x16 { mag: 29105, sign: true }); + data.append(FP16x16 { mag: 21337, sign: false }); + data.append(FP16x16 { mag: 24034, sign: true }); + data.append(FP16x16 { mag: 700, sign: false }); + data.append(FP16x16 { mag: 109591, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/maxpool_1d_default.cairo b/tests/nodes/maxpool_1d_default.cairo new file mode 100644 index 000000000..d036694fa --- /dev/null +++ b/tests/nodes/maxpool_1d_default.cairo @@ -0,0 +1,31 @@ +mod input_0; +mod output_0; + + +use orion::operators::nn::NNTrait; +use orion::numbers::FixedTrait; +use orion::operators::tensor::FP16x16TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::nn::FP16x16NN; + +#[test] +#[available_gas(2000000000)] +fn test_maxpool_1d_default() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let (y_0, _) = NNTrait::max_pool( + @input_0, + Option::None, + Option::None, + Option::None, + array![2].span(), + Option::None, + Option::None, + Option::None, + 1 + ); + + assert_eq(y_0, z_0); +} + diff --git a/tests/nodes/maxpool_1d_default/input_0.cairo b/tests/nodes/maxpool_1d_default/input_0.cairo new file mode 100644 index 000000000..f9522826d --- /dev/null +++ b/tests/nodes/maxpool_1d_default/input_0.cairo @@ -0,0 +1,110 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(3); + shape.append(32); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 50224, sign: true }); + data.append(FP16x16 { mag: 2534, sign: false }); + data.append(FP16x16 { mag: 1978, sign: false }); + data.append(FP16x16 { mag: 53529, sign: false }); + data.append(FP16x16 { mag: 171944, sign: true }); + data.append(FP16x16 { mag: 47778, sign: false }); + data.append(FP16x16 { mag: 85540, sign: true }); + data.append(FP16x16 { mag: 3998, sign: false }); + data.append(FP16x16 { mag: 5615, sign: false }); + data.append(FP16x16 { mag: 1394, sign: true }); + data.append(FP16x16 { mag: 74940, sign: false }); + data.append(FP16x16 { mag: 32499, sign: false }); + data.append(FP16x16 { mag: 13610, sign: false }); + data.append(FP16x16 { mag: 147171, sign: false }); + data.append(FP16x16 { mag: 4356, sign: true }); + data.append(FP16x16 { mag: 90349, sign: true }); + data.append(FP16x16 { mag: 96528, sign: false }); + data.append(FP16x16 { mag: 108927, sign: true }); + data.append(FP16x16 { mag: 10457, sign: true }); + data.append(FP16x16 { mag: 2548, sign: false }); + data.append(FP16x16 { mag: 48359, sign: false }); + data.append(FP16x16 { mag: 25137, sign: false }); + data.append(FP16x16 { mag: 31065, sign: false }); + data.append(FP16x16 { mag: 83420, sign: false }); + data.append(FP16x16 { mag: 58282, sign: false }); + data.append(FP16x16 { mag: 71330, sign: false }); + data.append(FP16x16 { mag: 14944, sign: false }); + data.append(FP16x16 { mag: 95778, sign: true }); + data.append(FP16x16 { mag: 52231, sign: true }); + data.append(FP16x16 { mag: 1629, sign: false }); + data.append(FP16x16 { mag: 86604, sign: false }); + data.append(FP16x16 { mag: 24073, sign: false }); + data.append(FP16x16 { mag: 54993, sign: true }); + data.append(FP16x16 { mag: 87393, sign: true }); + data.append(FP16x16 { mag: 83491, sign: true }); + data.append(FP16x16 { mag: 11108, sign: false }); + data.append(FP16x16 { mag: 118783, sign: true }); + data.append(FP16x16 { mag: 119405, sign: true }); + data.append(FP16x16 { mag: 66301, sign: false }); + data.append(FP16x16 { mag: 128037, sign: false }); + data.append(FP16x16 { mag: 2385, sign: true }); + data.append(FP16x16 { mag: 31954, sign: true }); + data.append(FP16x16 { mag: 30235, sign: false }); + data.append(FP16x16 { mag: 34919, sign: false }); + data.append(FP16x16 { mag: 69026, sign: false }); + data.append(FP16x16 { mag: 25820, sign: true }); + data.append(FP16x16 { mag: 80142, sign: false }); + data.append(FP16x16 { mag: 71641, sign: false }); + data.append(FP16x16 { mag: 72810, sign: true }); + data.append(FP16x16 { mag: 23490, sign: false }); + data.append(FP16x16 { mag: 17323, sign: true }); + data.append(FP16x16 { mag: 24532, sign: true }); + data.append(FP16x16 { mag: 66044, sign: false }); + data.append(FP16x16 { mag: 44213, sign: true }); + data.append(FP16x16 { mag: 8164, sign: true }); + data.append(FP16x16 { mag: 32326, sign: false }); + data.append(FP16x16 { mag: 43120, sign: true }); + data.append(FP16x16 { mag: 181, sign: true }); + data.append(FP16x16 { mag: 18666, sign: true }); + data.append(FP16x16 { mag: 8560, sign: true }); + data.append(FP16x16 { mag: 15235, sign: true }); + data.append(FP16x16 { mag: 25524, sign: false }); + data.append(FP16x16 { mag: 97926, sign: true }); + data.append(FP16x16 { mag: 83401, sign: true }); + data.append(FP16x16 { mag: 10862, sign: false }); + data.append(FP16x16 { mag: 13170, sign: true }); + data.append(FP16x16 { mag: 14320, sign: false }); + data.append(FP16x16 { mag: 82805, sign: false }); + data.append(FP16x16 { mag: 11320, sign: false }); + data.append(FP16x16 { mag: 36914, sign: false }); + data.append(FP16x16 { mag: 476, sign: false }); + data.append(FP16x16 { mag: 26739, sign: true }); + data.append(FP16x16 { mag: 27204, sign: false }); + data.append(FP16x16 { mag: 135386, sign: true }); + data.append(FP16x16 { mag: 179608, sign: false }); + data.append(FP16x16 { mag: 38394, sign: true }); + data.append(FP16x16 { mag: 124283, sign: false }); + data.append(FP16x16 { mag: 17926, sign: false }); + data.append(FP16x16 { mag: 199614, sign: false }); + data.append(FP16x16 { mag: 21143, sign: false }); + data.append(FP16x16 { mag: 58284, sign: false }); + data.append(FP16x16 { mag: 44246, sign: true }); + data.append(FP16x16 { mag: 58693, sign: false }); + data.append(FP16x16 { mag: 39360, sign: false }); + data.append(FP16x16 { mag: 79614, sign: true }); + data.append(FP16x16 { mag: 36430, sign: false }); + data.append(FP16x16 { mag: 19447, sign: true }); + data.append(FP16x16 { mag: 10755, sign: false }); + data.append(FP16x16 { mag: 3572, sign: true }); + data.append(FP16x16 { mag: 23011, sign: true }); + data.append(FP16x16 { mag: 12359, sign: false }); + data.append(FP16x16 { mag: 33072, sign: true }); + data.append(FP16x16 { mag: 80505, sign: true }); + data.append(FP16x16 { mag: 25351, sign: false }); + data.append(FP16x16 { mag: 84321, sign: true }); + data.append(FP16x16 { mag: 39865, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/maxpool_1d_default/output_0.cairo b/tests/nodes/maxpool_1d_default/output_0.cairo new file mode 100644 index 000000000..94eee9956 --- /dev/null +++ b/tests/nodes/maxpool_1d_default/output_0.cairo @@ -0,0 +1,107 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(3); + shape.append(31); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 2534, sign: false }); + data.append(FP16x16 { mag: 2534, sign: false }); + data.append(FP16x16 { mag: 53529, sign: false }); + data.append(FP16x16 { mag: 53529, sign: false }); + data.append(FP16x16 { mag: 47778, sign: false }); + data.append(FP16x16 { mag: 47778, sign: false }); + data.append(FP16x16 { mag: 3998, sign: false }); + data.append(FP16x16 { mag: 5615, sign: false }); + data.append(FP16x16 { mag: 5615, sign: false }); + data.append(FP16x16 { mag: 74940, sign: false }); + data.append(FP16x16 { mag: 74940, sign: false }); + data.append(FP16x16 { mag: 32499, sign: false }); + data.append(FP16x16 { mag: 147171, sign: false }); + data.append(FP16x16 { mag: 147171, sign: false }); + data.append(FP16x16 { mag: 4356, sign: true }); + data.append(FP16x16 { mag: 96528, sign: false }); + data.append(FP16x16 { mag: 96528, sign: false }); + data.append(FP16x16 { mag: 10457, sign: true }); + data.append(FP16x16 { mag: 2548, sign: false }); + data.append(FP16x16 { mag: 48359, sign: false }); + data.append(FP16x16 { mag: 48359, sign: false }); + data.append(FP16x16 { mag: 31065, sign: false }); + data.append(FP16x16 { mag: 83420, sign: false }); + data.append(FP16x16 { mag: 83420, sign: false }); + data.append(FP16x16 { mag: 71330, sign: false }); + data.append(FP16x16 { mag: 71330, sign: false }); + data.append(FP16x16 { mag: 14944, sign: false }); + data.append(FP16x16 { mag: 52231, sign: true }); + data.append(FP16x16 { mag: 1629, sign: false }); + data.append(FP16x16 { mag: 86604, sign: false }); + data.append(FP16x16 { mag: 86604, sign: false }); + data.append(FP16x16 { mag: 54993, sign: true }); + data.append(FP16x16 { mag: 83491, sign: true }); + data.append(FP16x16 { mag: 11108, sign: false }); + data.append(FP16x16 { mag: 11108, sign: false }); + data.append(FP16x16 { mag: 118783, sign: true }); + data.append(FP16x16 { mag: 66301, sign: false }); + data.append(FP16x16 { mag: 128037, sign: false }); + data.append(FP16x16 { mag: 128037, sign: false }); + data.append(FP16x16 { mag: 2385, sign: true }); + data.append(FP16x16 { mag: 30235, sign: false }); + data.append(FP16x16 { mag: 34919, sign: false }); + data.append(FP16x16 { mag: 69026, sign: false }); + data.append(FP16x16 { mag: 69026, sign: false }); + data.append(FP16x16 { mag: 80142, sign: false }); + data.append(FP16x16 { mag: 80142, sign: false }); + data.append(FP16x16 { mag: 71641, sign: false }); + data.append(FP16x16 { mag: 23490, sign: false }); + data.append(FP16x16 { mag: 23490, sign: false }); + data.append(FP16x16 { mag: 17323, sign: true }); + data.append(FP16x16 { mag: 66044, sign: false }); + data.append(FP16x16 { mag: 66044, sign: false }); + data.append(FP16x16 { mag: 8164, sign: true }); + data.append(FP16x16 { mag: 32326, sign: false }); + data.append(FP16x16 { mag: 32326, sign: false }); + data.append(FP16x16 { mag: 181, sign: true }); + data.append(FP16x16 { mag: 181, sign: true }); + data.append(FP16x16 { mag: 8560, sign: true }); + data.append(FP16x16 { mag: 8560, sign: true }); + data.append(FP16x16 { mag: 25524, sign: false }); + data.append(FP16x16 { mag: 25524, sign: false }); + data.append(FP16x16 { mag: 83401, sign: true }); + data.append(FP16x16 { mag: 10862, sign: false }); + data.append(FP16x16 { mag: 14320, sign: false }); + data.append(FP16x16 { mag: 82805, sign: false }); + data.append(FP16x16 { mag: 82805, sign: false }); + data.append(FP16x16 { mag: 36914, sign: false }); + data.append(FP16x16 { mag: 36914, sign: false }); + data.append(FP16x16 { mag: 476, sign: false }); + data.append(FP16x16 { mag: 27204, sign: false }); + data.append(FP16x16 { mag: 27204, sign: false }); + data.append(FP16x16 { mag: 179608, sign: false }); + data.append(FP16x16 { mag: 179608, sign: false }); + data.append(FP16x16 { mag: 124283, sign: false }); + data.append(FP16x16 { mag: 124283, sign: false }); + data.append(FP16x16 { mag: 199614, sign: false }); + data.append(FP16x16 { mag: 199614, sign: false }); + data.append(FP16x16 { mag: 58284, sign: false }); + data.append(FP16x16 { mag: 58284, sign: false }); + data.append(FP16x16 { mag: 58693, sign: false }); + data.append(FP16x16 { mag: 58693, sign: false }); + data.append(FP16x16 { mag: 39360, sign: false }); + data.append(FP16x16 { mag: 36430, sign: false }); + data.append(FP16x16 { mag: 36430, sign: false }); + data.append(FP16x16 { mag: 10755, sign: false }); + data.append(FP16x16 { mag: 10755, sign: false }); + data.append(FP16x16 { mag: 3572, sign: true }); + data.append(FP16x16 { mag: 12359, sign: false }); + data.append(FP16x16 { mag: 12359, sign: false }); + data.append(FP16x16 { mag: 33072, sign: true }); + data.append(FP16x16 { mag: 25351, sign: false }); + data.append(FP16x16 { mag: 25351, sign: false }); + data.append(FP16x16 { mag: 39865, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/maxpool_2d.cairo b/tests/nodes/maxpool_2d.cairo new file mode 100644 index 000000000..20e768eb7 --- /dev/null +++ b/tests/nodes/maxpool_2d.cairo @@ -0,0 +1,30 @@ +mod input_0; +mod output_0; + + +use orion::operators::nn::NNTrait; +use orion::numbers::FixedTrait; +use orion::operators::tensor::FP16x16TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::nn::FP16x16NN; + +#[test] +#[available_gas(2000000000)] +fn test_maxpool_2d() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let (y_0, _) = NNTrait::max_pool( + @input_0, + Option::None, + Option::None, + Option::None, + array![2, 2].span(), + Option::None, + Option::None, + Option::Some(array![2, 2].span()), + 1 + ); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/gather_elements_fp16x16_3d_axis2/output_0.cairo b/tests/nodes/maxpool_2d/input_0.cairo similarity index 68% rename from tests/nodes/gather_elements_fp16x16_3d_axis2/output_0.cairo rename to tests/nodes/maxpool_2d/input_0.cairo index fe0cb4f6b..28d2d90c9 100644 --- a/tests/nodes/gather_elements_fp16x16_3d_axis2/output_0.cairo +++ b/tests/nodes/maxpool_2d/input_0.cairo @@ -1,41 +1,40 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorSub}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; use orion::numbers::{FixedTrait, FP16x16}; -fn output_0() -> Tensor { +fn input_0() -> Tensor { let mut shape = ArrayTrait::::new(); - shape.append(3); - shape.append(3); - shape.append(3); + shape.append(1); + shape.append(1); + shape.append(5); + shape.append(5); let mut data = ArrayTrait::new(); - data.append(FP16x16 { mag: 131072, sign: false }); - data.append(FP16x16 { mag: 0, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); data.append(FP16x16 { mag: 131072, sign: false }); data.append(FP16x16 { mag: 196608, sign: false }); data.append(FP16x16 { mag: 262144, sign: false }); - data.append(FP16x16 { mag: 196608, sign: false }); - data.append(FP16x16 { mag: 524288, sign: false }); + data.append(FP16x16 { mag: 327680, sign: false }); data.append(FP16x16 { mag: 393216, sign: false }); data.append(FP16x16 { mag: 458752, sign: false }); + data.append(FP16x16 { mag: 524288, sign: false }); + data.append(FP16x16 { mag: 589824, sign: false }); data.append(FP16x16 { mag: 655360, sign: false }); data.append(FP16x16 { mag: 720896, sign: false }); - data.append(FP16x16 { mag: 720896, sign: false }); data.append(FP16x16 { mag: 786432, sign: false }); + data.append(FP16x16 { mag: 851968, sign: false }); data.append(FP16x16 { mag: 917504, sign: false }); - data.append(FP16x16 { mag: 786432, sign: false }); - data.append(FP16x16 { mag: 1114112, sign: false }); - data.append(FP16x16 { mag: 1114112, sign: false }); data.append(FP16x16 { mag: 983040, sign: false }); - data.append(FP16x16 { mag: 1310720, sign: false }); - data.append(FP16x16 { mag: 1245184, sign: false }); + data.append(FP16x16 { mag: 1048576, sign: false }); + data.append(FP16x16 { mag: 1114112, sign: false }); data.append(FP16x16 { mag: 1179648, sign: false }); + data.append(FP16x16 { mag: 1245184, sign: false }); + data.append(FP16x16 { mag: 1310720, sign: false }); data.append(FP16x16 { mag: 1376256, sign: false }); data.append(FP16x16 { mag: 1441792, sign: false }); - data.append(FP16x16 { mag: 1376256, sign: false }); - data.append(FP16x16 { mag: 1638400, sign: false }); - data.append(FP16x16 { mag: 1572864, sign: false }); + data.append(FP16x16 { mag: 1507328, sign: false }); data.append(FP16x16 { mag: 1572864, sign: false }); + data.append(FP16x16 { mag: 1638400, sign: false }); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/maxpool_2d/output_0.cairo b/tests/nodes/maxpool_2d/output_0.cairo new file mode 100644 index 000000000..91ca1ea93 --- /dev/null +++ b/tests/nodes/maxpool_2d/output_0.cairo @@ -0,0 +1,19 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(1); + shape.append(2); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 458752, sign: false }); + data.append(FP16x16 { mag: 589824, sign: false }); + data.append(FP16x16 { mag: 1114112, sign: false }); + data.append(FP16x16 { mag: 1245184, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/maxpool_2d_ceil.cairo b/tests/nodes/maxpool_2d_ceil.cairo new file mode 100644 index 000000000..24f84ea08 --- /dev/null +++ b/tests/nodes/maxpool_2d_ceil.cairo @@ -0,0 +1,30 @@ +mod input_0; +mod output_0; + + +use orion::operators::nn::NNTrait; +use orion::numbers::FixedTrait; +use orion::operators::tensor::FP16x16TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::nn::FP16x16NN; + +#[test] +#[available_gas(2000000000)] +fn test_maxpool_2d_ceil() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let (y_0, _) = NNTrait::max_pool( + @input_0, + Option::None, + Option::Some(1), + Option::None, + array![3, 3].span(), + Option::None, + Option::None, + Option::Some(array![2, 2].span()), + 1 + ); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/maxpool_2d_ceil/input_0.cairo b/tests/nodes/maxpool_2d_ceil/input_0.cairo new file mode 100644 index 000000000..29b195332 --- /dev/null +++ b/tests/nodes/maxpool_2d_ceil/input_0.cairo @@ -0,0 +1,31 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(1); + shape.append(4); + shape.append(4); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 262144, sign: false }); + data.append(FP16x16 { mag: 327680, sign: false }); + data.append(FP16x16 { mag: 393216, sign: false }); + data.append(FP16x16 { mag: 458752, sign: false }); + data.append(FP16x16 { mag: 524288, sign: false }); + data.append(FP16x16 { mag: 589824, sign: false }); + data.append(FP16x16 { mag: 655360, sign: false }); + data.append(FP16x16 { mag: 720896, sign: false }); + data.append(FP16x16 { mag: 786432, sign: false }); + data.append(FP16x16 { mag: 851968, sign: false }); + data.append(FP16x16 { mag: 917504, sign: false }); + data.append(FP16x16 { mag: 983040, sign: false }); + data.append(FP16x16 { mag: 1048576, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/reduce_sum_fp16x16_2D_keepdims/output_0.cairo b/tests/nodes/maxpool_2d_ceil/output_0.cairo similarity index 51% rename from tests/nodes/reduce_sum_fp16x16_2D_keepdims/output_0.cairo rename to tests/nodes/maxpool_2d_ceil/output_0.cairo index 5d99577e2..af7270750 100644 --- a/tests/nodes/reduce_sum_fp16x16_2D_keepdims/output_0.cairo +++ b/tests/nodes/maxpool_2d_ceil/output_0.cairo @@ -1,15 +1,19 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorMul}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; use orion::numbers::{FixedTrait, FP16x16}; fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(1); + shape.append(1); + shape.append(2); shape.append(2); let mut data = ArrayTrait::new(); - data.append(FP16x16 { mag: 131072, sign: false }); - data.append(FP16x16 { mag: 262144, sign: false }); + data.append(FP16x16 { mag: 720896, sign: false }); + data.append(FP16x16 { mag: 786432, sign: false }); + data.append(FP16x16 { mag: 983040, sign: false }); + data.append(FP16x16 { mag: 1048576, sign: false }); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/maxpool_2d_constraint_index.cairo b/tests/nodes/maxpool_2d_constraint_index.cairo new file mode 100644 index 000000000..8698070c2 --- /dev/null +++ b/tests/nodes/maxpool_2d_constraint_index.cairo @@ -0,0 +1,25 @@ +mod input_0; +mod output_0; + + +use orion::operators::nn::NNTrait; +use orion::operators::tensor::U32TensorPartialEq; +use orion::numbers::FixedTrait; +use orion::operators::tensor::I32TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::nn::FP16x16NN; +use orion::operators::nn::U32NN; + + +#[test] +#[available_gas(2000000000)] +fn test_maxpool_2d_constraint_index() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let (_, y_0) = NNTrait::max_pool(@input_0,Option::None,Option::None,Option::None,array![2, 2].span(),Option::None,Option::Some(1),Option::Some(array![2, 2].span()),2); + + assert_eq(y_0.unwrap(), z_0); +} + + diff --git a/tests/nodes/maxpool_2d_constraint_index/input_0.cairo b/tests/nodes/maxpool_2d_constraint_index/input_0.cairo new file mode 100644 index 000000000..28d2d90c9 --- /dev/null +++ b/tests/nodes/maxpool_2d_constraint_index/input_0.cairo @@ -0,0 +1,40 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(1); + shape.append(5); + shape.append(5); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 262144, sign: false }); + data.append(FP16x16 { mag: 327680, sign: false }); + data.append(FP16x16 { mag: 393216, sign: false }); + data.append(FP16x16 { mag: 458752, sign: false }); + data.append(FP16x16 { mag: 524288, sign: false }); + data.append(FP16x16 { mag: 589824, sign: false }); + data.append(FP16x16 { mag: 655360, sign: false }); + data.append(FP16x16 { mag: 720896, sign: false }); + data.append(FP16x16 { mag: 786432, sign: false }); + data.append(FP16x16 { mag: 851968, sign: false }); + data.append(FP16x16 { mag: 917504, sign: false }); + data.append(FP16x16 { mag: 983040, sign: false }); + data.append(FP16x16 { mag: 1048576, sign: false }); + data.append(FP16x16 { mag: 1114112, sign: false }); + data.append(FP16x16 { mag: 1179648, sign: false }); + data.append(FP16x16 { mag: 1245184, sign: false }); + data.append(FP16x16 { mag: 1310720, sign: false }); + data.append(FP16x16 { mag: 1376256, sign: false }); + data.append(FP16x16 { mag: 1441792, sign: false }); + data.append(FP16x16 { mag: 1507328, sign: false }); + data.append(FP16x16 { mag: 1572864, sign: false }); + data.append(FP16x16 { mag: 1638400, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/argmax_fp16x16_3D_last_index/output_0.cairo b/tests/nodes/maxpool_2d_constraint_index/output_0.cairo similarity index 67% rename from tests/nodes/argmax_fp16x16_3D_last_index/output_0.cairo rename to tests/nodes/maxpool_2d_constraint_index/output_0.cairo index 9c34c6139..cf6e63b1b 100644 --- a/tests/nodes/argmax_fp16x16_3D_last_index/output_0.cairo +++ b/tests/nodes/maxpool_2d_constraint_index/output_0.cairo @@ -1,17 +1,19 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::numbers::NumberTrait; -fn output_0() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(1); + shape.append(1); shape.append(2); shape.append(2); let mut data = ArrayTrait::new(); - data.append(1); - data.append(1); - data.append(0); - data.append(0); + data.append(6); + data.append(16); + data.append(8); + data.append(18); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/maxpool_2d_default.cairo b/tests/nodes/maxpool_2d_default.cairo new file mode 100644 index 000000000..8ad969018 --- /dev/null +++ b/tests/nodes/maxpool_2d_default.cairo @@ -0,0 +1,30 @@ +mod input_0; +mod output_0; + + +use orion::operators::nn::NNTrait; +use orion::numbers::FixedTrait; +use orion::operators::tensor::FP16x16TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::nn::FP16x16NN; + +#[test] +#[available_gas(2000000000)] +fn test_maxpool_2d_default() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let (y_0, _) = NNTrait::max_pool( + @input_0, + Option::None, + Option::None, + Option::None, + array![2, 2].span(), + Option::None, + Option::None, + Option::None, + 1 + ); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/maxpool_2d_default/input_0.cairo b/tests/nodes/maxpool_2d_default/input_0.cairo new file mode 100644 index 000000000..1950ff197 --- /dev/null +++ b/tests/nodes/maxpool_2d_default/input_0.cairo @@ -0,0 +1,207 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(3); + shape.append(8); + shape.append(8); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 70171, sign: true }); + data.append(FP16x16 { mag: 66033, sign: true }); + data.append(FP16x16 { mag: 34368, sign: true }); + data.append(FP16x16 { mag: 85619, sign: true }); + data.append(FP16x16 { mag: 10533, sign: false }); + data.append(FP16x16 { mag: 6665, sign: true }); + data.append(FP16x16 { mag: 62906, sign: false }); + data.append(FP16x16 { mag: 4088, sign: true }); + data.append(FP16x16 { mag: 48834, sign: true }); + data.append(FP16x16 { mag: 77568, sign: false }); + data.append(FP16x16 { mag: 72118, sign: false }); + data.append(FP16x16 { mag: 63744, sign: true }); + data.append(FP16x16 { mag: 97321, sign: false }); + data.append(FP16x16 { mag: 51751, sign: false }); + data.append(FP16x16 { mag: 49419, sign: true }); + data.append(FP16x16 { mag: 1074, sign: true }); + data.append(FP16x16 { mag: 33390, sign: true }); + data.append(FP16x16 { mag: 49420, sign: false }); + data.append(FP16x16 { mag: 76230, sign: true }); + data.append(FP16x16 { mag: 90932, sign: true }); + data.append(FP16x16 { mag: 51418, sign: true }); + data.append(FP16x16 { mag: 4380, sign: true }); + data.append(FP16x16 { mag: 160417, sign: false }); + data.append(FP16x16 { mag: 93830, sign: true }); + data.append(FP16x16 { mag: 49619, sign: true }); + data.append(FP16x16 { mag: 24892, sign: false }); + data.append(FP16x16 { mag: 60389, sign: false }); + data.append(FP16x16 { mag: 82115, sign: false }); + data.append(FP16x16 { mag: 27484, sign: true }); + data.append(FP16x16 { mag: 9373, sign: false }); + data.append(FP16x16 { mag: 13065, sign: true }); + data.append(FP16x16 { mag: 3608, sign: false }); + data.append(FP16x16 { mag: 12179, sign: false }); + data.append(FP16x16 { mag: 47764, sign: false }); + data.append(FP16x16 { mag: 45483, sign: true }); + data.append(FP16x16 { mag: 73567, sign: false }); + data.append(FP16x16 { mag: 108526, sign: false }); + data.append(FP16x16 { mag: 76992, sign: true }); + data.append(FP16x16 { mag: 88006, sign: true }); + data.append(FP16x16 { mag: 121995, sign: true }); + data.append(FP16x16 { mag: 30997, sign: true }); + data.append(FP16x16 { mag: 37845, sign: true }); + data.append(FP16x16 { mag: 41773, sign: false }); + data.append(FP16x16 { mag: 25693, sign: false }); + data.append(FP16x16 { mag: 2257, sign: false }); + data.append(FP16x16 { mag: 21906, sign: true }); + data.append(FP16x16 { mag: 5291, sign: false }); + data.append(FP16x16 { mag: 24583, sign: true }); + data.append(FP16x16 { mag: 60049, sign: true }); + data.append(FP16x16 { mag: 9991, sign: false }); + data.append(FP16x16 { mag: 104858, sign: false }); + data.append(FP16x16 { mag: 55871, sign: true }); + data.append(FP16x16 { mag: 54598, sign: true }); + data.append(FP16x16 { mag: 167306, sign: true }); + data.append(FP16x16 { mag: 35180, sign: false }); + data.append(FP16x16 { mag: 196014, sign: true }); + data.append(FP16x16 { mag: 49285, sign: true }); + data.append(FP16x16 { mag: 50669, sign: true }); + data.append(FP16x16 { mag: 11523, sign: true }); + data.append(FP16x16 { mag: 9496, sign: true }); + data.append(FP16x16 { mag: 55801, sign: false }); + data.append(FP16x16 { mag: 104529, sign: false }); + data.append(FP16x16 { mag: 637, sign: true }); + data.append(FP16x16 { mag: 93676, sign: true }); + data.append(FP16x16 { mag: 24789, sign: false }); + data.append(FP16x16 { mag: 7861, sign: false }); + data.append(FP16x16 { mag: 51137, sign: false }); + data.append(FP16x16 { mag: 73137, sign: true }); + data.append(FP16x16 { mag: 99812, sign: false }); + data.append(FP16x16 { mag: 62976, sign: true }); + data.append(FP16x16 { mag: 17193, sign: false }); + data.append(FP16x16 { mag: 30532, sign: true }); + data.append(FP16x16 { mag: 8014, sign: false }); + data.append(FP16x16 { mag: 47501, sign: true }); + data.append(FP16x16 { mag: 66682, sign: true }); + data.append(FP16x16 { mag: 95646, sign: false }); + data.append(FP16x16 { mag: 20504, sign: true }); + data.append(FP16x16 { mag: 4688, sign: true }); + data.append(FP16x16 { mag: 26672, sign: false }); + data.append(FP16x16 { mag: 88843, sign: false }); + data.append(FP16x16 { mag: 100847, sign: false }); + data.append(FP16x16 { mag: 128504, sign: true }); + data.append(FP16x16 { mag: 58079, sign: true }); + data.append(FP16x16 { mag: 42461, sign: false }); + data.append(FP16x16 { mag: 20574, sign: true }); + data.append(FP16x16 { mag: 94980, sign: false }); + data.append(FP16x16 { mag: 123767, sign: true }); + data.append(FP16x16 { mag: 81525, sign: true }); + data.append(FP16x16 { mag: 100345, sign: false }); + data.append(FP16x16 { mag: 27527, sign: false }); + data.append(FP16x16 { mag: 162338, sign: false }); + data.append(FP16x16 { mag: 90315, sign: true }); + data.append(FP16x16 { mag: 98283, sign: false }); + data.append(FP16x16 { mag: 51291, sign: false }); + data.append(FP16x16 { mag: 15507, sign: false }); + data.append(FP16x16 { mag: 129858, sign: true }); + data.append(FP16x16 { mag: 70575, sign: false }); + data.append(FP16x16 { mag: 717, sign: true }); + data.append(FP16x16 { mag: 27936, sign: true }); + data.append(FP16x16 { mag: 24785, sign: false }); + data.append(FP16x16 { mag: 47070, sign: false }); + data.append(FP16x16 { mag: 53060, sign: true }); + data.append(FP16x16 { mag: 71736, sign: true }); + data.append(FP16x16 { mag: 23701, sign: true }); + data.append(FP16x16 { mag: 73045, sign: true }); + data.append(FP16x16 { mag: 90496, sign: true }); + data.append(FP16x16 { mag: 100675, sign: true }); + data.append(FP16x16 { mag: 7795, sign: true }); + data.append(FP16x16 { mag: 39581, sign: false }); + data.append(FP16x16 { mag: 3716, sign: true }); + data.append(FP16x16 { mag: 76732, sign: true }); + data.append(FP16x16 { mag: 43912, sign: true }); + data.append(FP16x16 { mag: 19320, sign: true }); + data.append(FP16x16 { mag: 22545, sign: true }); + data.append(FP16x16 { mag: 27599, sign: false }); + data.append(FP16x16 { mag: 32793, sign: true }); + data.append(FP16x16 { mag: 47706, sign: true }); + data.append(FP16x16 { mag: 96112, sign: true }); + data.append(FP16x16 { mag: 34764, sign: false }); + data.append(FP16x16 { mag: 77647, sign: true }); + data.append(FP16x16 { mag: 35485, sign: false }); + data.append(FP16x16 { mag: 5584, sign: true }); + data.append(FP16x16 { mag: 11917, sign: false }); + data.append(FP16x16 { mag: 37395, sign: true }); + data.append(FP16x16 { mag: 38246, sign: true }); + data.append(FP16x16 { mag: 34063, sign: true }); + data.append(FP16x16 { mag: 20168, sign: false }); + data.append(FP16x16 { mag: 72849, sign: false }); + data.append(FP16x16 { mag: 40801, sign: false }); + data.append(FP16x16 { mag: 42674, sign: false }); + data.append(FP16x16 { mag: 22630, sign: true }); + data.append(FP16x16 { mag: 76034, sign: false }); + data.append(FP16x16 { mag: 62973, sign: false }); + data.append(FP16x16 { mag: 116410, sign: false }); + data.append(FP16x16 { mag: 1951, sign: true }); + data.append(FP16x16 { mag: 33165, sign: true }); + data.append(FP16x16 { mag: 46154, sign: true }); + data.append(FP16x16 { mag: 50498, sign: true }); + data.append(FP16x16 { mag: 5557, sign: true }); + data.append(FP16x16 { mag: 15958, sign: true }); + data.append(FP16x16 { mag: 55572, sign: true }); + data.append(FP16x16 { mag: 116353, sign: true }); + data.append(FP16x16 { mag: 104928, sign: true }); + data.append(FP16x16 { mag: 12275, sign: false }); + data.append(FP16x16 { mag: 2617, sign: true }); + data.append(FP16x16 { mag: 13198, sign: false }); + data.append(FP16x16 { mag: 71218, sign: true }); + data.append(FP16x16 { mag: 8582, sign: false }); + data.append(FP16x16 { mag: 34259, sign: false }); + data.append(FP16x16 { mag: 32055, sign: false }); + data.append(FP16x16 { mag: 18660, sign: false }); + data.append(FP16x16 { mag: 5926, sign: true }); + data.append(FP16x16 { mag: 2802, sign: true }); + data.append(FP16x16 { mag: 71274, sign: false }); + data.append(FP16x16 { mag: 37167, sign: false }); + data.append(FP16x16 { mag: 8185, sign: true }); + data.append(FP16x16 { mag: 53587, sign: true }); + data.append(FP16x16 { mag: 24956, sign: false }); + data.append(FP16x16 { mag: 47492, sign: true }); + data.append(FP16x16 { mag: 30685, sign: true }); + data.append(FP16x16 { mag: 65599, sign: false }); + data.append(FP16x16 { mag: 110444, sign: false }); + data.append(FP16x16 { mag: 11800, sign: false }); + data.append(FP16x16 { mag: 21534, sign: true }); + data.append(FP16x16 { mag: 4907, sign: true }); + data.append(FP16x16 { mag: 67101, sign: false }); + data.append(FP16x16 { mag: 38260, sign: true }); + data.append(FP16x16 { mag: 61924, sign: true }); + data.append(FP16x16 { mag: 7527, sign: false }); + data.append(FP16x16 { mag: 49451, sign: false }); + data.append(FP16x16 { mag: 182905, sign: true }); + data.append(FP16x16 { mag: 16395, sign: true }); + data.append(FP16x16 { mag: 67153, sign: true }); + data.append(FP16x16 { mag: 31050, sign: false }); + data.append(FP16x16 { mag: 5364, sign: true }); + data.append(FP16x16 { mag: 68197, sign: true }); + data.append(FP16x16 { mag: 60008, sign: false }); + data.append(FP16x16 { mag: 77429, sign: true }); + data.append(FP16x16 { mag: 6129, sign: false }); + data.append(FP16x16 { mag: 89537, sign: true }); + data.append(FP16x16 { mag: 46834, sign: false }); + data.append(FP16x16 { mag: 60579, sign: false }); + data.append(FP16x16 { mag: 66521, sign: false }); + data.append(FP16x16 { mag: 64292, sign: false }); + data.append(FP16x16 { mag: 115133, sign: true }); + data.append(FP16x16 { mag: 94534, sign: false }); + data.append(FP16x16 { mag: 39659, sign: false }); + data.append(FP16x16 { mag: 67484, sign: true }); + data.append(FP16x16 { mag: 20442, sign: true }); + data.append(FP16x16 { mag: 54691, sign: false }); + data.append(FP16x16 { mag: 81798, sign: false }); + data.append(FP16x16 { mag: 89422, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/maxpool_2d_default/output_0.cairo b/tests/nodes/maxpool_2d_default/output_0.cairo new file mode 100644 index 000000000..fc25d182a --- /dev/null +++ b/tests/nodes/maxpool_2d_default/output_0.cairo @@ -0,0 +1,162 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(3); + shape.append(7); + shape.append(7); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 77568, sign: false }); + data.append(FP16x16 { mag: 77568, sign: false }); + data.append(FP16x16 { mag: 72118, sign: false }); + data.append(FP16x16 { mag: 97321, sign: false }); + data.append(FP16x16 { mag: 97321, sign: false }); + data.append(FP16x16 { mag: 62906, sign: false }); + data.append(FP16x16 { mag: 62906, sign: false }); + data.append(FP16x16 { mag: 77568, sign: false }); + data.append(FP16x16 { mag: 77568, sign: false }); + data.append(FP16x16 { mag: 72118, sign: false }); + data.append(FP16x16 { mag: 97321, sign: false }); + data.append(FP16x16 { mag: 97321, sign: false }); + data.append(FP16x16 { mag: 160417, sign: false }); + data.append(FP16x16 { mag: 160417, sign: false }); + data.append(FP16x16 { mag: 49420, sign: false }); + data.append(FP16x16 { mag: 60389, sign: false }); + data.append(FP16x16 { mag: 82115, sign: false }); + data.append(FP16x16 { mag: 82115, sign: false }); + data.append(FP16x16 { mag: 9373, sign: false }); + data.append(FP16x16 { mag: 160417, sign: false }); + data.append(FP16x16 { mag: 160417, sign: false }); + data.append(FP16x16 { mag: 47764, sign: false }); + data.append(FP16x16 { mag: 60389, sign: false }); + data.append(FP16x16 { mag: 82115, sign: false }); + data.append(FP16x16 { mag: 108526, sign: false }); + data.append(FP16x16 { mag: 108526, sign: false }); + data.append(FP16x16 { mag: 9373, sign: false }); + data.append(FP16x16 { mag: 3608, sign: false }); + data.append(FP16x16 { mag: 47764, sign: false }); + data.append(FP16x16 { mag: 47764, sign: false }); + data.append(FP16x16 { mag: 73567, sign: false }); + data.append(FP16x16 { mag: 108526, sign: false }); + data.append(FP16x16 { mag: 108526, sign: false }); + data.append(FP16x16 { mag: 5291, sign: false }); + data.append(FP16x16 { mag: 5291, sign: false }); + data.append(FP16x16 { mag: 9991, sign: false }); + data.append(FP16x16 { mag: 104858, sign: false }); + data.append(FP16x16 { mag: 104858, sign: false }); + data.append(FP16x16 { mag: 25693, sign: false }); + data.append(FP16x16 { mag: 2257, sign: false }); + data.append(FP16x16 { mag: 35180, sign: false }); + data.append(FP16x16 { mag: 35180, sign: false }); + data.append(FP16x16 { mag: 9991, sign: false }); + data.append(FP16x16 { mag: 104858, sign: false }); + data.append(FP16x16 { mag: 104858, sign: false }); + data.append(FP16x16 { mag: 55801, sign: false }); + data.append(FP16x16 { mag: 104529, sign: false }); + data.append(FP16x16 { mag: 104529, sign: false }); + data.append(FP16x16 { mag: 35180, sign: false }); + data.append(FP16x16 { mag: 24789, sign: false }); + data.append(FP16x16 { mag: 51137, sign: false }); + data.append(FP16x16 { mag: 95646, sign: false }); + data.append(FP16x16 { mag: 99812, sign: false }); + data.append(FP16x16 { mag: 99812, sign: false }); + data.append(FP16x16 { mag: 26672, sign: false }); + data.append(FP16x16 { mag: 88843, sign: false }); + data.append(FP16x16 { mag: 100847, sign: false }); + data.append(FP16x16 { mag: 47501, sign: true }); + data.append(FP16x16 { mag: 95646, sign: false }); + data.append(FP16x16 { mag: 95646, sign: false }); + data.append(FP16x16 { mag: 94980, sign: false }); + data.append(FP16x16 { mag: 94980, sign: false }); + data.append(FP16x16 { mag: 88843, sign: false }); + data.append(FP16x16 { mag: 100847, sign: false }); + data.append(FP16x16 { mag: 162338, sign: false }); + data.append(FP16x16 { mag: 162338, sign: false }); + data.append(FP16x16 { mag: 98283, sign: false }); + data.append(FP16x16 { mag: 98283, sign: false }); + data.append(FP16x16 { mag: 94980, sign: false }); + data.append(FP16x16 { mag: 15507, sign: false }); + data.append(FP16x16 { mag: 100345, sign: false }); + data.append(FP16x16 { mag: 162338, sign: false }); + data.append(FP16x16 { mag: 162338, sign: false }); + data.append(FP16x16 { mag: 98283, sign: false }); + data.append(FP16x16 { mag: 98283, sign: false }); + data.append(FP16x16 { mag: 51291, sign: false }); + data.append(FP16x16 { mag: 15507, sign: false }); + data.append(FP16x16 { mag: 70575, sign: false }); + data.append(FP16x16 { mag: 717, sign: true }); + data.append(FP16x16 { mag: 24785, sign: false }); + data.append(FP16x16 { mag: 47070, sign: false }); + data.append(FP16x16 { mag: 47070, sign: false }); + data.append(FP16x16 { mag: 3716, sign: true }); + data.append(FP16x16 { mag: 23701, sign: true }); + data.append(FP16x16 { mag: 19320, sign: true }); + data.append(FP16x16 { mag: 27599, sign: false }); + data.append(FP16x16 { mag: 27599, sign: false }); + data.append(FP16x16 { mag: 39581, sign: false }); + data.append(FP16x16 { mag: 39581, sign: false }); + data.append(FP16x16 { mag: 34764, sign: false }); + data.append(FP16x16 { mag: 34764, sign: false }); + data.append(FP16x16 { mag: 35485, sign: false }); + data.append(FP16x16 { mag: 27599, sign: false }); + data.append(FP16x16 { mag: 27599, sign: false }); + data.append(FP16x16 { mag: 32793, sign: true }); + data.append(FP16x16 { mag: 34063, sign: true }); + data.append(FP16x16 { mag: 34764, sign: false }); + data.append(FP16x16 { mag: 72849, sign: false }); + data.append(FP16x16 { mag: 42674, sign: false }); + data.append(FP16x16 { mag: 42674, sign: false }); + data.append(FP16x16 { mag: 76034, sign: false }); + data.append(FP16x16 { mag: 76034, sign: false }); + data.append(FP16x16 { mag: 116410, sign: false }); + data.append(FP16x16 { mag: 116410, sign: false }); + data.append(FP16x16 { mag: 12275, sign: false }); + data.append(FP16x16 { mag: 13198, sign: false }); + data.append(FP16x16 { mag: 13198, sign: false }); + data.append(FP16x16 { mag: 8582, sign: false }); + data.append(FP16x16 { mag: 34259, sign: false }); + data.append(FP16x16 { mag: 34259, sign: false }); + data.append(FP16x16 { mag: 32055, sign: false }); + data.append(FP16x16 { mag: 18660, sign: false }); + data.append(FP16x16 { mag: 71274, sign: false }); + data.append(FP16x16 { mag: 71274, sign: false }); + data.append(FP16x16 { mag: 37167, sign: false }); + data.append(FP16x16 { mag: 34259, sign: false }); + data.append(FP16x16 { mag: 34259, sign: false }); + data.append(FP16x16 { mag: 32055, sign: false }); + data.append(FP16x16 { mag: 18660, sign: false }); + data.append(FP16x16 { mag: 110444, sign: false }); + data.append(FP16x16 { mag: 110444, sign: false }); + data.append(FP16x16 { mag: 37167, sign: false }); + data.append(FP16x16 { mag: 4907, sign: true }); + data.append(FP16x16 { mag: 67101, sign: false }); + data.append(FP16x16 { mag: 67101, sign: false }); + data.append(FP16x16 { mag: 30685, sign: true }); + data.append(FP16x16 { mag: 110444, sign: false }); + data.append(FP16x16 { mag: 110444, sign: false }); + data.append(FP16x16 { mag: 11800, sign: false }); + data.append(FP16x16 { mag: 4907, sign: true }); + data.append(FP16x16 { mag: 67101, sign: false }); + data.append(FP16x16 { mag: 67101, sign: false }); + data.append(FP16x16 { mag: 5364, sign: true }); + data.append(FP16x16 { mag: 60008, sign: false }); + data.append(FP16x16 { mag: 49451, sign: false }); + data.append(FP16x16 { mag: 6129, sign: false }); + data.append(FP16x16 { mag: 46834, sign: false }); + data.append(FP16x16 { mag: 60579, sign: false }); + data.append(FP16x16 { mag: 66521, sign: false }); + data.append(FP16x16 { mag: 66521, sign: false }); + data.append(FP16x16 { mag: 94534, sign: false }); + data.append(FP16x16 { mag: 94534, sign: false }); + data.append(FP16x16 { mag: 39659, sign: false }); + data.append(FP16x16 { mag: 46834, sign: false }); + data.append(FP16x16 { mag: 60579, sign: false }); + data.append(FP16x16 { mag: 81798, sign: false }); + data.append(FP16x16 { mag: 89422, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/maxpool_2d_dilations.cairo b/tests/nodes/maxpool_2d_dilations.cairo new file mode 100644 index 000000000..dc8686055 --- /dev/null +++ b/tests/nodes/maxpool_2d_dilations.cairo @@ -0,0 +1,30 @@ +mod input_0; +mod output_0; + + +use orion::operators::nn::NNTrait; +use orion::numbers::FixedTrait; +use orion::operators::tensor::FP16x16TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::nn::FP16x16NN; + +#[test] +#[available_gas(2000000000)] +fn test_maxpool_2d_dilations() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let (y_0, _) = NNTrait::max_pool( + @input_0, + Option::None, + Option::None, + Option::Some(array![2, 2].span()), + array![2, 2].span(), + Option::None, + Option::None, + Option::None, + 1 + ); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/maxpool_2d_dilations/input_0.cairo b/tests/nodes/maxpool_2d_dilations/input_0.cairo new file mode 100644 index 000000000..29b195332 --- /dev/null +++ b/tests/nodes/maxpool_2d_dilations/input_0.cairo @@ -0,0 +1,31 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(1); + shape.append(4); + shape.append(4); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 262144, sign: false }); + data.append(FP16x16 { mag: 327680, sign: false }); + data.append(FP16x16 { mag: 393216, sign: false }); + data.append(FP16x16 { mag: 458752, sign: false }); + data.append(FP16x16 { mag: 524288, sign: false }); + data.append(FP16x16 { mag: 589824, sign: false }); + data.append(FP16x16 { mag: 655360, sign: false }); + data.append(FP16x16 { mag: 720896, sign: false }); + data.append(FP16x16 { mag: 786432, sign: false }); + data.append(FP16x16 { mag: 851968, sign: false }); + data.append(FP16x16 { mag: 917504, sign: false }); + data.append(FP16x16 { mag: 983040, sign: false }); + data.append(FP16x16 { mag: 1048576, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/maxpool_2d_dilations/output_0.cairo b/tests/nodes/maxpool_2d_dilations/output_0.cairo new file mode 100644 index 000000000..af7270750 --- /dev/null +++ b/tests/nodes/maxpool_2d_dilations/output_0.cairo @@ -0,0 +1,19 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(1); + shape.append(2); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 720896, sign: false }); + data.append(FP16x16 { mag: 786432, sign: false }); + data.append(FP16x16 { mag: 983040, sign: false }); + data.append(FP16x16 { mag: 1048576, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/maxpool_2d_pads_default.cairo b/tests/nodes/maxpool_2d_pads_default.cairo new file mode 100644 index 000000000..103017375 --- /dev/null +++ b/tests/nodes/maxpool_2d_pads_default.cairo @@ -0,0 +1,30 @@ +mod input_0; +mod output_0; + + +use orion::operators::nn::NNTrait; +use orion::numbers::FixedTrait; +use orion::operators::tensor::FP16x16TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::nn::FP16x16NN; + +#[test] +#[available_gas(2000000000)] +fn test_maxpool_2d_pads_default() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let (y_0, _) = NNTrait::max_pool( + @input_0, + Option::None, + Option::None, + Option::None, + array![5, 5].span(), + Option::Some(array![2, 2, 2, 2].span()), + Option::None, + Option::None, + 1 + ); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/maxpool_2d_pads_default/input_0.cairo b/tests/nodes/maxpool_2d_pads_default/input_0.cairo new file mode 100644 index 000000000..28d2d90c9 --- /dev/null +++ b/tests/nodes/maxpool_2d_pads_default/input_0.cairo @@ -0,0 +1,40 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(1); + shape.append(5); + shape.append(5); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 262144, sign: false }); + data.append(FP16x16 { mag: 327680, sign: false }); + data.append(FP16x16 { mag: 393216, sign: false }); + data.append(FP16x16 { mag: 458752, sign: false }); + data.append(FP16x16 { mag: 524288, sign: false }); + data.append(FP16x16 { mag: 589824, sign: false }); + data.append(FP16x16 { mag: 655360, sign: false }); + data.append(FP16x16 { mag: 720896, sign: false }); + data.append(FP16x16 { mag: 786432, sign: false }); + data.append(FP16x16 { mag: 851968, sign: false }); + data.append(FP16x16 { mag: 917504, sign: false }); + data.append(FP16x16 { mag: 983040, sign: false }); + data.append(FP16x16 { mag: 1048576, sign: false }); + data.append(FP16x16 { mag: 1114112, sign: false }); + data.append(FP16x16 { mag: 1179648, sign: false }); + data.append(FP16x16 { mag: 1245184, sign: false }); + data.append(FP16x16 { mag: 1310720, sign: false }); + data.append(FP16x16 { mag: 1376256, sign: false }); + data.append(FP16x16 { mag: 1441792, sign: false }); + data.append(FP16x16 { mag: 1507328, sign: false }); + data.append(FP16x16 { mag: 1572864, sign: false }); + data.append(FP16x16 { mag: 1638400, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/maxpool_2d_pads_default/output_0.cairo b/tests/nodes/maxpool_2d_pads_default/output_0.cairo new file mode 100644 index 000000000..c31cfdd9f --- /dev/null +++ b/tests/nodes/maxpool_2d_pads_default/output_0.cairo @@ -0,0 +1,40 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(1); + shape.append(5); + shape.append(5); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 851968, sign: false }); + data.append(FP16x16 { mag: 917504, sign: false }); + data.append(FP16x16 { mag: 983040, sign: false }); + data.append(FP16x16 { mag: 983040, sign: false }); + data.append(FP16x16 { mag: 983040, sign: false }); + data.append(FP16x16 { mag: 1179648, sign: false }); + data.append(FP16x16 { mag: 1245184, sign: false }); + data.append(FP16x16 { mag: 1310720, sign: false }); + data.append(FP16x16 { mag: 1310720, sign: false }); + data.append(FP16x16 { mag: 1310720, sign: false }); + data.append(FP16x16 { mag: 1507328, sign: false }); + data.append(FP16x16 { mag: 1572864, sign: false }); + data.append(FP16x16 { mag: 1638400, sign: false }); + data.append(FP16x16 { mag: 1638400, sign: false }); + data.append(FP16x16 { mag: 1638400, sign: false }); + data.append(FP16x16 { mag: 1507328, sign: false }); + data.append(FP16x16 { mag: 1572864, sign: false }); + data.append(FP16x16 { mag: 1638400, sign: false }); + data.append(FP16x16 { mag: 1638400, sign: false }); + data.append(FP16x16 { mag: 1638400, sign: false }); + data.append(FP16x16 { mag: 1507328, sign: false }); + data.append(FP16x16 { mag: 1572864, sign: false }); + data.append(FP16x16 { mag: 1638400, sign: false }); + data.append(FP16x16 { mag: 1638400, sign: false }); + data.append(FP16x16 { mag: 1638400, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/maxpool_2d_same_lower_default.cairo b/tests/nodes/maxpool_2d_same_lower_default.cairo new file mode 100644 index 000000000..e947cc879 --- /dev/null +++ b/tests/nodes/maxpool_2d_same_lower_default.cairo @@ -0,0 +1,31 @@ +mod input_0; +mod output_0; + + +use orion::operators::nn::NNTrait; +use orion::numbers::FixedTrait; +use orion::operators::nn::FP16x16NN; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::FP16x16TensorPartialEq; +use orion::operators::nn::AUTO_PAD; + +#[test] +#[available_gas(2000000000)] +fn test_maxpool_2d_same_lower_default() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let (y_0, _) = NNTrait::max_pool( + @input_0, + Option::Some(AUTO_PAD::SAME_LOWER), + Option::None, + Option::None, + array![2, 2].span(), + Option::None, + Option::None, + Option::None, + 1 + ); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/maxpool_2d_same_lower_default/input_0.cairo b/tests/nodes/maxpool_2d_same_lower_default/input_0.cairo new file mode 100644 index 000000000..2d3b05884 --- /dev/null +++ b/tests/nodes/maxpool_2d_same_lower_default/input_0.cairo @@ -0,0 +1,207 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(3); + shape.append(8); + shape.append(8); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 138703, sign: true }); + data.append(FP16x16 { mag: 17593, sign: false }); + data.append(FP16x16 { mag: 37316, sign: true }); + data.append(FP16x16 { mag: 18101, sign: true }); + data.append(FP16x16 { mag: 100611, sign: true }); + data.append(FP16x16 { mag: 659, sign: false }); + data.append(FP16x16 { mag: 100276, sign: false }); + data.append(FP16x16 { mag: 38390, sign: true }); + data.append(FP16x16 { mag: 33210, sign: false }); + data.append(FP16x16 { mag: 61895, sign: true }); + data.append(FP16x16 { mag: 7680, sign: true }); + data.append(FP16x16 { mag: 13113, sign: false }); + data.append(FP16x16 { mag: 72129, sign: true }); + data.append(FP16x16 { mag: 79353, sign: false }); + data.append(FP16x16 { mag: 4830, sign: false }); + data.append(FP16x16 { mag: 37310, sign: true }); + data.append(FP16x16 { mag: 59023, sign: false }); + data.append(FP16x16 { mag: 59144, sign: false }); + data.append(FP16x16 { mag: 20810, sign: true }); + data.append(FP16x16 { mag: 191104, sign: false }); + data.append(FP16x16 { mag: 41831, sign: false }); + data.append(FP16x16 { mag: 85357, sign: true }); + data.append(FP16x16 { mag: 68515, sign: false }); + data.append(FP16x16 { mag: 28484, sign: false }); + data.append(FP16x16 { mag: 45074, sign: false }); + data.append(FP16x16 { mag: 44778, sign: true }); + data.append(FP16x16 { mag: 36984, sign: false }); + data.append(FP16x16 { mag: 66850, sign: false }); + data.append(FP16x16 { mag: 112661, sign: false }); + data.append(FP16x16 { mag: 23651, sign: true }); + data.append(FP16x16 { mag: 79272, sign: false }); + data.append(FP16x16 { mag: 154926, sign: true }); + data.append(FP16x16 { mag: 10887, sign: true }); + data.append(FP16x16 { mag: 6880, sign: true }); + data.append(FP16x16 { mag: 59713, sign: true }); + data.append(FP16x16 { mag: 36990, sign: true }); + data.append(FP16x16 { mag: 47134, sign: true }); + data.append(FP16x16 { mag: 103368, sign: false }); + data.append(FP16x16 { mag: 94963, sign: true }); + data.append(FP16x16 { mag: 9558, sign: true }); + data.append(FP16x16 { mag: 141332, sign: true }); + data.append(FP16x16 { mag: 32922, sign: true }); + data.append(FP16x16 { mag: 14154, sign: true }); + data.append(FP16x16 { mag: 138698, sign: false }); + data.append(FP16x16 { mag: 26096, sign: false }); + data.append(FP16x16 { mag: 91856, sign: false }); + data.append(FP16x16 { mag: 31118, sign: true }); + data.append(FP16x16 { mag: 508, sign: false }); + data.append(FP16x16 { mag: 35988, sign: false }); + data.append(FP16x16 { mag: 9381, sign: true }); + data.append(FP16x16 { mag: 10816, sign: true }); + data.append(FP16x16 { mag: 28140, sign: false }); + data.append(FP16x16 { mag: 10298, sign: true }); + data.append(FP16x16 { mag: 68132, sign: false }); + data.append(FP16x16 { mag: 80322, sign: false }); + data.append(FP16x16 { mag: 88352, sign: false }); + data.append(FP16x16 { mag: 100098, sign: false }); + data.append(FP16x16 { mag: 53069, sign: false }); + data.append(FP16x16 { mag: 155072, sign: false }); + data.append(FP16x16 { mag: 22128, sign: true }); + data.append(FP16x16 { mag: 172627, sign: true }); + data.append(FP16x16 { mag: 20198, sign: false }); + data.append(FP16x16 { mag: 3764, sign: true }); + data.append(FP16x16 { mag: 34532, sign: false }); + data.append(FP16x16 { mag: 81111, sign: true }); + data.append(FP16x16 { mag: 38033, sign: true }); + data.append(FP16x16 { mag: 25795, sign: true }); + data.append(FP16x16 { mag: 53914, sign: true }); + data.append(FP16x16 { mag: 58934, sign: true }); + data.append(FP16x16 { mag: 74080, sign: true }); + data.append(FP16x16 { mag: 53723, sign: true }); + data.append(FP16x16 { mag: 10926, sign: false }); + data.append(FP16x16 { mag: 84619, sign: false }); + data.append(FP16x16 { mag: 188693, sign: false }); + data.append(FP16x16 { mag: 37774, sign: false }); + data.append(FP16x16 { mag: 33855, sign: false }); + data.append(FP16x16 { mag: 86756, sign: false }); + data.append(FP16x16 { mag: 47341, sign: false }); + data.append(FP16x16 { mag: 16804, sign: false }); + data.append(FP16x16 { mag: 19410, sign: true }); + data.append(FP16x16 { mag: 4857, sign: true }); + data.append(FP16x16 { mag: 144907, sign: false }); + data.append(FP16x16 { mag: 19674, sign: false }); + data.append(FP16x16 { mag: 7336, sign: true }); + data.append(FP16x16 { mag: 83249, sign: true }); + data.append(FP16x16 { mag: 13101, sign: true }); + data.append(FP16x16 { mag: 13796, sign: false }); + data.append(FP16x16 { mag: 23641, sign: true }); + data.append(FP16x16 { mag: 61764, sign: true }); + data.append(FP16x16 { mag: 28933, sign: true }); + data.append(FP16x16 { mag: 79450, sign: false }); + data.append(FP16x16 { mag: 43751, sign: false }); + data.append(FP16x16 { mag: 99475, sign: false }); + data.append(FP16x16 { mag: 99879, sign: true }); + data.append(FP16x16 { mag: 16143, sign: false }); + data.append(FP16x16 { mag: 19630, sign: true }); + data.append(FP16x16 { mag: 119844, sign: false }); + data.append(FP16x16 { mag: 4729, sign: false }); + data.append(FP16x16 { mag: 40092, sign: false }); + data.append(FP16x16 { mag: 52497, sign: false }); + data.append(FP16x16 { mag: 28145, sign: true }); + data.append(FP16x16 { mag: 31321, sign: false }); + data.append(FP16x16 { mag: 47437, sign: false }); + data.append(FP16x16 { mag: 59558, sign: false }); + data.append(FP16x16 { mag: 154091, sign: false }); + data.append(FP16x16 { mag: 60540, sign: false }); + data.append(FP16x16 { mag: 46907, sign: true }); + data.append(FP16x16 { mag: 84671, sign: false }); + data.append(FP16x16 { mag: 56013, sign: false }); + data.append(FP16x16 { mag: 58264, sign: true }); + data.append(FP16x16 { mag: 20243, sign: false }); + data.append(FP16x16 { mag: 147219, sign: true }); + data.append(FP16x16 { mag: 36880, sign: false }); + data.append(FP16x16 { mag: 80459, sign: true }); + data.append(FP16x16 { mag: 52556, sign: false }); + data.append(FP16x16 { mag: 176520, sign: true }); + data.append(FP16x16 { mag: 89561, sign: true }); + data.append(FP16x16 { mag: 45221, sign: false }); + data.append(FP16x16 { mag: 37020, sign: false }); + data.append(FP16x16 { mag: 88532, sign: true }); + data.append(FP16x16 { mag: 99592, sign: false }); + data.append(FP16x16 { mag: 6673, sign: true }); + data.append(FP16x16 { mag: 20497, sign: true }); + data.append(FP16x16 { mag: 48790, sign: false }); + data.append(FP16x16 { mag: 63481, sign: true }); + data.append(FP16x16 { mag: 93939, sign: true }); + data.append(FP16x16 { mag: 10523, sign: true }); + data.append(FP16x16 { mag: 90627, sign: false }); + data.append(FP16x16 { mag: 15429, sign: false }); + data.append(FP16x16 { mag: 9882, sign: false }); + data.append(FP16x16 { mag: 88221, sign: false }); + data.append(FP16x16 { mag: 103220, sign: false }); + data.append(FP16x16 { mag: 18470, sign: false }); + data.append(FP16x16 { mag: 116464, sign: true }); + data.append(FP16x16 { mag: 45172, sign: true }); + data.append(FP16x16 { mag: 28246, sign: false }); + data.append(FP16x16 { mag: 62933, sign: true }); + data.append(FP16x16 { mag: 80332, sign: false }); + data.append(FP16x16 { mag: 21278, sign: true }); + data.append(FP16x16 { mag: 56583, sign: true }); + data.append(FP16x16 { mag: 34590, sign: true }); + data.append(FP16x16 { mag: 48885, sign: true }); + data.append(FP16x16 { mag: 38070, sign: true }); + data.append(FP16x16 { mag: 51209, sign: true }); + data.append(FP16x16 { mag: 44554, sign: false }); + data.append(FP16x16 { mag: 75396, sign: true }); + data.append(FP16x16 { mag: 162232, sign: true }); + data.append(FP16x16 { mag: 85388, sign: true }); + data.append(FP16x16 { mag: 77567, sign: true }); + data.append(FP16x16 { mag: 46076, sign: false }); + data.append(FP16x16 { mag: 1258, sign: false }); + data.append(FP16x16 { mag: 75938, sign: true }); + data.append(FP16x16 { mag: 19808, sign: true }); + data.append(FP16x16 { mag: 3602, sign: true }); + data.append(FP16x16 { mag: 26122, sign: true }); + data.append(FP16x16 { mag: 48685, sign: true }); + data.append(FP16x16 { mag: 67709, sign: true }); + data.append(FP16x16 { mag: 15860, sign: false }); + data.append(FP16x16 { mag: 59382, sign: false }); + data.append(FP16x16 { mag: 39707, sign: true }); + data.append(FP16x16 { mag: 3979, sign: true }); + data.append(FP16x16 { mag: 14954, sign: false }); + data.append(FP16x16 { mag: 94433, sign: true }); + data.append(FP16x16 { mag: 24674, sign: false }); + data.append(FP16x16 { mag: 32149, sign: true }); + data.append(FP16x16 { mag: 96812, sign: false }); + data.append(FP16x16 { mag: 32335, sign: true }); + data.append(FP16x16 { mag: 26743, sign: false }); + data.append(FP16x16 { mag: 64580, sign: false }); + data.append(FP16x16 { mag: 17788, sign: true }); + data.append(FP16x16 { mag: 25898, sign: false }); + data.append(FP16x16 { mag: 36605, sign: false }); + data.append(FP16x16 { mag: 78960, sign: true }); + data.append(FP16x16 { mag: 117485, sign: true }); + data.append(FP16x16 { mag: 23270, sign: true }); + data.append(FP16x16 { mag: 1539, sign: false }); + data.append(FP16x16 { mag: 46000, sign: false }); + data.append(FP16x16 { mag: 110506, sign: true }); + data.append(FP16x16 { mag: 37096, sign: false }); + data.append(FP16x16 { mag: 24200, sign: true }); + data.append(FP16x16 { mag: 51581, sign: false }); + data.append(FP16x16 { mag: 17036, sign: false }); + data.append(FP16x16 { mag: 21576, sign: true }); + data.append(FP16x16 { mag: 61805, sign: false }); + data.append(FP16x16 { mag: 30579, sign: false }); + data.append(FP16x16 { mag: 23251, sign: true }); + data.append(FP16x16 { mag: 37590, sign: true }); + data.append(FP16x16 { mag: 30907, sign: false }); + data.append(FP16x16 { mag: 10479, sign: false }); + data.append(FP16x16 { mag: 15777, sign: true }); + data.append(FP16x16 { mag: 12917, sign: false }); + data.append(FP16x16 { mag: 109290, sign: true }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/maxpool_2d_same_lower_default/output_0.cairo b/tests/nodes/maxpool_2d_same_lower_default/output_0.cairo new file mode 100644 index 000000000..b272a29cb --- /dev/null +++ b/tests/nodes/maxpool_2d_same_lower_default/output_0.cairo @@ -0,0 +1,207 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(3); + shape.append(8); + shape.append(8); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 138703, sign: true }); + data.append(FP16x16 { mag: 17593, sign: false }); + data.append(FP16x16 { mag: 17593, sign: false }); + data.append(FP16x16 { mag: 18101, sign: true }); + data.append(FP16x16 { mag: 18101, sign: true }); + data.append(FP16x16 { mag: 659, sign: false }); + data.append(FP16x16 { mag: 100276, sign: false }); + data.append(FP16x16 { mag: 100276, sign: false }); + data.append(FP16x16 { mag: 33210, sign: false }); + data.append(FP16x16 { mag: 33210, sign: false }); + data.append(FP16x16 { mag: 17593, sign: false }); + data.append(FP16x16 { mag: 13113, sign: false }); + data.append(FP16x16 { mag: 13113, sign: false }); + data.append(FP16x16 { mag: 79353, sign: false }); + data.append(FP16x16 { mag: 100276, sign: false }); + data.append(FP16x16 { mag: 100276, sign: false }); + data.append(FP16x16 { mag: 59023, sign: false }); + data.append(FP16x16 { mag: 59144, sign: false }); + data.append(FP16x16 { mag: 59144, sign: false }); + data.append(FP16x16 { mag: 191104, sign: false }); + data.append(FP16x16 { mag: 191104, sign: false }); + data.append(FP16x16 { mag: 79353, sign: false }); + data.append(FP16x16 { mag: 79353, sign: false }); + data.append(FP16x16 { mag: 68515, sign: false }); + data.append(FP16x16 { mag: 59023, sign: false }); + data.append(FP16x16 { mag: 59144, sign: false }); + data.append(FP16x16 { mag: 59144, sign: false }); + data.append(FP16x16 { mag: 191104, sign: false }); + data.append(FP16x16 { mag: 191104, sign: false }); + data.append(FP16x16 { mag: 112661, sign: false }); + data.append(FP16x16 { mag: 79272, sign: false }); + data.append(FP16x16 { mag: 79272, sign: false }); + data.append(FP16x16 { mag: 45074, sign: false }); + data.append(FP16x16 { mag: 45074, sign: false }); + data.append(FP16x16 { mag: 36984, sign: false }); + data.append(FP16x16 { mag: 66850, sign: false }); + data.append(FP16x16 { mag: 112661, sign: false }); + data.append(FP16x16 { mag: 112661, sign: false }); + data.append(FP16x16 { mag: 103368, sign: false }); + data.append(FP16x16 { mag: 79272, sign: false }); + data.append(FP16x16 { mag: 10887, sign: true }); + data.append(FP16x16 { mag: 6880, sign: true }); + data.append(FP16x16 { mag: 6880, sign: true }); + data.append(FP16x16 { mag: 138698, sign: false }); + data.append(FP16x16 { mag: 138698, sign: false }); + data.append(FP16x16 { mag: 103368, sign: false }); + data.append(FP16x16 { mag: 103368, sign: false }); + data.append(FP16x16 { mag: 508, sign: false }); + data.append(FP16x16 { mag: 35988, sign: false }); + data.append(FP16x16 { mag: 35988, sign: false }); + data.append(FP16x16 { mag: 9381, sign: true }); + data.append(FP16x16 { mag: 138698, sign: false }); + data.append(FP16x16 { mag: 138698, sign: false }); + data.append(FP16x16 { mag: 91856, sign: false }); + data.append(FP16x16 { mag: 91856, sign: false }); + data.append(FP16x16 { mag: 88352, sign: false }); + data.append(FP16x16 { mag: 100098, sign: false }); + data.append(FP16x16 { mag: 100098, sign: false }); + data.append(FP16x16 { mag: 155072, sign: false }); + data.append(FP16x16 { mag: 155072, sign: false }); + data.append(FP16x16 { mag: 28140, sign: false }); + data.append(FP16x16 { mag: 68132, sign: false }); + data.append(FP16x16 { mag: 80322, sign: false }); + data.append(FP16x16 { mag: 88352, sign: false }); + data.append(FP16x16 { mag: 81111, sign: true }); + data.append(FP16x16 { mag: 38033, sign: true }); + data.append(FP16x16 { mag: 25795, sign: true }); + data.append(FP16x16 { mag: 25795, sign: true }); + data.append(FP16x16 { mag: 53914, sign: true }); + data.append(FP16x16 { mag: 58934, sign: true }); + data.append(FP16x16 { mag: 53723, sign: true }); + data.append(FP16x16 { mag: 10926, sign: false }); + data.append(FP16x16 { mag: 84619, sign: false }); + data.append(FP16x16 { mag: 188693, sign: false }); + data.append(FP16x16 { mag: 188693, sign: false }); + data.append(FP16x16 { mag: 37774, sign: false }); + data.append(FP16x16 { mag: 86756, sign: false }); + data.append(FP16x16 { mag: 86756, sign: false }); + data.append(FP16x16 { mag: 47341, sign: false }); + data.append(FP16x16 { mag: 16804, sign: false }); + data.append(FP16x16 { mag: 84619, sign: false }); + data.append(FP16x16 { mag: 188693, sign: false }); + data.append(FP16x16 { mag: 188693, sign: false }); + data.append(FP16x16 { mag: 37774, sign: false }); + data.append(FP16x16 { mag: 86756, sign: false }); + data.append(FP16x16 { mag: 86756, sign: false }); + data.append(FP16x16 { mag: 47341, sign: false }); + data.append(FP16x16 { mag: 16804, sign: false }); + data.append(FP16x16 { mag: 4857, sign: true }); + data.append(FP16x16 { mag: 144907, sign: false }); + data.append(FP16x16 { mag: 144907, sign: false }); + data.append(FP16x16 { mag: 79450, sign: false }); + data.append(FP16x16 { mag: 99475, sign: false }); + data.append(FP16x16 { mag: 99475, sign: false }); + data.append(FP16x16 { mag: 16143, sign: false }); + data.append(FP16x16 { mag: 16143, sign: false }); + data.append(FP16x16 { mag: 119844, sign: false }); + data.append(FP16x16 { mag: 119844, sign: false }); + data.append(FP16x16 { mag: 79450, sign: false }); + data.append(FP16x16 { mag: 79450, sign: false }); + data.append(FP16x16 { mag: 99475, sign: false }); + data.append(FP16x16 { mag: 99475, sign: false }); + data.append(FP16x16 { mag: 47437, sign: false }); + data.append(FP16x16 { mag: 59558, sign: false }); + data.append(FP16x16 { mag: 154091, sign: false }); + data.append(FP16x16 { mag: 154091, sign: false }); + data.append(FP16x16 { mag: 60540, sign: false }); + data.append(FP16x16 { mag: 84671, sign: false }); + data.append(FP16x16 { mag: 84671, sign: false }); + data.append(FP16x16 { mag: 56013, sign: false }); + data.append(FP16x16 { mag: 47437, sign: false }); + data.append(FP16x16 { mag: 59558, sign: false }); + data.append(FP16x16 { mag: 154091, sign: false }); + data.append(FP16x16 { mag: 154091, sign: false }); + data.append(FP16x16 { mag: 60540, sign: false }); + data.append(FP16x16 { mag: 84671, sign: false }); + data.append(FP16x16 { mag: 84671, sign: false }); + data.append(FP16x16 { mag: 56013, sign: false }); + data.append(FP16x16 { mag: 45221, sign: false }); + data.append(FP16x16 { mag: 37020, sign: false }); + data.append(FP16x16 { mag: 99592, sign: false }); + data.append(FP16x16 { mag: 99592, sign: false }); + data.append(FP16x16 { mag: 52556, sign: false }); + data.append(FP16x16 { mag: 52556, sign: false }); + data.append(FP16x16 { mag: 48790, sign: false }); + data.append(FP16x16 { mag: 45221, sign: false }); + data.append(FP16x16 { mag: 45221, sign: false }); + data.append(FP16x16 { mag: 90627, sign: false }); + data.append(FP16x16 { mag: 15429, sign: false }); + data.append(FP16x16 { mag: 15429, sign: false }); + data.append(FP16x16 { mag: 88221, sign: false }); + data.append(FP16x16 { mag: 103220, sign: false }); + data.append(FP16x16 { mag: 103220, sign: false }); + data.append(FP16x16 { mag: 18470, sign: false }); + data.append(FP16x16 { mag: 45172, sign: true }); + data.append(FP16x16 { mag: 28246, sign: false }); + data.append(FP16x16 { mag: 15429, sign: false }); + data.append(FP16x16 { mag: 80332, sign: false }); + data.append(FP16x16 { mag: 88221, sign: false }); + data.append(FP16x16 { mag: 103220, sign: false }); + data.append(FP16x16 { mag: 103220, sign: false }); + data.append(FP16x16 { mag: 18470, sign: false }); + data.append(FP16x16 { mag: 38070, sign: true }); + data.append(FP16x16 { mag: 28246, sign: false }); + data.append(FP16x16 { mag: 44554, sign: false }); + data.append(FP16x16 { mag: 80332, sign: false }); + data.append(FP16x16 { mag: 80332, sign: false }); + data.append(FP16x16 { mag: 21278, sign: true }); + data.append(FP16x16 { mag: 34590, sign: true }); + data.append(FP16x16 { mag: 46076, sign: false }); + data.append(FP16x16 { mag: 46076, sign: false }); + data.append(FP16x16 { mag: 1258, sign: false }); + data.append(FP16x16 { mag: 44554, sign: false }); + data.append(FP16x16 { mag: 44554, sign: false }); + data.append(FP16x16 { mag: 3602, sign: true }); + data.append(FP16x16 { mag: 26122, sign: true }); + data.append(FP16x16 { mag: 48685, sign: true }); + data.append(FP16x16 { mag: 46076, sign: false }); + data.append(FP16x16 { mag: 59382, sign: false }); + data.append(FP16x16 { mag: 59382, sign: false }); + data.append(FP16x16 { mag: 3979, sign: true }); + data.append(FP16x16 { mag: 14954, sign: false }); + data.append(FP16x16 { mag: 14954, sign: false }); + data.append(FP16x16 { mag: 24674, sign: false }); + data.append(FP16x16 { mag: 24674, sign: false }); + data.append(FP16x16 { mag: 96812, sign: false }); + data.append(FP16x16 { mag: 96812, sign: false }); + data.append(FP16x16 { mag: 59382, sign: false }); + data.append(FP16x16 { mag: 64580, sign: false }); + data.append(FP16x16 { mag: 64580, sign: false }); + data.append(FP16x16 { mag: 25898, sign: false }); + data.append(FP16x16 { mag: 36605, sign: false }); + data.append(FP16x16 { mag: 36605, sign: false }); + data.append(FP16x16 { mag: 96812, sign: false }); + data.append(FP16x16 { mag: 96812, sign: false }); + data.append(FP16x16 { mag: 26743, sign: false }); + data.append(FP16x16 { mag: 64580, sign: false }); + data.append(FP16x16 { mag: 64580, sign: false }); + data.append(FP16x16 { mag: 37096, sign: false }); + data.append(FP16x16 { mag: 37096, sign: false }); + data.append(FP16x16 { mag: 51581, sign: false }); + data.append(FP16x16 { mag: 51581, sign: false }); + data.append(FP16x16 { mag: 17036, sign: false }); + data.append(FP16x16 { mag: 61805, sign: false }); + data.append(FP16x16 { mag: 46000, sign: false }); + data.append(FP16x16 { mag: 46000, sign: false }); + data.append(FP16x16 { mag: 37096, sign: false }); + data.append(FP16x16 { mag: 37096, sign: false }); + data.append(FP16x16 { mag: 51581, sign: false }); + data.append(FP16x16 { mag: 51581, sign: false }); + data.append(FP16x16 { mag: 17036, sign: false }); + data.append(FP16x16 { mag: 61805, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/maxpool_2d_same_upper.cairo b/tests/nodes/maxpool_2d_same_upper.cairo new file mode 100644 index 000000000..45b47735b --- /dev/null +++ b/tests/nodes/maxpool_2d_same_upper.cairo @@ -0,0 +1,31 @@ +mod input_0; +mod output_0; + + +use orion::operators::nn::NNTrait; +use orion::numbers::FixedTrait; +use orion::operators::tensor::FP16x16TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::nn::FP16x16NN; +use orion::operators::nn::AUTO_PAD; + +#[test] +#[available_gas(2000000000)] +fn test_maxpool_2d_same_upper() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let (y_0, _) = NNTrait::max_pool( + @input_0, + Option::Some(AUTO_PAD::SAME_UPPER), + Option::None, + Option::None, + array![3, 3].span(), + Option::None, + Option::None, + Option::Some(array![2, 2].span()), + 1 + ); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/maxpool_2d_same_upper/input_0.cairo b/tests/nodes/maxpool_2d_same_upper/input_0.cairo new file mode 100644 index 000000000..28d2d90c9 --- /dev/null +++ b/tests/nodes/maxpool_2d_same_upper/input_0.cairo @@ -0,0 +1,40 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(1); + shape.append(5); + shape.append(5); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 262144, sign: false }); + data.append(FP16x16 { mag: 327680, sign: false }); + data.append(FP16x16 { mag: 393216, sign: false }); + data.append(FP16x16 { mag: 458752, sign: false }); + data.append(FP16x16 { mag: 524288, sign: false }); + data.append(FP16x16 { mag: 589824, sign: false }); + data.append(FP16x16 { mag: 655360, sign: false }); + data.append(FP16x16 { mag: 720896, sign: false }); + data.append(FP16x16 { mag: 786432, sign: false }); + data.append(FP16x16 { mag: 851968, sign: false }); + data.append(FP16x16 { mag: 917504, sign: false }); + data.append(FP16x16 { mag: 983040, sign: false }); + data.append(FP16x16 { mag: 1048576, sign: false }); + data.append(FP16x16 { mag: 1114112, sign: false }); + data.append(FP16x16 { mag: 1179648, sign: false }); + data.append(FP16x16 { mag: 1245184, sign: false }); + data.append(FP16x16 { mag: 1310720, sign: false }); + data.append(FP16x16 { mag: 1376256, sign: false }); + data.append(FP16x16 { mag: 1441792, sign: false }); + data.append(FP16x16 { mag: 1507328, sign: false }); + data.append(FP16x16 { mag: 1572864, sign: false }); + data.append(FP16x16 { mag: 1638400, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/maxpool_2d_same_upper/output_0.cairo b/tests/nodes/maxpool_2d_same_upper/output_0.cairo new file mode 100644 index 000000000..43239cab2 --- /dev/null +++ b/tests/nodes/maxpool_2d_same_upper/output_0.cairo @@ -0,0 +1,24 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(1); + shape.append(3); + shape.append(3); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 458752, sign: false }); + data.append(FP16x16 { mag: 589824, sign: false }); + data.append(FP16x16 { mag: 655360, sign: false }); + data.append(FP16x16 { mag: 1114112, sign: false }); + data.append(FP16x16 { mag: 1245184, sign: false }); + data.append(FP16x16 { mag: 1310720, sign: false }); + data.append(FP16x16 { mag: 1441792, sign: false }); + data.append(FP16x16 { mag: 1572864, sign: false }); + data.append(FP16x16 { mag: 1638400, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/maxpool_2d_same_upper_default.cairo b/tests/nodes/maxpool_2d_same_upper_default.cairo new file mode 100644 index 000000000..9bb855712 --- /dev/null +++ b/tests/nodes/maxpool_2d_same_upper_default.cairo @@ -0,0 +1,31 @@ +mod input_0; +mod output_0; + + +use orion::operators::nn::NNTrait; +use orion::numbers::FixedTrait; +use orion::operators::tensor::FP16x16TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::nn::FP16x16NN; +use orion::operators::nn::AUTO_PAD; + +#[test] +#[available_gas(2000000000)] +fn test_maxpool_2d_same_upper_default() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let (y_0, _) = NNTrait::max_pool( + @input_0, + Option::Some(AUTO_PAD::SAME_UPPER), + Option::None, + Option::None, + array![2, 2].span(), + Option::None, + Option::None, + Option::None, + 1 + ); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/maxpool_2d_same_upper_default/input_0.cairo b/tests/nodes/maxpool_2d_same_upper_default/input_0.cairo new file mode 100644 index 000000000..fdaea89f1 --- /dev/null +++ b/tests/nodes/maxpool_2d_same_upper_default/input_0.cairo @@ -0,0 +1,207 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(3); + shape.append(8); + shape.append(8); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 52692, sign: true }); + data.append(FP16x16 { mag: 28547, sign: false }); + data.append(FP16x16 { mag: 61903, sign: false }); + data.append(FP16x16 { mag: 117176, sign: true }); + data.append(FP16x16 { mag: 55156, sign: true }); + data.append(FP16x16 { mag: 120666, sign: true }); + data.append(FP16x16 { mag: 11052, sign: true }); + data.append(FP16x16 { mag: 8291, sign: false }); + data.append(FP16x16 { mag: 30701, sign: true }); + data.append(FP16x16 { mag: 17967, sign: false }); + data.append(FP16x16 { mag: 88529, sign: false }); + data.append(FP16x16 { mag: 47477, sign: true }); + data.append(FP16x16 { mag: 2290, sign: false }); + data.append(FP16x16 { mag: 92642, sign: false }); + data.append(FP16x16 { mag: 25259, sign: false }); + data.append(FP16x16 { mag: 4575, sign: true }); + data.append(FP16x16 { mag: 2693, sign: false }); + data.append(FP16x16 { mag: 105488, sign: true }); + data.append(FP16x16 { mag: 60124, sign: true }); + data.append(FP16x16 { mag: 46704, sign: true }); + data.append(FP16x16 { mag: 59101, sign: false }); + data.append(FP16x16 { mag: 49138, sign: true }); + data.append(FP16x16 { mag: 19003, sign: false }); + data.append(FP16x16 { mag: 17818, sign: false }); + data.append(FP16x16 { mag: 67683, sign: true }); + data.append(FP16x16 { mag: 77933, sign: true }); + data.append(FP16x16 { mag: 12737, sign: true }); + data.append(FP16x16 { mag: 65213, sign: false }); + data.append(FP16x16 { mag: 97849, sign: true }); + data.append(FP16x16 { mag: 49974, sign: false }); + data.append(FP16x16 { mag: 102583, sign: true }); + data.append(FP16x16 { mag: 117996, sign: false }); + data.append(FP16x16 { mag: 43197, sign: false }); + data.append(FP16x16 { mag: 87131, sign: true }); + data.append(FP16x16 { mag: 165019, sign: false }); + data.append(FP16x16 { mag: 35679, sign: true }); + data.append(FP16x16 { mag: 234, sign: false }); + data.append(FP16x16 { mag: 26030, sign: false }); + data.append(FP16x16 { mag: 4122, sign: false }); + data.append(FP16x16 { mag: 47426, sign: false }); + data.append(FP16x16 { mag: 22922, sign: true }); + data.append(FP16x16 { mag: 117833, sign: true }); + data.append(FP16x16 { mag: 100009, sign: false }); + data.append(FP16x16 { mag: 4360, sign: true }); + data.append(FP16x16 { mag: 38570, sign: false }); + data.append(FP16x16 { mag: 163610, sign: false }); + data.append(FP16x16 { mag: 27943, sign: false }); + data.append(FP16x16 { mag: 46610, sign: false }); + data.append(FP16x16 { mag: 27879, sign: false }); + data.append(FP16x16 { mag: 90383, sign: true }); + data.append(FP16x16 { mag: 14715, sign: true }); + data.append(FP16x16 { mag: 96467, sign: true }); + data.append(FP16x16 { mag: 9921, sign: false }); + data.append(FP16x16 { mag: 77435, sign: false }); + data.append(FP16x16 { mag: 54601, sign: true }); + data.append(FP16x16 { mag: 2255, sign: true }); + data.append(FP16x16 { mag: 1811, sign: true }); + data.append(FP16x16 { mag: 27154, sign: false }); + data.append(FP16x16 { mag: 28554, sign: false }); + data.append(FP16x16 { mag: 68574, sign: false }); + data.append(FP16x16 { mag: 10013, sign: false }); + data.append(FP16x16 { mag: 54722, sign: true }); + data.append(FP16x16 { mag: 51289, sign: true }); + data.append(FP16x16 { mag: 104200, sign: true }); + data.append(FP16x16 { mag: 72679, sign: true }); + data.append(FP16x16 { mag: 49102, sign: false }); + data.append(FP16x16 { mag: 73473, sign: false }); + data.append(FP16x16 { mag: 12392, sign: true }); + data.append(FP16x16 { mag: 13918, sign: false }); + data.append(FP16x16 { mag: 25166, sign: false }); + data.append(FP16x16 { mag: 54632, sign: false }); + data.append(FP16x16 { mag: 71299, sign: true }); + data.append(FP16x16 { mag: 79231, sign: true }); + data.append(FP16x16 { mag: 20472, sign: false }); + data.append(FP16x16 { mag: 19723, sign: false }); + data.append(FP16x16 { mag: 44396, sign: true }); + data.append(FP16x16 { mag: 45735, sign: false }); + data.append(FP16x16 { mag: 73626, sign: false }); + data.append(FP16x16 { mag: 1061, sign: true }); + data.append(FP16x16 { mag: 17482, sign: true }); + data.append(FP16x16 { mag: 20656, sign: true }); + data.append(FP16x16 { mag: 69032, sign: true }); + data.append(FP16x16 { mag: 7840, sign: false }); + data.append(FP16x16 { mag: 1006, sign: false }); + data.append(FP16x16 { mag: 65113, sign: true }); + data.append(FP16x16 { mag: 56413, sign: false }); + data.append(FP16x16 { mag: 28968, sign: true }); + data.append(FP16x16 { mag: 52619, sign: false }); + data.append(FP16x16 { mag: 4590, sign: false }); + data.append(FP16x16 { mag: 15977, sign: true }); + data.append(FP16x16 { mag: 40501, sign: true }); + data.append(FP16x16 { mag: 2693, sign: false }); + data.append(FP16x16 { mag: 55620, sign: false }); + data.append(FP16x16 { mag: 6900, sign: true }); + data.append(FP16x16 { mag: 13408, sign: false }); + data.append(FP16x16 { mag: 55598, sign: true }); + data.append(FP16x16 { mag: 13670, sign: false }); + data.append(FP16x16 { mag: 4231, sign: true }); + data.append(FP16x16 { mag: 47002, sign: true }); + data.append(FP16x16 { mag: 60663, sign: false }); + data.append(FP16x16 { mag: 26283, sign: false }); + data.append(FP16x16 { mag: 156112, sign: true }); + data.append(FP16x16 { mag: 9884, sign: true }); + data.append(FP16x16 { mag: 6926, sign: true }); + data.append(FP16x16 { mag: 8429, sign: true }); + data.append(FP16x16 { mag: 3327, sign: true }); + data.append(FP16x16 { mag: 45839, sign: true }); + data.append(FP16x16 { mag: 57187, sign: false }); + data.append(FP16x16 { mag: 110913, sign: true }); + data.append(FP16x16 { mag: 62795, sign: true }); + data.append(FP16x16 { mag: 109207, sign: false }); + data.append(FP16x16 { mag: 13215, sign: false }); + data.append(FP16x16 { mag: 38528, sign: true }); + data.append(FP16x16 { mag: 59562, sign: false }); + data.append(FP16x16 { mag: 26280, sign: true }); + data.append(FP16x16 { mag: 162194, sign: false }); + data.append(FP16x16 { mag: 61452, sign: false }); + data.append(FP16x16 { mag: 120157, sign: true }); + data.append(FP16x16 { mag: 50927, sign: false }); + data.append(FP16x16 { mag: 47813, sign: false }); + data.append(FP16x16 { mag: 62074, sign: false }); + data.append(FP16x16 { mag: 163638, sign: false }); + data.append(FP16x16 { mag: 21818, sign: true }); + data.append(FP16x16 { mag: 90475, sign: false }); + data.append(FP16x16 { mag: 32112, sign: true }); + data.append(FP16x16 { mag: 23172, sign: false }); + data.append(FP16x16 { mag: 71023, sign: true }); + data.append(FP16x16 { mag: 16348, sign: false }); + data.append(FP16x16 { mag: 28131, sign: false }); + data.append(FP16x16 { mag: 68181, sign: false }); + data.append(FP16x16 { mag: 192465, sign: false }); + data.append(FP16x16 { mag: 22889, sign: false }); + data.append(FP16x16 { mag: 16486, sign: false }); + data.append(FP16x16 { mag: 105533, sign: false }); + data.append(FP16x16 { mag: 6657, sign: true }); + data.append(FP16x16 { mag: 37792, sign: true }); + data.append(FP16x16 { mag: 48157, sign: true }); + data.append(FP16x16 { mag: 66040, sign: false }); + data.append(FP16x16 { mag: 12294, sign: true }); + data.append(FP16x16 { mag: 60649, sign: true }); + data.append(FP16x16 { mag: 42113, sign: true }); + data.append(FP16x16 { mag: 88843, sign: false }); + data.append(FP16x16 { mag: 3531, sign: false }); + data.append(FP16x16 { mag: 2708, sign: false }); + data.append(FP16x16 { mag: 93290, sign: true }); + data.append(FP16x16 { mag: 128, sign: false }); + data.append(FP16x16 { mag: 119266, sign: true }); + data.append(FP16x16 { mag: 37523, sign: false }); + data.append(FP16x16 { mag: 74254, sign: true }); + data.append(FP16x16 { mag: 155781, sign: true }); + data.append(FP16x16 { mag: 39485, sign: false }); + data.append(FP16x16 { mag: 16925, sign: false }); + data.append(FP16x16 { mag: 143362, sign: false }); + data.append(FP16x16 { mag: 77348, sign: false }); + data.append(FP16x16 { mag: 61642, sign: true }); + data.append(FP16x16 { mag: 134754, sign: false }); + data.append(FP16x16 { mag: 65160, sign: false }); + data.append(FP16x16 { mag: 48174, sign: true }); + data.append(FP16x16 { mag: 23831, sign: false }); + data.append(FP16x16 { mag: 70016, sign: true }); + data.append(FP16x16 { mag: 38627, sign: true }); + data.append(FP16x16 { mag: 71569, sign: true }); + data.append(FP16x16 { mag: 53240, sign: false }); + data.append(FP16x16 { mag: 123500, sign: false }); + data.append(FP16x16 { mag: 38397, sign: false }); + data.append(FP16x16 { mag: 105854, sign: false }); + data.append(FP16x16 { mag: 151153, sign: false }); + data.append(FP16x16 { mag: 30204, sign: false }); + data.append(FP16x16 { mag: 85564, sign: true }); + data.append(FP16x16 { mag: 13085, sign: false }); + data.append(FP16x16 { mag: 55281, sign: true }); + data.append(FP16x16 { mag: 11452, sign: false }); + data.append(FP16x16 { mag: 94698, sign: false }); + data.append(FP16x16 { mag: 113647, sign: false }); + data.append(FP16x16 { mag: 72099, sign: false }); + data.append(FP16x16 { mag: 9025, sign: false }); + data.append(FP16x16 { mag: 11985, sign: true }); + data.append(FP16x16 { mag: 159746, sign: false }); + data.append(FP16x16 { mag: 19273, sign: true }); + data.append(FP16x16 { mag: 23362, sign: false }); + data.append(FP16x16 { mag: 11488, sign: true }); + data.append(FP16x16 { mag: 86897, sign: true }); + data.append(FP16x16 { mag: 17484, sign: false }); + data.append(FP16x16 { mag: 35937, sign: false }); + data.append(FP16x16 { mag: 16572, sign: true }); + data.append(FP16x16 { mag: 47800, sign: true }); + data.append(FP16x16 { mag: 134172, sign: true }); + data.append(FP16x16 { mag: 14711, sign: true }); + data.append(FP16x16 { mag: 70361, sign: true }); + data.append(FP16x16 { mag: 33675, sign: true }); + data.append(FP16x16 { mag: 8412, sign: true }); + data.append(FP16x16 { mag: 59966, sign: true }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/maxpool_2d_same_upper_default/output_0.cairo b/tests/nodes/maxpool_2d_same_upper_default/output_0.cairo new file mode 100644 index 000000000..74103d3a1 --- /dev/null +++ b/tests/nodes/maxpool_2d_same_upper_default/output_0.cairo @@ -0,0 +1,207 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(3); + shape.append(8); + shape.append(8); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 28547, sign: false }); + data.append(FP16x16 { mag: 88529, sign: false }); + data.append(FP16x16 { mag: 88529, sign: false }); + data.append(FP16x16 { mag: 2290, sign: false }); + data.append(FP16x16 { mag: 92642, sign: false }); + data.append(FP16x16 { mag: 92642, sign: false }); + data.append(FP16x16 { mag: 25259, sign: false }); + data.append(FP16x16 { mag: 8291, sign: false }); + data.append(FP16x16 { mag: 17967, sign: false }); + data.append(FP16x16 { mag: 88529, sign: false }); + data.append(FP16x16 { mag: 88529, sign: false }); + data.append(FP16x16 { mag: 59101, sign: false }); + data.append(FP16x16 { mag: 92642, sign: false }); + data.append(FP16x16 { mag: 92642, sign: false }); + data.append(FP16x16 { mag: 25259, sign: false }); + data.append(FP16x16 { mag: 17818, sign: false }); + data.append(FP16x16 { mag: 2693, sign: false }); + data.append(FP16x16 { mag: 12737, sign: true }); + data.append(FP16x16 { mag: 65213, sign: false }); + data.append(FP16x16 { mag: 65213, sign: false }); + data.append(FP16x16 { mag: 59101, sign: false }); + data.append(FP16x16 { mag: 49974, sign: false }); + data.append(FP16x16 { mag: 117996, sign: false }); + data.append(FP16x16 { mag: 117996, sign: false }); + data.append(FP16x16 { mag: 43197, sign: false }); + data.append(FP16x16 { mag: 165019, sign: false }); + data.append(FP16x16 { mag: 165019, sign: false }); + data.append(FP16x16 { mag: 65213, sign: false }); + data.append(FP16x16 { mag: 49974, sign: false }); + data.append(FP16x16 { mag: 49974, sign: false }); + data.append(FP16x16 { mag: 117996, sign: false }); + data.append(FP16x16 { mag: 117996, sign: false }); + data.append(FP16x16 { mag: 43197, sign: false }); + data.append(FP16x16 { mag: 165019, sign: false }); + data.append(FP16x16 { mag: 165019, sign: false }); + data.append(FP16x16 { mag: 38570, sign: false }); + data.append(FP16x16 { mag: 163610, sign: false }); + data.append(FP16x16 { mag: 163610, sign: false }); + data.append(FP16x16 { mag: 47426, sign: false }); + data.append(FP16x16 { mag: 47426, sign: false }); + data.append(FP16x16 { mag: 27879, sign: false }); + data.append(FP16x16 { mag: 100009, sign: false }); + data.append(FP16x16 { mag: 100009, sign: false }); + data.append(FP16x16 { mag: 38570, sign: false }); + data.append(FP16x16 { mag: 163610, sign: false }); + data.append(FP16x16 { mag: 163610, sign: false }); + data.append(FP16x16 { mag: 46610, sign: false }); + data.append(FP16x16 { mag: 46610, sign: false }); + data.append(FP16x16 { mag: 27879, sign: false }); + data.append(FP16x16 { mag: 28554, sign: false }); + data.append(FP16x16 { mag: 68574, sign: false }); + data.append(FP16x16 { mag: 68574, sign: false }); + data.append(FP16x16 { mag: 77435, sign: false }); + data.append(FP16x16 { mag: 77435, sign: false }); + data.append(FP16x16 { mag: 2255, sign: true }); + data.append(FP16x16 { mag: 2255, sign: true }); + data.append(FP16x16 { mag: 27154, sign: false }); + data.append(FP16x16 { mag: 28554, sign: false }); + data.append(FP16x16 { mag: 68574, sign: false }); + data.append(FP16x16 { mag: 68574, sign: false }); + data.append(FP16x16 { mag: 10013, sign: false }); + data.append(FP16x16 { mag: 51289, sign: true }); + data.append(FP16x16 { mag: 51289, sign: true }); + data.append(FP16x16 { mag: 104200, sign: true }); + data.append(FP16x16 { mag: 49102, sign: false }); + data.append(FP16x16 { mag: 73473, sign: false }); + data.append(FP16x16 { mag: 73473, sign: false }); + data.append(FP16x16 { mag: 45735, sign: false }); + data.append(FP16x16 { mag: 73626, sign: false }); + data.append(FP16x16 { mag: 73626, sign: false }); + data.append(FP16x16 { mag: 54632, sign: false }); + data.append(FP16x16 { mag: 17482, sign: true }); + data.append(FP16x16 { mag: 20472, sign: false }); + data.append(FP16x16 { mag: 20472, sign: false }); + data.append(FP16x16 { mag: 19723, sign: false }); + data.append(FP16x16 { mag: 45735, sign: false }); + data.append(FP16x16 { mag: 73626, sign: false }); + data.append(FP16x16 { mag: 73626, sign: false }); + data.append(FP16x16 { mag: 52619, sign: false }); + data.append(FP16x16 { mag: 52619, sign: false }); + data.append(FP16x16 { mag: 4590, sign: false }); + data.append(FP16x16 { mag: 7840, sign: false }); + data.append(FP16x16 { mag: 7840, sign: false }); + data.append(FP16x16 { mag: 55620, sign: false }); + data.append(FP16x16 { mag: 56413, sign: false }); + data.append(FP16x16 { mag: 56413, sign: false }); + data.append(FP16x16 { mag: 52619, sign: false }); + data.append(FP16x16 { mag: 52619, sign: false }); + data.append(FP16x16 { mag: 13670, sign: false }); + data.append(FP16x16 { mag: 4231, sign: true }); + data.append(FP16x16 { mag: 60663, sign: false }); + data.append(FP16x16 { mag: 60663, sign: false }); + data.append(FP16x16 { mag: 55620, sign: false }); + data.append(FP16x16 { mag: 13408, sign: false }); + data.append(FP16x16 { mag: 13408, sign: false }); + data.append(FP16x16 { mag: 6926, sign: true }); + data.append(FP16x16 { mag: 13670, sign: false }); + data.append(FP16x16 { mag: 3327, sign: true }); + data.append(FP16x16 { mag: 60663, sign: false }); + data.append(FP16x16 { mag: 60663, sign: false }); + data.append(FP16x16 { mag: 26283, sign: false }); + data.append(FP16x16 { mag: 109207, sign: false }); + data.append(FP16x16 { mag: 109207, sign: false }); + data.append(FP16x16 { mag: 13215, sign: false }); + data.append(FP16x16 { mag: 59562, sign: false }); + data.append(FP16x16 { mag: 59562, sign: false }); + data.append(FP16x16 { mag: 162194, sign: false }); + data.append(FP16x16 { mag: 162194, sign: false }); + data.append(FP16x16 { mag: 61452, sign: false }); + data.append(FP16x16 { mag: 109207, sign: false }); + data.append(FP16x16 { mag: 109207, sign: false }); + data.append(FP16x16 { mag: 47813, sign: false }); + data.append(FP16x16 { mag: 163638, sign: false }); + data.append(FP16x16 { mag: 163638, sign: false }); + data.append(FP16x16 { mag: 162194, sign: false }); + data.append(FP16x16 { mag: 162194, sign: false }); + data.append(FP16x16 { mag: 61452, sign: false }); + data.append(FP16x16 { mag: 50927, sign: false }); + data.append(FP16x16 { mag: 50927, sign: false }); + data.append(FP16x16 { mag: 47813, sign: false }); + data.append(FP16x16 { mag: 163638, sign: false }); + data.append(FP16x16 { mag: 163638, sign: false }); + data.append(FP16x16 { mag: 90475, sign: false }); + data.append(FP16x16 { mag: 90475, sign: false }); + data.append(FP16x16 { mag: 23172, sign: false }); + data.append(FP16x16 { mag: 23172, sign: false }); + data.append(FP16x16 { mag: 16348, sign: false }); + data.append(FP16x16 { mag: 16348, sign: false }); + data.append(FP16x16 { mag: 68181, sign: false }); + data.append(FP16x16 { mag: 192465, sign: false }); + data.append(FP16x16 { mag: 192465, sign: false }); + data.append(FP16x16 { mag: 22889, sign: false }); + data.append(FP16x16 { mag: 105533, sign: false }); + data.append(FP16x16 { mag: 105533, sign: false }); + data.append(FP16x16 { mag: 3531, sign: false }); + data.append(FP16x16 { mag: 2708, sign: false }); + data.append(FP16x16 { mag: 66040, sign: false }); + data.append(FP16x16 { mag: 66040, sign: false }); + data.append(FP16x16 { mag: 37523, sign: false }); + data.append(FP16x16 { mag: 37523, sign: false }); + data.append(FP16x16 { mag: 88843, sign: false }); + data.append(FP16x16 { mag: 88843, sign: false }); + data.append(FP16x16 { mag: 39485, sign: false }); + data.append(FP16x16 { mag: 16925, sign: false }); + data.append(FP16x16 { mag: 143362, sign: false }); + data.append(FP16x16 { mag: 77348, sign: false }); + data.append(FP16x16 { mag: 134754, sign: false }); + data.append(FP16x16 { mag: 134754, sign: false }); + data.append(FP16x16 { mag: 65160, sign: false }); + data.append(FP16x16 { mag: 39485, sign: false }); + data.append(FP16x16 { mag: 39485, sign: false }); + data.append(FP16x16 { mag: 16925, sign: false }); + data.append(FP16x16 { mag: 143362, sign: false }); + data.append(FP16x16 { mag: 77348, sign: false }); + data.append(FP16x16 { mag: 134754, sign: false }); + data.append(FP16x16 { mag: 134754, sign: false }); + data.append(FP16x16 { mag: 105854, sign: false }); + data.append(FP16x16 { mag: 151153, sign: false }); + data.append(FP16x16 { mag: 151153, sign: false }); + data.append(FP16x16 { mag: 30204, sign: false }); + data.append(FP16x16 { mag: 13085, sign: false }); + data.append(FP16x16 { mag: 53240, sign: false }); + data.append(FP16x16 { mag: 123500, sign: false }); + data.append(FP16x16 { mag: 123500, sign: false }); + data.append(FP16x16 { mag: 113647, sign: false }); + data.append(FP16x16 { mag: 151153, sign: false }); + data.append(FP16x16 { mag: 151153, sign: false }); + data.append(FP16x16 { mag: 30204, sign: false }); + data.append(FP16x16 { mag: 159746, sign: false }); + data.append(FP16x16 { mag: 159746, sign: false }); + data.append(FP16x16 { mag: 23362, sign: false }); + data.append(FP16x16 { mag: 94698, sign: false }); + data.append(FP16x16 { mag: 113647, sign: false }); + data.append(FP16x16 { mag: 113647, sign: false }); + data.append(FP16x16 { mag: 72099, sign: false }); + data.append(FP16x16 { mag: 35937, sign: false }); + data.append(FP16x16 { mag: 159746, sign: false }); + data.append(FP16x16 { mag: 159746, sign: false }); + data.append(FP16x16 { mag: 23362, sign: false }); + data.append(FP16x16 { mag: 23362, sign: false }); + data.append(FP16x16 { mag: 11488, sign: true }); + data.append(FP16x16 { mag: 17484, sign: false }); + data.append(FP16x16 { mag: 35937, sign: false }); + data.append(FP16x16 { mag: 35937, sign: false }); + data.append(FP16x16 { mag: 16572, sign: true }); + data.append(FP16x16 { mag: 47800, sign: true }); + data.append(FP16x16 { mag: 14711, sign: true }); + data.append(FP16x16 { mag: 14711, sign: true }); + data.append(FP16x16 { mag: 33675, sign: true }); + data.append(FP16x16 { mag: 8412, sign: true }); + data.append(FP16x16 { mag: 8412, sign: true }); + data.append(FP16x16 { mag: 59966, sign: true }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/maxpool_3d_dilations.cairo b/tests/nodes/maxpool_3d_dilations.cairo new file mode 100644 index 000000000..f7aafbfc7 --- /dev/null +++ b/tests/nodes/maxpool_3d_dilations.cairo @@ -0,0 +1,30 @@ +mod input_0; +mod output_0; + + +use orion::operators::nn::NNTrait; +use orion::numbers::FixedTrait; +use orion::operators::tensor::FP16x16TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::nn::FP16x16NN; + +#[test] +#[available_gas(2000000000)] +fn test_maxpool_3d_dilations() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let (y_0, _) = NNTrait::max_pool( + @input_0, + Option::None, + Option::None, + Option::Some(array![2, 2, 2].span()), + array![2, 2, 2].span(), + Option::None, + Option::None, + Option::Some(array![1, 1, 1].span()), + 1 + ); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/maxpool_3d_dilations/input_0.cairo b/tests/nodes/maxpool_3d_dilations/input_0.cairo new file mode 100644 index 000000000..a094e9312 --- /dev/null +++ b/tests/nodes/maxpool_3d_dilations/input_0.cairo @@ -0,0 +1,80 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(1); + shape.append(4); + shape.append(4); + shape.append(4); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 262144, sign: false }); + data.append(FP16x16 { mag: 327680, sign: false }); + data.append(FP16x16 { mag: 393216, sign: false }); + data.append(FP16x16 { mag: 458752, sign: false }); + data.append(FP16x16 { mag: 524288, sign: false }); + data.append(FP16x16 { mag: 589824, sign: false }); + data.append(FP16x16 { mag: 655360, sign: false }); + data.append(FP16x16 { mag: 720896, sign: false }); + data.append(FP16x16 { mag: 786432, sign: false }); + data.append(FP16x16 { mag: 851968, sign: false }); + data.append(FP16x16 { mag: 917504, sign: false }); + data.append(FP16x16 { mag: 983040, sign: false }); + data.append(FP16x16 { mag: 1048576, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 262144, sign: false }); + data.append(FP16x16 { mag: 327680, sign: false }); + data.append(FP16x16 { mag: 393216, sign: false }); + data.append(FP16x16 { mag: 458752, sign: false }); + data.append(FP16x16 { mag: 524288, sign: false }); + data.append(FP16x16 { mag: 589824, sign: false }); + data.append(FP16x16 { mag: 655360, sign: false }); + data.append(FP16x16 { mag: 720896, sign: false }); + data.append(FP16x16 { mag: 786432, sign: false }); + data.append(FP16x16 { mag: 851968, sign: false }); + data.append(FP16x16 { mag: 917504, sign: false }); + data.append(FP16x16 { mag: 983040, sign: false }); + data.append(FP16x16 { mag: 1048576, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 262144, sign: false }); + data.append(FP16x16 { mag: 327680, sign: false }); + data.append(FP16x16 { mag: 393216, sign: false }); + data.append(FP16x16 { mag: 458752, sign: false }); + data.append(FP16x16 { mag: 524288, sign: false }); + data.append(FP16x16 { mag: 589824, sign: false }); + data.append(FP16x16 { mag: 655360, sign: false }); + data.append(FP16x16 { mag: 720896, sign: false }); + data.append(FP16x16 { mag: 786432, sign: false }); + data.append(FP16x16 { mag: 851968, sign: false }); + data.append(FP16x16 { mag: 917504, sign: false }); + data.append(FP16x16 { mag: 983040, sign: false }); + data.append(FP16x16 { mag: 1048576, sign: false }); + data.append(FP16x16 { mag: 65536, sign: false }); + data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 262144, sign: false }); + data.append(FP16x16 { mag: 327680, sign: false }); + data.append(FP16x16 { mag: 393216, sign: false }); + data.append(FP16x16 { mag: 458752, sign: false }); + data.append(FP16x16 { mag: 524288, sign: false }); + data.append(FP16x16 { mag: 589824, sign: false }); + data.append(FP16x16 { mag: 655360, sign: false }); + data.append(FP16x16 { mag: 720896, sign: false }); + data.append(FP16x16 { mag: 786432, sign: false }); + data.append(FP16x16 { mag: 851968, sign: false }); + data.append(FP16x16 { mag: 917504, sign: false }); + data.append(FP16x16 { mag: 983040, sign: false }); + data.append(FP16x16 { mag: 1048576, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/maxpool_3d_dilations/output_0.cairo b/tests/nodes/maxpool_3d_dilations/output_0.cairo new file mode 100644 index 000000000..c755b5052 --- /dev/null +++ b/tests/nodes/maxpool_3d_dilations/output_0.cairo @@ -0,0 +1,24 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(1); + shape.append(2); + shape.append(2); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 720896, sign: false }); + data.append(FP16x16 { mag: 786432, sign: false }); + data.append(FP16x16 { mag: 983040, sign: false }); + data.append(FP16x16 { mag: 1048576, sign: false }); + data.append(FP16x16 { mag: 720896, sign: false }); + data.append(FP16x16 { mag: 786432, sign: false }); + data.append(FP16x16 { mag: 983040, sign: false }); + data.append(FP16x16 { mag: 1048576, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/maxpool_4d_dilations.cairo b/tests/nodes/maxpool_4d_dilations.cairo new file mode 100644 index 000000000..0ad3072ab --- /dev/null +++ b/tests/nodes/maxpool_4d_dilations.cairo @@ -0,0 +1,30 @@ +mod input_0; +mod output_0; + + +use orion::operators::nn::NNTrait; +use orion::numbers::FixedTrait; +use orion::operators::tensor::FP16x16TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::nn::FP16x16NN; + +#[test] +#[available_gas(2000000000)] +fn test_maxpool_4d_dilations() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let (y_0, _) = NNTrait::max_pool( + @input_0, + Option::None, + Option::None, + Option::Some(array![2, 2, 2, 2].span()), + array![2, 2, 2, 2].span(), + Option::None, + Option::None, + Option::None, + 1 + ); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/maxpool_4d_dilations/input_0.cairo b/tests/nodes/maxpool_4d_dilations/input_0.cairo new file mode 100644 index 000000000..3716a1363 --- /dev/null +++ b/tests/nodes/maxpool_4d_dilations/input_0.cairo @@ -0,0 +1,785 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(3); + shape.append(4); + shape.append(4); + shape.append(4); + shape.append(4); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 57326, sign: true }); + data.append(FP16x16 { mag: 21730, sign: true }); + data.append(FP16x16 { mag: 42582, sign: false }); + data.append(FP16x16 { mag: 39862, sign: false }); + data.append(FP16x16 { mag: 33772, sign: false }); + data.append(FP16x16 { mag: 85813, sign: false }); + data.append(FP16x16 { mag: 53862, sign: false }); + data.append(FP16x16 { mag: 172442, sign: false }); + data.append(FP16x16 { mag: 49149, sign: false }); + data.append(FP16x16 { mag: 22905, sign: true }); + data.append(FP16x16 { mag: 33282, sign: true }); + data.append(FP16x16 { mag: 16327, sign: true }); + data.append(FP16x16 { mag: 107261, sign: true }); + data.append(FP16x16 { mag: 46347, sign: true }); + data.append(FP16x16 { mag: 6995, sign: true }); + data.append(FP16x16 { mag: 24181, sign: false }); + data.append(FP16x16 { mag: 104507, sign: false }); + data.append(FP16x16 { mag: 30885, sign: false }); + data.append(FP16x16 { mag: 171591, sign: false }); + data.append(FP16x16 { mag: 11569, sign: true }); + data.append(FP16x16 { mag: 8237, sign: false }); + data.append(FP16x16 { mag: 36041, sign: false }); + data.append(FP16x16 { mag: 70645, sign: true }); + data.append(FP16x16 { mag: 193719, sign: false }); + data.append(FP16x16 { mag: 69351, sign: true }); + data.append(FP16x16 { mag: 28229, sign: false }); + data.append(FP16x16 { mag: 52027, sign: true }); + data.append(FP16x16 { mag: 13767, sign: true }); + data.append(FP16x16 { mag: 11650, sign: false }); + data.append(FP16x16 { mag: 10048, sign: true }); + data.append(FP16x16 { mag: 101266, sign: false }); + data.append(FP16x16 { mag: 61859, sign: true }); + data.append(FP16x16 { mag: 21139, sign: true }); + data.append(FP16x16 { mag: 77012, sign: false }); + data.append(FP16x16 { mag: 10808, sign: false }); + data.append(FP16x16 { mag: 38568, sign: true }); + data.append(FP16x16 { mag: 117829, sign: false }); + data.append(FP16x16 { mag: 65427, sign: true }); + data.append(FP16x16 { mag: 32883, sign: false }); + data.append(FP16x16 { mag: 88408, sign: true }); + data.append(FP16x16 { mag: 30189, sign: true }); + data.append(FP16x16 { mag: 134656, sign: true }); + data.append(FP16x16 { mag: 63780, sign: true }); + data.append(FP16x16 { mag: 26968, sign: false }); + data.append(FP16x16 { mag: 17303, sign: false }); + data.append(FP16x16 { mag: 58933, sign: true }); + data.append(FP16x16 { mag: 22852, sign: false }); + data.append(FP16x16 { mag: 46707, sign: true }); + data.append(FP16x16 { mag: 44311, sign: true }); + data.append(FP16x16 { mag: 67011, sign: true }); + data.append(FP16x16 { mag: 17975, sign: true }); + data.append(FP16x16 { mag: 19940, sign: true }); + data.append(FP16x16 { mag: 26874, sign: false }); + data.append(FP16x16 { mag: 77148, sign: true }); + data.append(FP16x16 { mag: 1260, sign: false }); + data.append(FP16x16 { mag: 39435, sign: true }); + data.append(FP16x16 { mag: 57637, sign: true }); + data.append(FP16x16 { mag: 70584, sign: true }); + data.append(FP16x16 { mag: 90946, sign: false }); + data.append(FP16x16 { mag: 120636, sign: true }); + data.append(FP16x16 { mag: 44169, sign: false }); + data.append(FP16x16 { mag: 20822, sign: true }); + data.append(FP16x16 { mag: 9217, sign: true }); + data.append(FP16x16 { mag: 56642, sign: true }); + data.append(FP16x16 { mag: 32615, sign: false }); + data.append(FP16x16 { mag: 56213, sign: false }); + data.append(FP16x16 { mag: 20292, sign: true }); + data.append(FP16x16 { mag: 67358, sign: true }); + data.append(FP16x16 { mag: 94393, sign: true }); + data.append(FP16x16 { mag: 39525, sign: true }); + data.append(FP16x16 { mag: 117822, sign: false }); + data.append(FP16x16 { mag: 63929, sign: false }); + data.append(FP16x16 { mag: 2412, sign: true }); + data.append(FP16x16 { mag: 35782, sign: true }); + data.append(FP16x16 { mag: 42346, sign: true }); + data.append(FP16x16 { mag: 57619, sign: true }); + data.append(FP16x16 { mag: 76605, sign: false }); + data.append(FP16x16 { mag: 55629, sign: true }); + data.append(FP16x16 { mag: 26508, sign: true }); + data.append(FP16x16 { mag: 31496, sign: true }); + data.append(FP16x16 { mag: 29971, sign: false }); + data.append(FP16x16 { mag: 1317, sign: true }); + data.append(FP16x16 { mag: 86516, sign: true }); + data.append(FP16x16 { mag: 48878, sign: true }); + data.append(FP16x16 { mag: 91296, sign: true }); + data.append(FP16x16 { mag: 80537, sign: false }); + data.append(FP16x16 { mag: 143126, sign: true }); + data.append(FP16x16 { mag: 35843, sign: false }); + data.append(FP16x16 { mag: 794, sign: true }); + data.append(FP16x16 { mag: 4465, sign: true }); + data.append(FP16x16 { mag: 44772, sign: false }); + data.append(FP16x16 { mag: 114134, sign: false }); + data.append(FP16x16 { mag: 34012, sign: true }); + data.append(FP16x16 { mag: 81192, sign: false }); + data.append(FP16x16 { mag: 68824, sign: false }); + data.append(FP16x16 { mag: 35529, sign: true }); + data.append(FP16x16 { mag: 48725, sign: true }); + data.append(FP16x16 { mag: 48274, sign: true }); + data.append(FP16x16 { mag: 97602, sign: false }); + data.append(FP16x16 { mag: 18341, sign: true }); + data.append(FP16x16 { mag: 31756, sign: false }); + data.append(FP16x16 { mag: 79390, sign: false }); + data.append(FP16x16 { mag: 72973, sign: false }); + data.append(FP16x16 { mag: 1249, sign: true }); + data.append(FP16x16 { mag: 6551, sign: false }); + data.append(FP16x16 { mag: 41473, sign: false }); + data.append(FP16x16 { mag: 6590, sign: true }); + data.append(FP16x16 { mag: 31148, sign: true }); + data.append(FP16x16 { mag: 54083, sign: false }); + data.append(FP16x16 { mag: 11225, sign: false }); + data.append(FP16x16 { mag: 27239, sign: false }); + data.append(FP16x16 { mag: 26555, sign: false }); + data.append(FP16x16 { mag: 17820, sign: true }); + data.append(FP16x16 { mag: 122, sign: true }); + data.append(FP16x16 { mag: 67786, sign: false }); + data.append(FP16x16 { mag: 71452, sign: true }); + data.append(FP16x16 { mag: 84467, sign: true }); + data.append(FP16x16 { mag: 38713, sign: true }); + data.append(FP16x16 { mag: 84330, sign: false }); + data.append(FP16x16 { mag: 37483, sign: false }); + data.append(FP16x16 { mag: 93738, sign: false }); + data.append(FP16x16 { mag: 5609, sign: false }); + data.append(FP16x16 { mag: 32866, sign: true }); + data.append(FP16x16 { mag: 112546, sign: true }); + data.append(FP16x16 { mag: 109193, sign: true }); + data.append(FP16x16 { mag: 4021, sign: false }); + data.append(FP16x16 { mag: 57369, sign: false }); + data.append(FP16x16 { mag: 26880, sign: true }); + data.append(FP16x16 { mag: 28676, sign: false }); + data.append(FP16x16 { mag: 21352, sign: false }); + data.append(FP16x16 { mag: 19899, sign: false }); + data.append(FP16x16 { mag: 25250, sign: false }); + data.append(FP16x16 { mag: 17564, sign: false }); + data.append(FP16x16 { mag: 73191, sign: true }); + data.append(FP16x16 { mag: 15444, sign: false }); + data.append(FP16x16 { mag: 3166, sign: false }); + data.append(FP16x16 { mag: 58258, sign: true }); + data.append(FP16x16 { mag: 20879, sign: true }); + data.append(FP16x16 { mag: 39604, sign: false }); + data.append(FP16x16 { mag: 81651, sign: true }); + data.append(FP16x16 { mag: 91451, sign: false }); + data.append(FP16x16 { mag: 58072, sign: false }); + data.append(FP16x16 { mag: 131524, sign: false }); + data.append(FP16x16 { mag: 32727, sign: false }); + data.append(FP16x16 { mag: 165314, sign: false }); + data.append(FP16x16 { mag: 4141, sign: true }); + data.append(FP16x16 { mag: 14668, sign: false }); + data.append(FP16x16 { mag: 124609, sign: false }); + data.append(FP16x16 { mag: 33880, sign: false }); + data.append(FP16x16 { mag: 180279, sign: false }); + data.append(FP16x16 { mag: 23806, sign: true }); + data.append(FP16x16 { mag: 33978, sign: false }); + data.append(FP16x16 { mag: 102278, sign: false }); + data.append(FP16x16 { mag: 91608, sign: true }); + data.append(FP16x16 { mag: 81589, sign: false }); + data.append(FP16x16 { mag: 55843, sign: true }); + data.append(FP16x16 { mag: 70024, sign: true }); + data.append(FP16x16 { mag: 30011, sign: true }); + data.append(FP16x16 { mag: 18673, sign: false }); + data.append(FP16x16 { mag: 17510, sign: true }); + data.append(FP16x16 { mag: 94591, sign: true }); + data.append(FP16x16 { mag: 83587, sign: true }); + data.append(FP16x16 { mag: 80327, sign: true }); + data.append(FP16x16 { mag: 58704, sign: true }); + data.append(FP16x16 { mag: 12647, sign: true }); + data.append(FP16x16 { mag: 119066, sign: false }); + data.append(FP16x16 { mag: 24450, sign: true }); + data.append(FP16x16 { mag: 73352, sign: true }); + data.append(FP16x16 { mag: 37058, sign: false }); + data.append(FP16x16 { mag: 21557, sign: false }); + data.append(FP16x16 { mag: 20631, sign: true }); + data.append(FP16x16 { mag: 93230, sign: false }); + data.append(FP16x16 { mag: 49743, sign: true }); + data.append(FP16x16 { mag: 33398, sign: false }); + data.append(FP16x16 { mag: 30495, sign: false }); + data.append(FP16x16 { mag: 69280, sign: true }); + data.append(FP16x16 { mag: 11759, sign: true }); + data.append(FP16x16 { mag: 87054, sign: false }); + data.append(FP16x16 { mag: 66395, sign: false }); + data.append(FP16x16 { mag: 20819, sign: false }); + data.append(FP16x16 { mag: 107561, sign: false }); + data.append(FP16x16 { mag: 24839, sign: false }); + data.append(FP16x16 { mag: 101166, sign: true }); + data.append(FP16x16 { mag: 4674, sign: true }); + data.append(FP16x16 { mag: 15294, sign: false }); + data.append(FP16x16 { mag: 14943, sign: false }); + data.append(FP16x16 { mag: 7494, sign: false }); + data.append(FP16x16 { mag: 83926, sign: false }); + data.append(FP16x16 { mag: 127871, sign: true }); + data.append(FP16x16 { mag: 87804, sign: false }); + data.append(FP16x16 { mag: 79905, sign: false }); + data.append(FP16x16 { mag: 82486, sign: false }); + data.append(FP16x16 { mag: 23065, sign: true }); + data.append(FP16x16 { mag: 14517, sign: false }); + data.append(FP16x16 { mag: 146450, sign: true }); + data.append(FP16x16 { mag: 78522, sign: true }); + data.append(FP16x16 { mag: 50973, sign: false }); + data.append(FP16x16 { mag: 59565, sign: false }); + data.append(FP16x16 { mag: 75649, sign: false }); + data.append(FP16x16 { mag: 37180, sign: false }); + data.append(FP16x16 { mag: 10656, sign: true }); + data.append(FP16x16 { mag: 20803, sign: false }); + data.append(FP16x16 { mag: 19563, sign: true }); + data.append(FP16x16 { mag: 27034, sign: false }); + data.append(FP16x16 { mag: 14241, sign: true }); + data.append(FP16x16 { mag: 27342, sign: false }); + data.append(FP16x16 { mag: 15449, sign: false }); + data.append(FP16x16 { mag: 54417, sign: false }); + data.append(FP16x16 { mag: 28698, sign: false }); + data.append(FP16x16 { mag: 10291, sign: false }); + data.append(FP16x16 { mag: 78630, sign: true }); + data.append(FP16x16 { mag: 54471, sign: false }); + data.append(FP16x16 { mag: 63909, sign: false }); + data.append(FP16x16 { mag: 155625, sign: true }); + data.append(FP16x16 { mag: 46452, sign: true }); + data.append(FP16x16 { mag: 85081, sign: true }); + data.append(FP16x16 { mag: 149800, sign: true }); + data.append(FP16x16 { mag: 83814, sign: true }); + data.append(FP16x16 { mag: 13220, sign: true }); + data.append(FP16x16 { mag: 105580, sign: true }); + data.append(FP16x16 { mag: 45775, sign: false }); + data.append(FP16x16 { mag: 81027, sign: false }); + data.append(FP16x16 { mag: 45746, sign: false }); + data.append(FP16x16 { mag: 20454, sign: true }); + data.append(FP16x16 { mag: 54633, sign: false }); + data.append(FP16x16 { mag: 58097, sign: false }); + data.append(FP16x16 { mag: 51893, sign: true }); + data.append(FP16x16 { mag: 537, sign: false }); + data.append(FP16x16 { mag: 47389, sign: false }); + data.append(FP16x16 { mag: 7725, sign: false }); + data.append(FP16x16 { mag: 64559, sign: false }); + data.append(FP16x16 { mag: 120617, sign: true }); + data.append(FP16x16 { mag: 13069, sign: true }); + data.append(FP16x16 { mag: 13012, sign: false }); + data.append(FP16x16 { mag: 64929, sign: false }); + data.append(FP16x16 { mag: 13880, sign: true }); + data.append(FP16x16 { mag: 29696, sign: false }); + data.append(FP16x16 { mag: 23484, sign: true }); + data.append(FP16x16 { mag: 78538, sign: true }); + data.append(FP16x16 { mag: 108676, sign: true }); + data.append(FP16x16 { mag: 30019, sign: false }); + data.append(FP16x16 { mag: 17931, sign: true }); + data.append(FP16x16 { mag: 27085, sign: false }); + data.append(FP16x16 { mag: 24850, sign: false }); + data.append(FP16x16 { mag: 12153, sign: false }); + data.append(FP16x16 { mag: 11538, sign: true }); + data.append(FP16x16 { mag: 69066, sign: true }); + data.append(FP16x16 { mag: 12725, sign: false }); + data.append(FP16x16 { mag: 37986, sign: false }); + data.append(FP16x16 { mag: 53389, sign: true }); + data.append(FP16x16 { mag: 114518, sign: true }); + data.append(FP16x16 { mag: 74200, sign: true }); + data.append(FP16x16 { mag: 54403, sign: true }); + data.append(FP16x16 { mag: 31396, sign: false }); + data.append(FP16x16 { mag: 40194, sign: false }); + data.append(FP16x16 { mag: 9643, sign: false }); + data.append(FP16x16 { mag: 29485, sign: true }); + data.append(FP16x16 { mag: 12679, sign: false }); + data.append(FP16x16 { mag: 15850, sign: true }); + data.append(FP16x16 { mag: 39421, sign: true }); + data.append(FP16x16 { mag: 88854, sign: false }); + data.append(FP16x16 { mag: 1130, sign: false }); + data.append(FP16x16 { mag: 16366, sign: true }); + data.append(FP16x16 { mag: 33087, sign: true }); + data.append(FP16x16 { mag: 28745, sign: true }); + data.append(FP16x16 { mag: 3488, sign: false }); + data.append(FP16x16 { mag: 59008, sign: true }); + data.append(FP16x16 { mag: 4364, sign: false }); + data.append(FP16x16 { mag: 42280, sign: true }); + data.append(FP16x16 { mag: 100073, sign: true }); + data.append(FP16x16 { mag: 4958, sign: true }); + data.append(FP16x16 { mag: 37532, sign: true }); + data.append(FP16x16 { mag: 30930, sign: false }); + data.append(FP16x16 { mag: 29580, sign: true }); + data.append(FP16x16 { mag: 930, sign: true }); + data.append(FP16x16 { mag: 4486, sign: true }); + data.append(FP16x16 { mag: 82232, sign: true }); + data.append(FP16x16 { mag: 47028, sign: true }); + data.append(FP16x16 { mag: 8929, sign: false }); + data.append(FP16x16 { mag: 70968, sign: false }); + data.append(FP16x16 { mag: 38614, sign: true }); + data.append(FP16x16 { mag: 57990, sign: true }); + data.append(FP16x16 { mag: 51540, sign: true }); + data.append(FP16x16 { mag: 15430, sign: true }); + data.append(FP16x16 { mag: 60366, sign: true }); + data.append(FP16x16 { mag: 26896, sign: false }); + data.append(FP16x16 { mag: 55881, sign: false }); + data.append(FP16x16 { mag: 37730, sign: false }); + data.append(FP16x16 { mag: 1519, sign: true }); + data.append(FP16x16 { mag: 41072, sign: true }); + data.append(FP16x16 { mag: 70626, sign: true }); + data.append(FP16x16 { mag: 80140, sign: false }); + data.append(FP16x16 { mag: 48666, sign: true }); + data.append(FP16x16 { mag: 63754, sign: true }); + data.append(FP16x16 { mag: 64494, sign: true }); + data.append(FP16x16 { mag: 75672, sign: false }); + data.append(FP16x16 { mag: 39394, sign: true }); + data.append(FP16x16 { mag: 39881, sign: false }); + data.append(FP16x16 { mag: 23064, sign: true }); + data.append(FP16x16 { mag: 14821, sign: false }); + data.append(FP16x16 { mag: 27344, sign: true }); + data.append(FP16x16 { mag: 14728, sign: false }); + data.append(FP16x16 { mag: 59112, sign: true }); + data.append(FP16x16 { mag: 93610, sign: false }); + data.append(FP16x16 { mag: 80804, sign: true }); + data.append(FP16x16 { mag: 31174, sign: false }); + data.append(FP16x16 { mag: 31687, sign: true }); + data.append(FP16x16 { mag: 92103, sign: false }); + data.append(FP16x16 { mag: 84394, sign: false }); + data.append(FP16x16 { mag: 85999, sign: true }); + data.append(FP16x16 { mag: 93667, sign: true }); + data.append(FP16x16 { mag: 124722, sign: false }); + data.append(FP16x16 { mag: 29792, sign: true }); + data.append(FP16x16 { mag: 1719, sign: true }); + data.append(FP16x16 { mag: 10265, sign: false }); + data.append(FP16x16 { mag: 98163, sign: false }); + data.append(FP16x16 { mag: 44203, sign: false }); + data.append(FP16x16 { mag: 25672, sign: true }); + data.append(FP16x16 { mag: 92499, sign: false }); + data.append(FP16x16 { mag: 71127, sign: false }); + data.append(FP16x16 { mag: 107167, sign: true }); + data.append(FP16x16 { mag: 58795, sign: false }); + data.append(FP16x16 { mag: 33710, sign: false }); + data.append(FP16x16 { mag: 59629, sign: true }); + data.append(FP16x16 { mag: 12862, sign: false }); + data.append(FP16x16 { mag: 77599, sign: true }); + data.append(FP16x16 { mag: 2634, sign: false }); + data.append(FP16x16 { mag: 30404, sign: true }); + data.append(FP16x16 { mag: 34664, sign: false }); + data.append(FP16x16 { mag: 123236, sign: false }); + data.append(FP16x16 { mag: 9552, sign: false }); + data.append(FP16x16 { mag: 1400, sign: true }); + data.append(FP16x16 { mag: 57199, sign: true }); + data.append(FP16x16 { mag: 56490, sign: false }); + data.append(FP16x16 { mag: 15372, sign: false }); + data.append(FP16x16 { mag: 39428, sign: true }); + data.append(FP16x16 { mag: 22812, sign: true }); + data.append(FP16x16 { mag: 131564, sign: false }); + data.append(FP16x16 { mag: 119458, sign: true }); + data.append(FP16x16 { mag: 45170, sign: true }); + data.append(FP16x16 { mag: 59265, sign: false }); + data.append(FP16x16 { mag: 45955, sign: true }); + data.append(FP16x16 { mag: 54566, sign: true }); + data.append(FP16x16 { mag: 38354, sign: false }); + data.append(FP16x16 { mag: 138628, sign: true }); + data.append(FP16x16 { mag: 54243, sign: true }); + data.append(FP16x16 { mag: 47436, sign: false }); + data.append(FP16x16 { mag: 58880, sign: true }); + data.append(FP16x16 { mag: 48381, sign: false }); + data.append(FP16x16 { mag: 33455, sign: false }); + data.append(FP16x16 { mag: 38625, sign: false }); + data.append(FP16x16 { mag: 107342, sign: true }); + data.append(FP16x16 { mag: 46976, sign: false }); + data.append(FP16x16 { mag: 84206, sign: true }); + data.append(FP16x16 { mag: 29355, sign: false }); + data.append(FP16x16 { mag: 63176, sign: false }); + data.append(FP16x16 { mag: 34330, sign: true }); + data.append(FP16x16 { mag: 65025, sign: false }); + data.append(FP16x16 { mag: 25751, sign: true }); + data.append(FP16x16 { mag: 17809, sign: false }); + data.append(FP16x16 { mag: 22890, sign: false }); + data.append(FP16x16 { mag: 57565, sign: true }); + data.append(FP16x16 { mag: 16208, sign: false }); + data.append(FP16x16 { mag: 134370, sign: true }); + data.append(FP16x16 { mag: 58594, sign: false }); + data.append(FP16x16 { mag: 11743, sign: true }); + data.append(FP16x16 { mag: 44532, sign: true }); + data.append(FP16x16 { mag: 117474, sign: true }); + data.append(FP16x16 { mag: 44774, sign: false }); + data.append(FP16x16 { mag: 120360, sign: false }); + data.append(FP16x16 { mag: 28815, sign: false }); + data.append(FP16x16 { mag: 9241, sign: true }); + data.append(FP16x16 { mag: 25010, sign: false }); + data.append(FP16x16 { mag: 26794, sign: true }); + data.append(FP16x16 { mag: 36699, sign: true }); + data.append(FP16x16 { mag: 1476, sign: true }); + data.append(FP16x16 { mag: 39151, sign: true }); + data.append(FP16x16 { mag: 55160, sign: false }); + data.append(FP16x16 { mag: 51197, sign: false }); + data.append(FP16x16 { mag: 41092, sign: false }); + data.append(FP16x16 { mag: 63983, sign: true }); + data.append(FP16x16 { mag: 48252, sign: false }); + data.append(FP16x16 { mag: 51458, sign: false }); + data.append(FP16x16 { mag: 28035, sign: true }); + data.append(FP16x16 { mag: 93421, sign: false }); + data.append(FP16x16 { mag: 46679, sign: true }); + data.append(FP16x16 { mag: 81159, sign: false }); + data.append(FP16x16 { mag: 22207, sign: false }); + data.append(FP16x16 { mag: 24918, sign: false }); + data.append(FP16x16 { mag: 50366, sign: true }); + data.append(FP16x16 { mag: 38928, sign: true }); + data.append(FP16x16 { mag: 2326, sign: true }); + data.append(FP16x16 { mag: 41029, sign: true }); + data.append(FP16x16 { mag: 48971, sign: false }); + data.append(FP16x16 { mag: 102185, sign: true }); + data.append(FP16x16 { mag: 45825, sign: true }); + data.append(FP16x16 { mag: 6231, sign: true }); + data.append(FP16x16 { mag: 5992, sign: true }); + data.append(FP16x16 { mag: 60752, sign: false }); + data.append(FP16x16 { mag: 44154, sign: false }); + data.append(FP16x16 { mag: 58826, sign: true }); + data.append(FP16x16 { mag: 70712, sign: true }); + data.append(FP16x16 { mag: 16729, sign: true }); + data.append(FP16x16 { mag: 122822, sign: true }); + data.append(FP16x16 { mag: 5531, sign: true }); + data.append(FP16x16 { mag: 125650, sign: false }); + data.append(FP16x16 { mag: 116267, sign: false }); + data.append(FP16x16 { mag: 36107, sign: false }); + data.append(FP16x16 { mag: 28157, sign: true }); + data.append(FP16x16 { mag: 39470, sign: false }); + data.append(FP16x16 { mag: 47628, sign: false }); + data.append(FP16x16 { mag: 22813, sign: false }); + data.append(FP16x16 { mag: 48005, sign: false }); + data.append(FP16x16 { mag: 2843, sign: false }); + data.append(FP16x16 { mag: 65208, sign: false }); + data.append(FP16x16 { mag: 42277, sign: false }); + data.append(FP16x16 { mag: 18706, sign: true }); + data.append(FP16x16 { mag: 30606, sign: true }); + data.append(FP16x16 { mag: 27669, sign: true }); + data.append(FP16x16 { mag: 38065, sign: false }); + data.append(FP16x16 { mag: 11748, sign: false }); + data.append(FP16x16 { mag: 37583, sign: true }); + data.append(FP16x16 { mag: 37178, sign: false }); + data.append(FP16x16 { mag: 45096, sign: false }); + data.append(FP16x16 { mag: 120975, sign: true }); + data.append(FP16x16 { mag: 42732, sign: false }); + data.append(FP16x16 { mag: 87833, sign: false }); + data.append(FP16x16 { mag: 25683, sign: true }); + data.append(FP16x16 { mag: 57618, sign: true }); + data.append(FP16x16 { mag: 23177, sign: false }); + data.append(FP16x16 { mag: 5134, sign: true }); + data.append(FP16x16 { mag: 7581, sign: true }); + data.append(FP16x16 { mag: 75724, sign: true }); + data.append(FP16x16 { mag: 64458, sign: true }); + data.append(FP16x16 { mag: 141791, sign: true }); + data.append(FP16x16 { mag: 42154, sign: true }); + data.append(FP16x16 { mag: 12865, sign: false }); + data.append(FP16x16 { mag: 17234, sign: true }); + data.append(FP16x16 { mag: 126303, sign: true }); + data.append(FP16x16 { mag: 93382, sign: true }); + data.append(FP16x16 { mag: 57375, sign: false }); + data.append(FP16x16 { mag: 75818, sign: false }); + data.append(FP16x16 { mag: 5159, sign: false }); + data.append(FP16x16 { mag: 35848, sign: false }); + data.append(FP16x16 { mag: 4853, sign: false }); + data.append(FP16x16 { mag: 57301, sign: true }); + data.append(FP16x16 { mag: 8128, sign: true }); + data.append(FP16x16 { mag: 83696, sign: true }); + data.append(FP16x16 { mag: 136686, sign: false }); + data.append(FP16x16 { mag: 112560, sign: true }); + data.append(FP16x16 { mag: 66658, sign: false }); + data.append(FP16x16 { mag: 28200, sign: true }); + data.append(FP16x16 { mag: 40036, sign: false }); + data.append(FP16x16 { mag: 31169, sign: true }); + data.append(FP16x16 { mag: 174668, sign: false }); + data.append(FP16x16 { mag: 29868, sign: false }); + data.append(FP16x16 { mag: 10093, sign: true }); + data.append(FP16x16 { mag: 74999, sign: false }); + data.append(FP16x16 { mag: 78237, sign: true }); + data.append(FP16x16 { mag: 127676, sign: true }); + data.append(FP16x16 { mag: 22293, sign: true }); + data.append(FP16x16 { mag: 1758, sign: false }); + data.append(FP16x16 { mag: 56726, sign: false }); + data.append(FP16x16 { mag: 133433, sign: true }); + data.append(FP16x16 { mag: 9554, sign: true }); + data.append(FP16x16 { mag: 74809, sign: true }); + data.append(FP16x16 { mag: 17296, sign: true }); + data.append(FP16x16 { mag: 33106, sign: false }); + data.append(FP16x16 { mag: 57029, sign: true }); + data.append(FP16x16 { mag: 67553, sign: false }); + data.append(FP16x16 { mag: 65247, sign: false }); + data.append(FP16x16 { mag: 33811, sign: false }); + data.append(FP16x16 { mag: 37820, sign: false }); + data.append(FP16x16 { mag: 8349, sign: false }); + data.append(FP16x16 { mag: 82711, sign: true }); + data.append(FP16x16 { mag: 6355, sign: true }); + data.append(FP16x16 { mag: 51759, sign: true }); + data.append(FP16x16 { mag: 90465, sign: false }); + data.append(FP16x16 { mag: 63747, sign: false }); + data.append(FP16x16 { mag: 51827, sign: false }); + data.append(FP16x16 { mag: 2074, sign: true }); + data.append(FP16x16 { mag: 7986, sign: true }); + data.append(FP16x16 { mag: 127840, sign: true }); + data.append(FP16x16 { mag: 9095, sign: true }); + data.append(FP16x16 { mag: 39166, sign: true }); + data.append(FP16x16 { mag: 4900, sign: false }); + data.append(FP16x16 { mag: 85400, sign: false }); + data.append(FP16x16 { mag: 20179, sign: true }); + data.append(FP16x16 { mag: 102313, sign: false }); + data.append(FP16x16 { mag: 30560, sign: true }); + data.append(FP16x16 { mag: 23998, sign: true }); + data.append(FP16x16 { mag: 18546, sign: false }); + data.append(FP16x16 { mag: 50624, sign: false }); + data.append(FP16x16 { mag: 28484, sign: false }); + data.append(FP16x16 { mag: 106711, sign: false }); + data.append(FP16x16 { mag: 145610, sign: true }); + data.append(FP16x16 { mag: 45143, sign: true }); + data.append(FP16x16 { mag: 49679, sign: true }); + data.append(FP16x16 { mag: 43769, sign: true }); + data.append(FP16x16 { mag: 70976, sign: false }); + data.append(FP16x16 { mag: 97200, sign: false }); + data.append(FP16x16 { mag: 51404, sign: true }); + data.append(FP16x16 { mag: 5413, sign: false }); + data.append(FP16x16 { mag: 16219, sign: true }); + data.append(FP16x16 { mag: 68769, sign: false }); + data.append(FP16x16 { mag: 14687, sign: true }); + data.append(FP16x16 { mag: 24476, sign: false }); + data.append(FP16x16 { mag: 50297, sign: true }); + data.append(FP16x16 { mag: 21305, sign: true }); + data.append(FP16x16 { mag: 63960, sign: false }); + data.append(FP16x16 { mag: 60809, sign: false }); + data.append(FP16x16 { mag: 28337, sign: true }); + data.append(FP16x16 { mag: 14402, sign: true }); + data.append(FP16x16 { mag: 118874, sign: true }); + data.append(FP16x16 { mag: 76081, sign: false }); + data.append(FP16x16 { mag: 72871, sign: false }); + data.append(FP16x16 { mag: 25750, sign: true }); + data.append(FP16x16 { mag: 9294, sign: true }); + data.append(FP16x16 { mag: 113450, sign: false }); + data.append(FP16x16 { mag: 11901, sign: false }); + data.append(FP16x16 { mag: 130175, sign: true }); + data.append(FP16x16 { mag: 78751, sign: false }); + data.append(FP16x16 { mag: 37596, sign: false }); + data.append(FP16x16 { mag: 15550, sign: true }); + data.append(FP16x16 { mag: 88187, sign: false }); + data.append(FP16x16 { mag: 39156, sign: false }); + data.append(FP16x16 { mag: 105270, sign: false }); + data.append(FP16x16 { mag: 17054, sign: false }); + data.append(FP16x16 { mag: 58134, sign: false }); + data.append(FP16x16 { mag: 81353, sign: false }); + data.append(FP16x16 { mag: 54805, sign: true }); + data.append(FP16x16 { mag: 17538, sign: false }); + data.append(FP16x16 { mag: 78980, sign: false }); + data.append(FP16x16 { mag: 198738, sign: false }); + data.append(FP16x16 { mag: 19403, sign: true }); + data.append(FP16x16 { mag: 34265, sign: false }); + data.append(FP16x16 { mag: 11007, sign: false }); + data.append(FP16x16 { mag: 28307, sign: false }); + data.append(FP16x16 { mag: 119920, sign: true }); + data.append(FP16x16 { mag: 26409, sign: false }); + data.append(FP16x16 { mag: 23076, sign: false }); + data.append(FP16x16 { mag: 34211, sign: false }); + data.append(FP16x16 { mag: 361, sign: true }); + data.append(FP16x16 { mag: 73745, sign: true }); + data.append(FP16x16 { mag: 7717, sign: true }); + data.append(FP16x16 { mag: 12468, sign: false }); + data.append(FP16x16 { mag: 25976, sign: false }); + data.append(FP16x16 { mag: 107153, sign: true }); + data.append(FP16x16 { mag: 68883, sign: false }); + data.append(FP16x16 { mag: 13933, sign: true }); + data.append(FP16x16 { mag: 79850, sign: false }); + data.append(FP16x16 { mag: 77337, sign: true }); + data.append(FP16x16 { mag: 27318, sign: true }); + data.append(FP16x16 { mag: 103120, sign: false }); + data.append(FP16x16 { mag: 12693, sign: true }); + data.append(FP16x16 { mag: 63090, sign: false }); + data.append(FP16x16 { mag: 45507, sign: false }); + data.append(FP16x16 { mag: 52553, sign: true }); + data.append(FP16x16 { mag: 70902, sign: false }); + data.append(FP16x16 { mag: 111650, sign: false }); + data.append(FP16x16 { mag: 23223, sign: false }); + data.append(FP16x16 { mag: 6272, sign: true }); + data.append(FP16x16 { mag: 7037, sign: false }); + data.append(FP16x16 { mag: 74819, sign: true }); + data.append(FP16x16 { mag: 68730, sign: false }); + data.append(FP16x16 { mag: 90482, sign: false }); + data.append(FP16x16 { mag: 16560, sign: true }); + data.append(FP16x16 { mag: 117248, sign: false }); + data.append(FP16x16 { mag: 80344, sign: false }); + data.append(FP16x16 { mag: 73022, sign: true }); + data.append(FP16x16 { mag: 33531, sign: false }); + data.append(FP16x16 { mag: 180033, sign: false }); + data.append(FP16x16 { mag: 46630, sign: true }); + data.append(FP16x16 { mag: 119335, sign: true }); + data.append(FP16x16 { mag: 20067, sign: true }); + data.append(FP16x16 { mag: 36506, sign: false }); + data.append(FP16x16 { mag: 24262, sign: true }); + data.append(FP16x16 { mag: 715, sign: true }); + data.append(FP16x16 { mag: 101984, sign: false }); + data.append(FP16x16 { mag: 22353, sign: false }); + data.append(FP16x16 { mag: 50986, sign: false }); + data.append(FP16x16 { mag: 67113, sign: false }); + data.append(FP16x16 { mag: 55868, sign: false }); + data.append(FP16x16 { mag: 100422, sign: true }); + data.append(FP16x16 { mag: 53193, sign: false }); + data.append(FP16x16 { mag: 51699, sign: false }); + data.append(FP16x16 { mag: 47894, sign: true }); + data.append(FP16x16 { mag: 8082, sign: true }); + data.append(FP16x16 { mag: 32263, sign: true }); + data.append(FP16x16 { mag: 27212, sign: true }); + data.append(FP16x16 { mag: 7226, sign: true }); + data.append(FP16x16 { mag: 30746, sign: false }); + data.append(FP16x16 { mag: 12011, sign: false }); + data.append(FP16x16 { mag: 13020, sign: false }); + data.append(FP16x16 { mag: 7085, sign: false }); + data.append(FP16x16 { mag: 18086, sign: true }); + data.append(FP16x16 { mag: 30286, sign: false }); + data.append(FP16x16 { mag: 20925, sign: true }); + data.append(FP16x16 { mag: 87195, sign: true }); + data.append(FP16x16 { mag: 42790, sign: false }); + data.append(FP16x16 { mag: 8451, sign: false }); + data.append(FP16x16 { mag: 91114, sign: true }); + data.append(FP16x16 { mag: 32647, sign: true }); + data.append(FP16x16 { mag: 64992, sign: true }); + data.append(FP16x16 { mag: 74108, sign: false }); + data.append(FP16x16 { mag: 15790, sign: true }); + data.append(FP16x16 { mag: 80038, sign: true }); + data.append(FP16x16 { mag: 34209, sign: true }); + data.append(FP16x16 { mag: 7672, sign: false }); + data.append(FP16x16 { mag: 27429, sign: false }); + data.append(FP16x16 { mag: 57827, sign: false }); + data.append(FP16x16 { mag: 2154, sign: true }); + data.append(FP16x16 { mag: 44183, sign: false }); + data.append(FP16x16 { mag: 60736, sign: false }); + data.append(FP16x16 { mag: 62972, sign: false }); + data.append(FP16x16 { mag: 10, sign: true }); + data.append(FP16x16 { mag: 30567, sign: true }); + data.append(FP16x16 { mag: 58169, sign: false }); + data.append(FP16x16 { mag: 113162, sign: true }); + data.append(FP16x16 { mag: 47093, sign: true }); + data.append(FP16x16 { mag: 11549, sign: false }); + data.append(FP16x16 { mag: 103543, sign: true }); + data.append(FP16x16 { mag: 19276, sign: true }); + data.append(FP16x16 { mag: 43892, sign: false }); + data.append(FP16x16 { mag: 28123, sign: false }); + data.append(FP16x16 { mag: 94676, sign: false }); + data.append(FP16x16 { mag: 85149, sign: true }); + data.append(FP16x16 { mag: 26867, sign: true }); + data.append(FP16x16 { mag: 112263, sign: true }); + data.append(FP16x16 { mag: 24373, sign: true }); + data.append(FP16x16 { mag: 34755, sign: false }); + data.append(FP16x16 { mag: 9384, sign: false }); + data.append(FP16x16 { mag: 49546, sign: true }); + data.append(FP16x16 { mag: 79711, sign: false }); + data.append(FP16x16 { mag: 27758, sign: true }); + data.append(FP16x16 { mag: 8378, sign: true }); + data.append(FP16x16 { mag: 40580, sign: false }); + data.append(FP16x16 { mag: 112339, sign: true }); + data.append(FP16x16 { mag: 10388, sign: true }); + data.append(FP16x16 { mag: 37733, sign: false }); + data.append(FP16x16 { mag: 105370, sign: false }); + data.append(FP16x16 { mag: 38217, sign: true }); + data.append(FP16x16 { mag: 52641, sign: true }); + data.append(FP16x16 { mag: 33139, sign: true }); + data.append(FP16x16 { mag: 8245, sign: true }); + data.append(FP16x16 { mag: 2784, sign: false }); + data.append(FP16x16 { mag: 113567, sign: false }); + data.append(FP16x16 { mag: 104763, sign: false }); + data.append(FP16x16 { mag: 4564, sign: false }); + data.append(FP16x16 { mag: 15700, sign: false }); + data.append(FP16x16 { mag: 43737, sign: false }); + data.append(FP16x16 { mag: 34793, sign: false }); + data.append(FP16x16 { mag: 57257, sign: true }); + data.append(FP16x16 { mag: 132151, sign: true }); + data.append(FP16x16 { mag: 45201, sign: true }); + data.append(FP16x16 { mag: 98318, sign: false }); + data.append(FP16x16 { mag: 106443, sign: true }); + data.append(FP16x16 { mag: 34909, sign: true }); + data.append(FP16x16 { mag: 32335, sign: true }); + data.append(FP16x16 { mag: 40192, sign: true }); + data.append(FP16x16 { mag: 22349, sign: false }); + data.append(FP16x16 { mag: 49484, sign: true }); + data.append(FP16x16 { mag: 10589, sign: true }); + data.append(FP16x16 { mag: 7125, sign: true }); + data.append(FP16x16 { mag: 104325, sign: true }); + data.append(FP16x16 { mag: 41763, sign: false }); + data.append(FP16x16 { mag: 38116, sign: false }); + data.append(FP16x16 { mag: 84951, sign: true }); + data.append(FP16x16 { mag: 52756, sign: false }); + data.append(FP16x16 { mag: 60485, sign: false }); + data.append(FP16x16 { mag: 90227, sign: false }); + data.append(FP16x16 { mag: 12616, sign: false }); + data.append(FP16x16 { mag: 94036, sign: false }); + data.append(FP16x16 { mag: 60362, sign: true }); + data.append(FP16x16 { mag: 6930, sign: false }); + data.append(FP16x16 { mag: 42650, sign: true }); + data.append(FP16x16 { mag: 57435, sign: false }); + data.append(FP16x16 { mag: 8276, sign: true }); + data.append(FP16x16 { mag: 36396, sign: true }); + data.append(FP16x16 { mag: 157288, sign: false }); + data.append(FP16x16 { mag: 3531, sign: true }); + data.append(FP16x16 { mag: 21519, sign: true }); + data.append(FP16x16 { mag: 1592, sign: true }); + data.append(FP16x16 { mag: 41150, sign: true }); + data.append(FP16x16 { mag: 73234, sign: false }); + data.append(FP16x16 { mag: 66372, sign: false }); + data.append(FP16x16 { mag: 58146, sign: false }); + data.append(FP16x16 { mag: 44555, sign: false }); + data.append(FP16x16 { mag: 35804, sign: true }); + data.append(FP16x16 { mag: 2150, sign: false }); + data.append(FP16x16 { mag: 55208, sign: false }); + data.append(FP16x16 { mag: 41980, sign: true }); + data.append(FP16x16 { mag: 66322, sign: true }); + data.append(FP16x16 { mag: 26460, sign: false }); + data.append(FP16x16 { mag: 77380, sign: false }); + data.append(FP16x16 { mag: 125207, sign: true }); + data.append(FP16x16 { mag: 30086, sign: true }); + data.append(FP16x16 { mag: 15517, sign: false }); + data.append(FP16x16 { mag: 118773, sign: false }); + data.append(FP16x16 { mag: 99314, sign: true }); + data.append(FP16x16 { mag: 11067, sign: true }); + data.append(FP16x16 { mag: 57066, sign: false }); + data.append(FP16x16 { mag: 5311, sign: false }); + data.append(FP16x16 { mag: 69970, sign: false }); + data.append(FP16x16 { mag: 93820, sign: false }); + data.append(FP16x16 { mag: 1079, sign: true }); + data.append(FP16x16 { mag: 9773, sign: false }); + data.append(FP16x16 { mag: 21840, sign: false }); + data.append(FP16x16 { mag: 2160, sign: true }); + data.append(FP16x16 { mag: 3271, sign: true }); + data.append(FP16x16 { mag: 99495, sign: true }); + data.append(FP16x16 { mag: 77215, sign: true }); + data.append(FP16x16 { mag: 85212, sign: false }); + data.append(FP16x16 { mag: 61944, sign: false }); + data.append(FP16x16 { mag: 2082, sign: false }); + data.append(FP16x16 { mag: 107676, sign: true }); + data.append(FP16x16 { mag: 40702, sign: false }); + data.append(FP16x16 { mag: 24223, sign: false }); + data.append(FP16x16 { mag: 82086, sign: true }); + data.append(FP16x16 { mag: 1236, sign: false }); + data.append(FP16x16 { mag: 65294, sign: false }); + data.append(FP16x16 { mag: 18639, sign: true }); + data.append(FP16x16 { mag: 81036, sign: false }); + data.append(FP16x16 { mag: 1472, sign: false }); + data.append(FP16x16 { mag: 26208, sign: true }); + data.append(FP16x16 { mag: 7969, sign: false }); + data.append(FP16x16 { mag: 94838, sign: false }); + data.append(FP16x16 { mag: 48398, sign: true }); + data.append(FP16x16 { mag: 127750, sign: false }); + data.append(FP16x16 { mag: 14694, sign: false }); + data.append(FP16x16 { mag: 98356, sign: false }); + data.append(FP16x16 { mag: 16239, sign: false }); + data.append(FP16x16 { mag: 20463, sign: false }); + data.append(FP16x16 { mag: 125215, sign: false }); + data.append(FP16x16 { mag: 8089, sign: true }); + data.append(FP16x16 { mag: 114956, sign: true }); + data.append(FP16x16 { mag: 56287, sign: false }); + data.append(FP16x16 { mag: 11168, sign: true }); + data.append(FP16x16 { mag: 85072, sign: true }); + data.append(FP16x16 { mag: 53241, sign: true }); + data.append(FP16x16 { mag: 47712, sign: false }); + data.append(FP16x16 { mag: 27321, sign: false }); + data.append(FP16x16 { mag: 2647, sign: false }); + data.append(FP16x16 { mag: 64711, sign: true }); + data.append(FP16x16 { mag: 8104, sign: true }); + data.append(FP16x16 { mag: 5213, sign: false }); + data.append(FP16x16 { mag: 87049, sign: true }); + data.append(FP16x16 { mag: 41663, sign: false }); + data.append(FP16x16 { mag: 26688, sign: true }); + data.append(FP16x16 { mag: 2385, sign: true }); + data.append(FP16x16 { mag: 8540, sign: true }); + data.append(FP16x16 { mag: 7311, sign: true }); + data.append(FP16x16 { mag: 2750, sign: true }); + data.append(FP16x16 { mag: 125527, sign: true }); + data.append(FP16x16 { mag: 51192, sign: false }); + data.append(FP16x16 { mag: 102959, sign: false }); + data.append(FP16x16 { mag: 94206, sign: false }); + data.append(FP16x16 { mag: 22114, sign: false }); + data.append(FP16x16 { mag: 56998, sign: false }); + data.append(FP16x16 { mag: 118819, sign: true }); + data.append(FP16x16 { mag: 87037, sign: false }); + data.append(FP16x16 { mag: 45884, sign: false }); + data.append(FP16x16 { mag: 108580, sign: false }); + data.append(FP16x16 { mag: 175625, sign: true }); + data.append(FP16x16 { mag: 42256, sign: false }); + data.append(FP16x16 { mag: 39523, sign: false }); + data.append(FP16x16 { mag: 29431, sign: false }); + data.append(FP16x16 { mag: 17315, sign: true }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/maxpool_4d_dilations/output_0.cairo b/tests/nodes/maxpool_4d_dilations/output_0.cairo new file mode 100644 index 000000000..9c0185e89 --- /dev/null +++ b/tests/nodes/maxpool_4d_dilations/output_0.cairo @@ -0,0 +1,65 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(3); + shape.append(2); + shape.append(2); + shape.append(2); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 49149, sign: false }); + data.append(FP16x16 { mag: 93230, sign: false }); + data.append(FP16x16 { mag: 131524, sign: false }); + data.append(FP16x16 { mag: 172442, sign: false }); + data.append(FP16x16 { mag: 171591, sign: false }); + data.append(FP16x16 { mag: 124609, sign: false }); + data.append(FP16x16 { mag: 107561, sign: false }); + data.append(FP16x16 { mag: 193719, sign: false }); + data.append(FP16x16 { mag: 97602, sign: false }); + data.append(FP16x16 { mag: 58097, sign: false }); + data.append(FP16x16 { mag: 117822, sign: false }); + data.append(FP16x16 { mag: 79390, sign: false }); + data.append(FP16x16 { mag: 93738, sign: false }); + data.append(FP16x16 { mag: 114134, sign: false }); + data.append(FP16x16 { mag: 84330, sign: false }); + data.append(FP16x16 { mag: 81192, sign: false }); + data.append(FP16x16 { mag: 93421, sign: false }); + data.append(FP16x16 { mag: 80140, sign: false }); + data.append(FP16x16 { mag: 88854, sign: false }); + data.append(FP16x16 { mag: 93610, sign: false }); + data.append(FP16x16 { mag: 57375, sign: false }); + data.append(FP16x16 { mag: 98163, sign: false }); + data.append(FP16x16 { mag: 116267, sign: false }); + data.append(FP16x16 { mag: 125650, sign: false }); + data.append(FP16x16 { mag: 136686, sign: false }); + data.append(FP16x16 { mag: 123236, sign: false }); + data.append(FP16x16 { mag: 174668, sign: false }); + data.append(FP16x16 { mag: 65025, sign: false }); + data.append(FP16x16 { mag: 68769, sign: false }); + data.append(FP16x16 { mag: 131564, sign: false }); + data.append(FP16x16 { mag: 97200, sign: false }); + data.append(FP16x16 { mag: 90465, sign: false }); + data.append(FP16x16 { mag: 105370, sign: false }); + data.append(FP16x16 { mag: 103120, sign: false }); + data.append(FP16x16 { mag: 113567, sign: false }); + data.append(FP16x16 { mag: 157288, sign: false }); + data.append(FP16x16 { mag: 118773, sign: false }); + data.append(FP16x16 { mag: 180033, sign: false }); + data.append(FP16x16 { mag: 90227, sign: false }); + data.append(FP16x16 { mag: 198738, sign: false }); + data.append(FP16x16 { mag: 101984, sign: false }); + data.append(FP16x16 { mag: 61944, sign: false }); + data.append(FP16x16 { mag: 62972, sign: false }); + data.append(FP16x16 { mag: 67113, sign: false }); + data.append(FP16x16 { mag: 127750, sign: false }); + data.append(FP16x16 { mag: 102959, sign: false }); + data.append(FP16x16 { mag: 94838, sign: false }); + data.append(FP16x16 { mag: 125215, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/qlinear_conv.cairo b/tests/nodes/qlinear_conv.cairo new file mode 100644 index 000000000..dc7b580dd --- /dev/null +++ b/tests/nodes/qlinear_conv.cairo @@ -0,0 +1,46 @@ +mod input_0; +mod input_1; +mod input_2; +mod output_0; + + +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::I8TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{I8Tensor, I8TensorAdd}; +use orion::operators::tensor::FP16x16TensorPartialEq; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::implementations::tensor_fp16x16::{ + TensorI8IntoTensorFP16x16, FP16x16TensorSub, FP16x16TensorDiv, FP16x16TensorMul +}; +use orion::numbers::{I8IntoFP16x16}; + +#[test] +#[available_gas(2000000000)] +fn test_qlinear_conv() { + let input_0 = input_0::input_0(); + let input_1 = input_1::input_1(); + let input_2 = input_2::input_2(); + let z_0 = output_0::output_0(); + + let y_0 = FP16x16Tensor::qlinear_conv( + @input_0, + @TensorTrait::new(shape: array![1].span(), data: array![*input_2.data.at(0)].span(),), + @TensorTrait::new(shape: array![1].span(), data: array![*input_2.data.at(1)].span(),), + @input_1, + @TensorTrait::new(shape: array![1].span(), data: array![*input_2.data.at(2)].span(),), + @TensorTrait::new(shape: array![1].span(), data: array![*input_2.data.at(3)].span(),), + Option::None, + Option::None, + Option::None, + Option::None, + Option::None, + Option::None, + Option::None, + @TensorTrait::new(shape: array![1].span(), data: array![*input_2.data.at(4)].span(),), + @TensorTrait::new(shape: array![1].span(), data: array![*input_2.data.at(5)].span(),) + ); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/gather_elements_i8_3d_default/input_0.cairo b/tests/nodes/qlinear_conv/input_0.cairo similarity index 75% rename from tests/nodes/gather_elements_i8_3d_default/input_0.cairo rename to tests/nodes/qlinear_conv/input_0.cairo index cdb58470f..677366ad8 100644 --- a/tests/nodes/gather_elements_i8_3d_default/input_0.cairo +++ b/tests/nodes/qlinear_conv/input_0.cairo @@ -1,14 +1,16 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I8Tensor, I8TensorSub}; +use orion::operators::tensor::{I8Tensor, I8TensorAdd}; +use orion::numbers::NumberTrait; fn input_0() -> Tensor { let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(1); shape.append(3); shape.append(3); let mut data = ArrayTrait::new(); - data.append(0); data.append(1); data.append(2); data.append(3); @@ -17,5 +19,6 @@ fn input_0() -> Tensor { data.append(6); data.append(7); data.append(8); + data.append(9); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/argmax_i8_1D_default/input_0.cairo b/tests/nodes/qlinear_conv/input_1.cairo similarity index 63% rename from tests/nodes/argmax_i8_1D_default/input_0.cairo rename to tests/nodes/qlinear_conv/input_1.cairo index d760a1faa..4066a17fa 100644 --- a/tests/nodes/argmax_i8_1D_default/input_0.cairo +++ b/tests/nodes/qlinear_conv/input_1.cairo @@ -1,14 +1,16 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::{I8Tensor, I8TensorAdd}; +use orion::numbers::NumberTrait; -fn input_0() -> Tensor { +fn input_1() -> Tensor { let mut shape = ArrayTrait::::new(); - shape.append(3); + shape.append(1); + shape.append(1); + shape.append(1); + shape.append(1); let mut data = ArrayTrait::new(); - data.append(6); - data.append(-60); - data.append(-123); + data.append(0); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/qlinear_conv/input_2.cairo b/tests/nodes/qlinear_conv/input_2.cairo new file mode 100644 index 000000000..02fb4d2ec --- /dev/null +++ b/tests/nodes/qlinear_conv/input_2.cairo @@ -0,0 +1,18 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_2() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(6); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 32768, sign: false }); + data.append(FP16x16 { mag: 131072, sign: false }); + data.append(FP16x16 { mag: 26214, sign: false }); + data.append(FP16x16 { mag: 196608, sign: false }); + data.append(FP16x16 { mag: 13107, sign: false }); + data.append(FP16x16 { mag: 262144, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/gather_elements_i8_3d_axis1/output_0.cairo b/tests/nodes/qlinear_conv/output_0.cairo similarity index 58% rename from tests/nodes/gather_elements_i8_3d_axis1/output_0.cairo rename to tests/nodes/qlinear_conv/output_0.cairo index 382eae98b..98e542ec7 100644 --- a/tests/nodes/gather_elements_i8_3d_axis1/output_0.cairo +++ b/tests/nodes/qlinear_conv/output_0.cairo @@ -1,21 +1,24 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I8Tensor, I8TensorSub}; +use orion::operators::tensor::{I8Tensor, I8TensorAdd}; +use orion::numbers::NumberTrait; fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(1); shape.append(3); shape.append(3); let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(0); - data.append(3); - data.append(4); - data.append(3); - data.append(7); - data.append(7); data.append(7); + data.append(4); + data.append(1); + data.append(-2); + data.append(-5); + data.append(-8); + data.append(-11); + data.append(-14); + data.append(-17); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/gather_u32_3d_axis1.cairo b/tests/nodes/reduce_sum_default_axes_keepdims.cairo similarity index 73% rename from tests/nodes/gather_u32_3d_axis1.cairo rename to tests/nodes/reduce_sum_default_axes_keepdims.cairo index 1a7a56d37..93bb951e3 100644 --- a/tests/nodes/gather_u32_3d_axis1.cairo +++ b/tests/nodes/reduce_sum_default_axes_keepdims.cairo @@ -1,22 +1,20 @@ mod input_0; -mod input_1; mod output_0; use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::{U32Tensor, U32TensorAdd}; use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::U32TensorPartialEq; #[test] #[available_gas(2000000000)] -fn test_gather_u32_3d_axis1() { +fn test_reduce_sum_default_axes_keepdims() { let input_0 = input_0::input_0(); - let input_1 = input_1::input_1(); let z_0 = output_0::output_0(); - let y_0 = input_0.gather(indices: input_1, axis: Option::Some(1)); + let y_0 = input_0.reduce_sum(Option::Some(array![].span()), Option::Some(true), Option::None); assert_eq(y_0, z_0); } diff --git a/tests/nodes/gather_u32_3d_axis1/input_1.cairo b/tests/nodes/reduce_sum_default_axes_keepdims/input_0.cairo similarity index 64% rename from tests/nodes/gather_u32_3d_axis1/input_1.cairo rename to tests/nodes/reduce_sum_default_axes_keepdims/input_0.cairo index 99840a243..2de5818c3 100644 --- a/tests/nodes/gather_u32_3d_axis1/input_1.cairo +++ b/tests/nodes/reduce_sum_default_axes_keepdims/input_0.cairo @@ -3,17 +3,24 @@ use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::{U32Tensor, U32TensorAdd}; use orion::numbers::NumberTrait; -fn input_1() -> Tensor { +fn input_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(3); shape.append(2); + shape.append(2); let mut data = ArrayTrait::new(); - data.append(0); data.append(1); data.append(2); - data.append(1); - data.append(1); data.append(3); + data.append(4); + data.append(5); + data.append(6); + data.append(7); + data.append(8); + data.append(9); + data.append(10); + data.append(11); + data.append(12); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/argmax_fp16x16_1D_keepdims_false/output_0.cairo b/tests/nodes/reduce_sum_default_axes_keepdims/output_0.cairo similarity index 78% rename from tests/nodes/argmax_fp16x16_1D_keepdims_false/output_0.cairo rename to tests/nodes/reduce_sum_default_axes_keepdims/output_0.cairo index e4dbc507c..6cc93d6f7 100644 --- a/tests/nodes/argmax_fp16x16_1D_keepdims_false/output_0.cairo +++ b/tests/nodes/reduce_sum_default_axes_keepdims/output_0.cairo @@ -1,12 +1,15 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::numbers::NumberTrait; fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(1); + shape.append(1); + shape.append(1); let mut data = ArrayTrait::new(); - data.append(0); + data.append(78); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/gather_u32_3d_axis2.cairo b/tests/nodes/reduce_sum_empty_axes_input_noop.cairo similarity index 73% rename from tests/nodes/gather_u32_3d_axis2.cairo rename to tests/nodes/reduce_sum_empty_axes_input_noop.cairo index 30d5f6a61..94c924e6f 100644 --- a/tests/nodes/gather_u32_3d_axis2.cairo +++ b/tests/nodes/reduce_sum_empty_axes_input_noop.cairo @@ -1,22 +1,20 @@ mod input_0; -mod input_1; mod output_0; use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::{U32Tensor, U32TensorAdd}; use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::U32TensorPartialEq; #[test] #[available_gas(2000000000)] -fn test_gather_u32_3d_axis2() { +fn test_reduce_sum_empty_axes_input_noop() { let input_0 = input_0::input_0(); - let input_1 = input_1::input_1(); let z_0 = output_0::output_0(); - let y_0 = input_0.gather(indices: input_1, axis: Option::Some(2)); + let y_0 = input_0.reduce_sum(Option::None, Option::Some(true), Option::Some(true)); assert_eq(y_0, z_0); } diff --git a/tests/nodes/gather_elements_i8_3d_axis1/input_0.cairo b/tests/nodes/reduce_sum_empty_axes_input_noop/input_0.cairo similarity index 62% rename from tests/nodes/gather_elements_i8_3d_axis1/input_0.cairo rename to tests/nodes/reduce_sum_empty_axes_input_noop/input_0.cairo index cdb58470f..2de5818c3 100644 --- a/tests/nodes/gather_elements_i8_3d_axis1/input_0.cairo +++ b/tests/nodes/reduce_sum_empty_axes_input_noop/input_0.cairo @@ -1,14 +1,15 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I8Tensor, I8TensorSub}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::numbers::NumberTrait; -fn input_0() -> Tensor { +fn input_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(3); - shape.append(3); + shape.append(2); + shape.append(2); let mut data = ArrayTrait::new(); - data.append(0); data.append(1); data.append(2); data.append(3); @@ -17,5 +18,9 @@ fn input_0() -> Tensor { data.append(6); data.append(7); data.append(8); + data.append(9); + data.append(10); + data.append(11); + data.append(12); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/reduce_sum_empty_axes_input_noop/output_0.cairo b/tests/nodes/reduce_sum_empty_axes_input_noop/output_0.cairo new file mode 100644 index 000000000..d679605a0 --- /dev/null +++ b/tests/nodes/reduce_sum_empty_axes_input_noop/output_0.cairo @@ -0,0 +1,26 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::numbers::NumberTrait; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(3); + shape.append(2); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(1); + data.append(2); + data.append(3); + data.append(4); + data.append(5); + data.append(6); + data.append(7); + data.append(8); + data.append(9); + data.append(10); + data.append(11); + data.append(12); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/reduce_sum_fp16x16_1D.cairo b/tests/nodes/reduce_sum_fp16x16_1D.cairo deleted file mode 100644 index 3f0522443..000000000 --- a/tests/nodes/reduce_sum_fp16x16_1D.cairo +++ /dev/null @@ -1,20 +0,0 @@ -mod input_0; -mod output_0; - - -use orion::operators::tensor::FP16x16TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorMul}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_reduce_sum_fp16x16_1D() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.reduce_sum(0, false); - - assert_eq(y, z); -} diff --git a/tests/nodes/reduce_sum_fp16x16_2D_axis_1.cairo b/tests/nodes/reduce_sum_fp16x16_2D_axis_1.cairo deleted file mode 100644 index 6d0a4e86c..000000000 --- a/tests/nodes/reduce_sum_fp16x16_2D_axis_1.cairo +++ /dev/null @@ -1,20 +0,0 @@ -mod input_0; -mod output_0; - - -use orion::operators::tensor::FP16x16TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorMul}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_reduce_sum_fp16x16_2D_axis_1() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.reduce_sum(1, false); - - assert_eq(y, z); -} diff --git a/tests/nodes/reduce_sum_fp16x16_2D_axis_1/output_0.cairo b/tests/nodes/reduce_sum_fp16x16_2D_axis_1/output_0.cairo deleted file mode 100644 index 2eb416252..000000000 --- a/tests/nodes/reduce_sum_fp16x16_2D_axis_1/output_0.cairo +++ /dev/null @@ -1,14 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorMul}; -use orion::numbers::{FixedTrait, FP16x16}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(FP16x16 { mag: 65536, sign: false }); - data.append(FP16x16 { mag: 327680, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/reduce_sum_fp16x16_2D_default.cairo b/tests/nodes/reduce_sum_fp16x16_2D_default.cairo deleted file mode 100644 index 62fc72403..000000000 --- a/tests/nodes/reduce_sum_fp16x16_2D_default.cairo +++ /dev/null @@ -1,20 +0,0 @@ -mod input_0; -mod output_0; - - -use orion::operators::tensor::FP16x16TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorMul}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_reduce_sum_fp16x16_2D_default() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.reduce_sum(0, false); - - assert_eq(y, z); -} diff --git a/tests/nodes/reduce_sum_fp16x16_2D_keepdims.cairo b/tests/nodes/reduce_sum_fp16x16_2D_keepdims.cairo deleted file mode 100644 index 7de0e4085..000000000 --- a/tests/nodes/reduce_sum_fp16x16_2D_keepdims.cairo +++ /dev/null @@ -1,20 +0,0 @@ -mod input_0; -mod output_0; - - -use orion::operators::tensor::FP16x16TensorPartialEq; -use orion::utils::{assert_eq, assert_seq_eq}; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorMul}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_reduce_sum_fp16x16_2D_keepdims() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.reduce_sum(0, true); - - assert_eq(y, z); -} diff --git a/tests/nodes/reduce_sum_fp8x23_1D.cairo b/tests/nodes/reduce_sum_fp8x23_1D.cairo deleted file mode 100644 index 1887e4cda..000000000 --- a/tests/nodes/reduce_sum_fp8x23_1D.cairo +++ /dev/null @@ -1,20 +0,0 @@ -mod input_0; -mod output_0; - - -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorMul}; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::FP8x23TensorPartialEq; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_reduce_sum_fp8x23_1D() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.reduce_sum(0, false); - - assert_eq(y, z); -} diff --git a/tests/nodes/reduce_sum_fp8x23_1D/input_0.cairo b/tests/nodes/reduce_sum_fp8x23_1D/input_0.cairo deleted file mode 100644 index e050eac48..000000000 --- a/tests/nodes/reduce_sum_fp8x23_1D/input_0.cairo +++ /dev/null @@ -1,15 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorMul}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 0, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/reduce_sum_fp8x23_1D/output_0.cairo b/tests/nodes/reduce_sum_fp8x23_1D/output_0.cairo deleted file mode 100644 index a82fe159c..000000000 --- a/tests/nodes/reduce_sum_fp8x23_1D/output_0.cairo +++ /dev/null @@ -1,13 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorMul}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 25165824, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/reduce_sum_fp8x23_2D_axis_1.cairo b/tests/nodes/reduce_sum_fp8x23_2D_axis_1.cairo deleted file mode 100644 index f8e1e9bd5..000000000 --- a/tests/nodes/reduce_sum_fp8x23_2D_axis_1.cairo +++ /dev/null @@ -1,20 +0,0 @@ -mod input_0; -mod output_0; - - -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorMul}; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::FP8x23TensorPartialEq; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_reduce_sum_fp8x23_2D_axis_1() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.reduce_sum(1, false); - - assert_eq(y, z); -} diff --git a/tests/nodes/reduce_sum_fp8x23_2D_axis_1/input_0.cairo b/tests/nodes/reduce_sum_fp8x23_2D_axis_1/input_0.cairo deleted file mode 100644 index 29035e7f4..000000000 --- a/tests/nodes/reduce_sum_fp8x23_2D_axis_1/input_0.cairo +++ /dev/null @@ -1,17 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorMul}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 0, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 25165824, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/reduce_sum_fp8x23_2D_axis_1/output_0.cairo b/tests/nodes/reduce_sum_fp8x23_2D_axis_1/output_0.cairo deleted file mode 100644 index 74d4ee8e5..000000000 --- a/tests/nodes/reduce_sum_fp8x23_2D_axis_1/output_0.cairo +++ /dev/null @@ -1,14 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorMul}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 41943040, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/reduce_sum_fp8x23_2D_default.cairo b/tests/nodes/reduce_sum_fp8x23_2D_default.cairo deleted file mode 100644 index 95ef60ba0..000000000 --- a/tests/nodes/reduce_sum_fp8x23_2D_default.cairo +++ /dev/null @@ -1,20 +0,0 @@ -mod input_0; -mod output_0; - - -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorMul}; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::FP8x23TensorPartialEq; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_reduce_sum_fp8x23_2D_default() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.reduce_sum(0, false); - - assert_eq(y, z); -} diff --git a/tests/nodes/reduce_sum_fp8x23_2D_default/input_0.cairo b/tests/nodes/reduce_sum_fp8x23_2D_default/input_0.cairo deleted file mode 100644 index 29035e7f4..000000000 --- a/tests/nodes/reduce_sum_fp8x23_2D_default/input_0.cairo +++ /dev/null @@ -1,17 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorMul}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 0, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 25165824, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/reduce_sum_fp8x23_2D_default/output_0.cairo b/tests/nodes/reduce_sum_fp8x23_2D_default/output_0.cairo deleted file mode 100644 index 05c879685..000000000 --- a/tests/nodes/reduce_sum_fp8x23_2D_default/output_0.cairo +++ /dev/null @@ -1,14 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorMul}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 33554432, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/reduce_sum_fp8x23_2D_keepdims.cairo b/tests/nodes/reduce_sum_fp8x23_2D_keepdims.cairo deleted file mode 100644 index b81947c90..000000000 --- a/tests/nodes/reduce_sum_fp8x23_2D_keepdims.cairo +++ /dev/null @@ -1,20 +0,0 @@ -mod input_0; -mod output_0; - - -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorMul}; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::FP8x23TensorPartialEq; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_reduce_sum_fp8x23_2D_keepdims() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.reduce_sum(0, true); - - assert_eq(y, z); -} diff --git a/tests/nodes/reduce_sum_fp8x23_2D_keepdims/input_0.cairo b/tests/nodes/reduce_sum_fp8x23_2D_keepdims/input_0.cairo deleted file mode 100644 index 29035e7f4..000000000 --- a/tests/nodes/reduce_sum_fp8x23_2D_keepdims/input_0.cairo +++ /dev/null @@ -1,17 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorMul}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 0, sign: false }); - data.append(FP8x23 { mag: 8388608, sign: false }); - data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 25165824, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/reduce_sum_fp8x23_2D_keepdims/output_0.cairo b/tests/nodes/reduce_sum_fp8x23_2D_keepdims/output_0.cairo deleted file mode 100644 index 216765e7b..000000000 --- a/tests/nodes/reduce_sum_fp8x23_2D_keepdims/output_0.cairo +++ /dev/null @@ -1,15 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorMul}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 16777216, sign: false }); - data.append(FP8x23 { mag: 33554432, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/reduce_sum_i32_1D/input_0.cairo b/tests/nodes/reduce_sum_i32_1D/input_0.cairo deleted file mode 100644 index 064a0d4e6..000000000 --- a/tests/nodes/reduce_sum_i32_1D/input_0.cairo +++ /dev/null @@ -1,14 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorMul}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/reduce_sum_i32_1D/output_0.cairo b/tests/nodes/reduce_sum_i32_1D/output_0.cairo deleted file mode 100644 index 286549beb..000000000 --- a/tests/nodes/reduce_sum_i32_1D/output_0.cairo +++ /dev/null @@ -1,12 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorMul}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - - let mut data = ArrayTrait::new(); - data.append(3); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/reduce_sum_i32_2D_axis_1.cairo b/tests/nodes/reduce_sum_i32_2D_axis_1.cairo deleted file mode 100644 index b67a7691d..000000000 --- a/tests/nodes/reduce_sum_i32_2D_axis_1.cairo +++ /dev/null @@ -1,20 +0,0 @@ -mod input_0; -mod output_0; - - -use orion::utils::{assert_eq, assert_seq_eq}; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::I32TensorPartialEq; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorMul}; - -#[test] -#[available_gas(2000000000)] -fn test_reduce_sum_i32_2D_axis_1() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.reduce_sum(1, false); - - assert_eq(y, z); -} diff --git a/tests/nodes/reduce_sum_i32_2D_axis_1/input_0.cairo b/tests/nodes/reduce_sum_i32_2D_axis_1/input_0.cairo deleted file mode 100644 index bb508695d..000000000 --- a/tests/nodes/reduce_sum_i32_2D_axis_1/input_0.cairo +++ /dev/null @@ -1,16 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorMul}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/reduce_sum_i32_2D_default.cairo b/tests/nodes/reduce_sum_i32_2D_default.cairo deleted file mode 100644 index a0428f46d..000000000 --- a/tests/nodes/reduce_sum_i32_2D_default.cairo +++ /dev/null @@ -1,20 +0,0 @@ -mod input_0; -mod output_0; - - -use orion::utils::{assert_eq, assert_seq_eq}; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::I32TensorPartialEq; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorMul}; - -#[test] -#[available_gas(2000000000)] -fn test_reduce_sum_i32_2D_default() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.reduce_sum(0, false); - - assert_eq(y, z); -} diff --git a/tests/nodes/reduce_sum_i32_2D_default/input_0.cairo b/tests/nodes/reduce_sum_i32_2D_default/input_0.cairo deleted file mode 100644 index bb508695d..000000000 --- a/tests/nodes/reduce_sum_i32_2D_default/input_0.cairo +++ /dev/null @@ -1,16 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorMul}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/reduce_sum_i32_2D_default/output_0.cairo b/tests/nodes/reduce_sum_i32_2D_default/output_0.cairo deleted file mode 100644 index 925b8f6c2..000000000 --- a/tests/nodes/reduce_sum_i32_2D_default/output_0.cairo +++ /dev/null @@ -1,13 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorMul}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(2); - data.append(4); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/reduce_sum_i32_2D_keepdims.cairo b/tests/nodes/reduce_sum_i32_2D_keepdims.cairo deleted file mode 100644 index acac6e0f5..000000000 --- a/tests/nodes/reduce_sum_i32_2D_keepdims.cairo +++ /dev/null @@ -1,20 +0,0 @@ -mod input_0; -mod output_0; - - -use orion::utils::{assert_eq, assert_seq_eq}; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::I32TensorPartialEq; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorMul}; - -#[test] -#[available_gas(2000000000)] -fn test_reduce_sum_i32_2D_keepdims() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.reduce_sum(0, true); - - assert_eq(y, z); -} diff --git a/tests/nodes/reduce_sum_i32_2D_keepdims/input_0.cairo b/tests/nodes/reduce_sum_i32_2D_keepdims/input_0.cairo deleted file mode 100644 index bb508695d..000000000 --- a/tests/nodes/reduce_sum_i32_2D_keepdims/input_0.cairo +++ /dev/null @@ -1,16 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorMul}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(3); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/reduce_sum_i8_1D.cairo b/tests/nodes/reduce_sum_i8_1D.cairo deleted file mode 100644 index 0d8424333..000000000 --- a/tests/nodes/reduce_sum_i8_1D.cairo +++ /dev/null @@ -1,20 +0,0 @@ -mod input_0; -mod output_0; - - -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorMul}; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::FP8x23TensorPartialEq; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_reduce_sum_i8_1D() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.reduce_sum(0, false); - - assert_eq(y, z); -} diff --git a/tests/nodes/reduce_sum_i8_1D/input_0.cairo b/tests/nodes/reduce_sum_i8_1D/input_0.cairo deleted file mode 100644 index 3d963b8f3..000000000 --- a/tests/nodes/reduce_sum_i8_1D/input_0.cairo +++ /dev/null @@ -1,15 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorMul}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(3); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 0, sign: false }); - data.append(FP8x23 { mag: 1, sign: false }); - data.append(FP8x23 { mag: 2, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/reduce_sum_i8_1D/output_0.cairo b/tests/nodes/reduce_sum_i8_1D/output_0.cairo deleted file mode 100644 index c2d0723f9..000000000 --- a/tests/nodes/reduce_sum_i8_1D/output_0.cairo +++ /dev/null @@ -1,13 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorMul}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 3, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/reduce_sum_i8_2D_axis_1.cairo b/tests/nodes/reduce_sum_i8_2D_axis_1.cairo deleted file mode 100644 index 1d4fb2700..000000000 --- a/tests/nodes/reduce_sum_i8_2D_axis_1.cairo +++ /dev/null @@ -1,20 +0,0 @@ -mod input_0; -mod output_0; - - -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorMul}; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::FP8x23TensorPartialEq; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_reduce_sum_i8_2D_axis_1() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.reduce_sum(1, false); - - assert_eq(y, z); -} diff --git a/tests/nodes/reduce_sum_i8_2D_axis_1/input_0.cairo b/tests/nodes/reduce_sum_i8_2D_axis_1/input_0.cairo deleted file mode 100644 index 4c38e1659..000000000 --- a/tests/nodes/reduce_sum_i8_2D_axis_1/input_0.cairo +++ /dev/null @@ -1,17 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorMul}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 0, sign: false }); - data.append(FP8x23 { mag: 1, sign: false }); - data.append(FP8x23 { mag: 2, sign: false }); - data.append(FP8x23 { mag: 3, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/reduce_sum_i8_2D_axis_1/output_0.cairo b/tests/nodes/reduce_sum_i8_2D_axis_1/output_0.cairo deleted file mode 100644 index a9a7cd3ae..000000000 --- a/tests/nodes/reduce_sum_i8_2D_axis_1/output_0.cairo +++ /dev/null @@ -1,14 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorMul}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 1, sign: false }); - data.append(FP8x23 { mag: 5, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/reduce_sum_i8_2D_default.cairo b/tests/nodes/reduce_sum_i8_2D_default.cairo deleted file mode 100644 index 4875dc77c..000000000 --- a/tests/nodes/reduce_sum_i8_2D_default.cairo +++ /dev/null @@ -1,20 +0,0 @@ -mod input_0; -mod output_0; - - -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorMul}; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::FP8x23TensorPartialEq; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_reduce_sum_i8_2D_default() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.reduce_sum(0, false); - - assert_eq(y, z); -} diff --git a/tests/nodes/reduce_sum_i8_2D_default/input_0.cairo b/tests/nodes/reduce_sum_i8_2D_default/input_0.cairo deleted file mode 100644 index 4c38e1659..000000000 --- a/tests/nodes/reduce_sum_i8_2D_default/input_0.cairo +++ /dev/null @@ -1,17 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorMul}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 0, sign: false }); - data.append(FP8x23 { mag: 1, sign: false }); - data.append(FP8x23 { mag: 2, sign: false }); - data.append(FP8x23 { mag: 3, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/reduce_sum_i8_2D_default/output_0.cairo b/tests/nodes/reduce_sum_i8_2D_default/output_0.cairo deleted file mode 100644 index a517b5dca..000000000 --- a/tests/nodes/reduce_sum_i8_2D_default/output_0.cairo +++ /dev/null @@ -1,14 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorMul}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 2, sign: false }); - data.append(FP8x23 { mag: 4, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/reduce_sum_i8_2D_keepdims.cairo b/tests/nodes/reduce_sum_i8_2D_keepdims.cairo deleted file mode 100644 index 98172e256..000000000 --- a/tests/nodes/reduce_sum_i8_2D_keepdims.cairo +++ /dev/null @@ -1,20 +0,0 @@ -mod input_0; -mod output_0; - - -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorMul}; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::FP8x23TensorPartialEq; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; - -#[test] -#[available_gas(2000000000)] -fn test_reduce_sum_i8_2D_keepdims() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = input_0.reduce_sum(0, true); - - assert_eq(y, z); -} diff --git a/tests/nodes/reduce_sum_i8_2D_keepdims/input_0.cairo b/tests/nodes/reduce_sum_i8_2D_keepdims/input_0.cairo deleted file mode 100644 index 4c38e1659..000000000 --- a/tests/nodes/reduce_sum_i8_2D_keepdims/input_0.cairo +++ /dev/null @@ -1,17 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorMul}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 0, sign: false }); - data.append(FP8x23 { mag: 1, sign: false }); - data.append(FP8x23 { mag: 2, sign: false }); - data.append(FP8x23 { mag: 3, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/reduce_sum_i8_2D_keepdims/output_0.cairo b/tests/nodes/reduce_sum_i8_2D_keepdims/output_0.cairo deleted file mode 100644 index ef122111b..000000000 --- a/tests/nodes/reduce_sum_i8_2D_keepdims/output_0.cairo +++ /dev/null @@ -1,15 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorMul}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(1); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 2, sign: false }); - data.append(FP8x23 { mag: 4, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/gather_u32_3d_default.cairo b/tests/nodes/reduce_sum_keep_dims.cairo similarity index 72% rename from tests/nodes/gather_u32_3d_default.cairo rename to tests/nodes/reduce_sum_keep_dims.cairo index 8f223c4af..19a37247a 100644 --- a/tests/nodes/gather_u32_3d_default.cairo +++ b/tests/nodes/reduce_sum_keep_dims.cairo @@ -1,22 +1,20 @@ mod input_0; -mod input_1; mod output_0; use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::{U32Tensor, U32TensorAdd}; use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::U32TensorPartialEq; #[test] #[available_gas(2000000000)] -fn test_gather_u32_3d_default() { +fn test_reduce_sum_keep_dims() { let input_0 = input_0::input_0(); - let input_1 = input_1::input_1(); let z_0 = output_0::output_0(); - let y_0 = input_0.gather(indices: input_1, axis: Option::Some(0)); + let y_0 = input_0.reduce_sum(Option::Some(array![1].span()), Option::Some(true), Option::None); assert_eq(y_0, z_0); } diff --git a/tests/nodes/reduce_sum_keep_dims/input_0.cairo b/tests/nodes/reduce_sum_keep_dims/input_0.cairo new file mode 100644 index 000000000..2de5818c3 --- /dev/null +++ b/tests/nodes/reduce_sum_keep_dims/input_0.cairo @@ -0,0 +1,26 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::numbers::NumberTrait; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(3); + shape.append(2); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(1); + data.append(2); + data.append(3); + data.append(4); + data.append(5); + data.append(6); + data.append(7); + data.append(8); + data.append(9); + data.append(10); + data.append(11); + data.append(12); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/gather_fp8x23_3d_default/input_1.cairo b/tests/nodes/reduce_sum_keep_dims/output_0.cairo similarity index 67% rename from tests/nodes/gather_fp8x23_3d_default/input_1.cairo rename to tests/nodes/reduce_sum_keep_dims/output_0.cairo index b30e2f0c2..5326997d6 100644 --- a/tests/nodes/gather_fp8x23_3d_default/input_1.cairo +++ b/tests/nodes/reduce_sum_keep_dims/output_0.cairo @@ -3,17 +3,18 @@ use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::{U32Tensor, U32TensorAdd}; use orion::numbers::NumberTrait; -fn input_1() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(3); + shape.append(1); shape.append(2); let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(1); - data.append(0); - data.append(2); + data.append(4); + data.append(6); + data.append(12); + data.append(14); + data.append(20); + data.append(22); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/reduce_sum_negative_axes_keepdims.cairo b/tests/nodes/reduce_sum_negative_axes_keepdims.cairo new file mode 100644 index 000000000..4c271c091 --- /dev/null +++ b/tests/nodes/reduce_sum_negative_axes_keepdims.cairo @@ -0,0 +1,20 @@ +mod input_0; +mod output_0; + + +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::U32TensorPartialEq; + +#[test] +#[available_gas(2000000000)] +fn test_reduce_sum_negative_axes_keepdims() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let y_0 = input_0.reduce_sum(Option::Some(array![-2].span()), Option::Some(true), Option::None); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/reduce_sum_negative_axes_keepdims/input_0.cairo b/tests/nodes/reduce_sum_negative_axes_keepdims/input_0.cairo new file mode 100644 index 000000000..2de5818c3 --- /dev/null +++ b/tests/nodes/reduce_sum_negative_axes_keepdims/input_0.cairo @@ -0,0 +1,26 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::numbers::NumberTrait; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(3); + shape.append(2); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(1); + data.append(2); + data.append(3); + data.append(4); + data.append(5); + data.append(6); + data.append(7); + data.append(8); + data.append(9); + data.append(10); + data.append(11); + data.append(12); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/gather_i32_3d_axis1/input_1.cairo b/tests/nodes/reduce_sum_negative_axes_keepdims/output_0.cairo similarity index 67% rename from tests/nodes/gather_i32_3d_axis1/input_1.cairo rename to tests/nodes/reduce_sum_negative_axes_keepdims/output_0.cairo index b30e2f0c2..5326997d6 100644 --- a/tests/nodes/gather_i32_3d_axis1/input_1.cairo +++ b/tests/nodes/reduce_sum_negative_axes_keepdims/output_0.cairo @@ -3,17 +3,18 @@ use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::{U32Tensor, U32TensorAdd}; use orion::numbers::NumberTrait; -fn input_1() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(3); + shape.append(1); shape.append(2); let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(1); - data.append(0); - data.append(2); + data.append(4); + data.append(6); + data.append(12); + data.append(14); + data.append(20); + data.append(22); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/argmax_u32_1D_default.cairo b/tests/nodes/reduce_sum_no_keep_dims.cairo similarity index 64% rename from tests/nodes/argmax_u32_1D_default.cairo rename to tests/nodes/reduce_sum_no_keep_dims.cairo index f8bf64a5b..78c1c0c66 100644 --- a/tests/nodes/argmax_u32_1D_default.cairo +++ b/tests/nodes/reduce_sum_no_keep_dims.cairo @@ -2,19 +2,19 @@ mod input_0; mod output_0; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::U32TensorPartialEq; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; use orion::utils::{assert_eq, assert_seq_eq}; use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::U32TensorPartialEq; #[test] #[available_gas(2000000000)] -fn test_argmax_u32_1D_default() { +fn test_reduce_sum_no_keep_dims() { let input_0 = input_0::input_0(); - let z = output_0::output_0(); + let z_0 = output_0::output_0(); - let y = input_0.argmax(0, Option::None(()), Option::None(())); + let y_0 = input_0.reduce_sum(Option::Some(array![1].span()), Option::Some(false), Option::None); - assert_eq(y, z); + assert_eq(y_0, z_0); } diff --git a/tests/nodes/reduce_sum_no_keep_dims/input_0.cairo b/tests/nodes/reduce_sum_no_keep_dims/input_0.cairo new file mode 100644 index 000000000..2de5818c3 --- /dev/null +++ b/tests/nodes/reduce_sum_no_keep_dims/input_0.cairo @@ -0,0 +1,26 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{U32Tensor, U32TensorAdd}; +use orion::numbers::NumberTrait; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(3); + shape.append(2); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(1); + data.append(2); + data.append(3); + data.append(4); + data.append(5); + data.append(6); + data.append(7); + data.append(8); + data.append(9); + data.append(10); + data.append(11); + data.append(12); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/gather_fp8x23_3d_axis2/input_1.cairo b/tests/nodes/reduce_sum_no_keep_dims/output_0.cairo similarity index 70% rename from tests/nodes/gather_fp8x23_3d_axis2/input_1.cairo rename to tests/nodes/reduce_sum_no_keep_dims/output_0.cairo index b30e2f0c2..72c71a185 100644 --- a/tests/nodes/gather_fp8x23_3d_axis2/input_1.cairo +++ b/tests/nodes/reduce_sum_no_keep_dims/output_0.cairo @@ -3,17 +3,17 @@ use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::{U32Tensor, U32TensorAdd}; use orion::numbers::NumberTrait; -fn input_1() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(3); shape.append(2); let mut data = ArrayTrait::new(); - data.append(0); - data.append(1); - data.append(2); - data.append(1); - data.append(0); - data.append(2); + data.append(4); + data.append(6); + data.append(12); + data.append(14); + data.append(20); + data.append(22); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/reshape_extended_dims.cairo b/tests/nodes/reshape_extended_dims.cairo new file mode 100644 index 000000000..00564f8d9 --- /dev/null +++ b/tests/nodes/reshape_extended_dims.cairo @@ -0,0 +1,20 @@ +mod input_0; +mod output_0; + + +use orion::utils::{assert_eq, assert_seq_eq}; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::I32TensorPartialEq; + +#[test] +#[available_gas(2000000000)] +fn test_reshape_extended_dims() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let y_0 = input_0.reshape(array![2, 3, 2, 2].span(), false); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/gather_elements_i32_3d_axis1/input_1.cairo b/tests/nodes/reshape_extended_dims/input_0.cairo similarity index 66% rename from tests/nodes/gather_elements_i32_3d_axis1/input_1.cairo rename to tests/nodes/reshape_extended_dims/input_0.cairo index 92e1ce88d..1bf8d2578 100644 --- a/tests/nodes/gather_elements_i32_3d_axis1/input_1.cairo +++ b/tests/nodes/reshape_extended_dims/input_0.cairo @@ -1,48 +1,37 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn input_1() -> Tensor { +fn input_0() -> Tensor { let mut shape = ArrayTrait::::new(); - shape.append(4); - shape.append(3); + shape.append(2); shape.append(3); + shape.append(4); let mut data = ArrayTrait::new(); data.append(0); data.append(0); data.append(0); data.append(0); - data.append(1); data.append(0); data.append(0); data.append(0); - data.append(1); data.append(0); - data.append(1); - data.append(1); - data.append(1); data.append(0); data.append(0); data.append(0); data.append(0); data.append(0); - data.append(1); - data.append(1); data.append(0); data.append(0); data.append(0); data.append(0); - data.append(1); - data.append(1); data.append(0); data.append(0); - data.append(1); data.append(0); - data.append(1); - data.append(1); data.append(0); - data.append(1); + data.append(0); data.append(0); data.append(0); TensorTrait::new(shape.span(), data.span()) diff --git a/tests/nodes/gather_elements_i32_3d_default/input_1.cairo b/tests/nodes/reshape_extended_dims/output_0.cairo similarity index 60% rename from tests/nodes/gather_elements_i32_3d_default/input_1.cairo rename to tests/nodes/reshape_extended_dims/output_0.cairo index 8a1527e8a..de2f5850b 100644 --- a/tests/nodes/gather_elements_i32_3d_default/input_1.cairo +++ b/tests/nodes/reshape_extended_dims/output_0.cairo @@ -1,43 +1,39 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn input_1() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); - shape.append(5); shape.append(2); shape.append(3); + shape.append(2); + shape.append(2); let mut data = ArrayTrait::new(); data.append(0); - data.append(1); data.append(0); - data.append(1); - data.append(1); data.append(0); - data.append(1); - data.append(1); - data.append(1); - data.append(1); data.append(0); data.append(0); data.append(0); data.append(0); data.append(0); data.append(0); - data.append(1); data.append(0); data.append(0); - data.append(1); data.append(0); data.append(0); - data.append(1); data.append(0); data.append(0); - data.append(1); - data.append(1); - data.append(1); data.append(0); - data.append(1); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/reshape_negative_dim.cairo b/tests/nodes/reshape_negative_dim.cairo new file mode 100644 index 000000000..cd6921d7b --- /dev/null +++ b/tests/nodes/reshape_negative_dim.cairo @@ -0,0 +1,20 @@ +mod input_0; +mod output_0; + + +use orion::utils::{assert_eq, assert_seq_eq}; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::I32TensorPartialEq; + +#[test] +#[available_gas(2000000000)] +fn test_reshape_negative_dim() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let y_0 = input_0.reshape(array![2, -1, 2].span(), false); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/gather_elements_i32_3d_axis2/input_1.cairo b/tests/nodes/reshape_negative_dim/input_0.cairo similarity index 64% rename from tests/nodes/gather_elements_i32_3d_axis2/input_1.cairo rename to tests/nodes/reshape_negative_dim/input_0.cairo index ab202801d..1bf8d2578 100644 --- a/tests/nodes/gather_elements_i32_3d_axis2/input_1.cairo +++ b/tests/nodes/reshape_negative_dim/input_0.cairo @@ -1,44 +1,37 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{U32Tensor, U32TensorSub}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn input_1() -> Tensor { +fn input_0() -> Tensor { let mut shape = ArrayTrait::::new(); - shape.append(4); shape.append(2); + shape.append(3); shape.append(4); let mut data = ArrayTrait::new(); - data.append(1); data.append(0); data.append(0); data.append(0); - data.append(1); - data.append(1); data.append(0); data.append(0); data.append(0); - data.append(1); - data.append(1); data.append(0); data.append(0); - data.append(1); data.append(0); data.append(0); - data.append(1); data.append(0); data.append(0); - data.append(1); data.append(0); - data.append(1); data.append(0); - data.append(1); - data.append(1); - data.append(1); data.append(0); data.append(0); data.append(0); - data.append(1); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); data.append(0); data.append(0); TensorTrait::new(shape.span(), data.span()) diff --git a/tests/nodes/reshape_negative_dim/output_0.cairo b/tests/nodes/reshape_negative_dim/output_0.cairo new file mode 100644 index 000000000..ad355bfd6 --- /dev/null +++ b/tests/nodes/reshape_negative_dim/output_0.cairo @@ -0,0 +1,38 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(2); + shape.append(6); + shape.append(2); + + let mut data = ArrayTrait::new(); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/argmax_i32_2D_default.cairo b/tests/nodes/reshape_negative_extended_dims.cairo similarity index 57% rename from tests/nodes/argmax_i32_2D_default.cairo rename to tests/nodes/reshape_negative_extended_dims.cairo index 1d8e4b3f7..271cad3f2 100644 --- a/tests/nodes/argmax_i32_2D_default.cairo +++ b/tests/nodes/reshape_negative_extended_dims.cairo @@ -2,21 +2,19 @@ mod input_0; mod output_0; -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{U32Tensor, U32TensorAdd}; -use orion::operators::tensor::U32TensorPartialEq; use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::tensor::I32TensorPartialEq; +use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{I32Tensor, I32TensorAdd}; use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::I32TensorPartialEq; #[test] #[available_gas(2000000000)] -fn test_argmax_i32_2D_default() { +fn test_reshape_negative_extended_dims() { let input_0 = input_0::input_0(); - let z = output_0::output_0(); + let z_0 = output_0::output_0(); - let y = input_0.argmax(0, Option::None(()), Option::None(())); + let y_0 = input_0.reshape(array![-1, 2, 3, 4].span(), false); - assert_eq(y, z); + assert_eq(y_0, z_0); } diff --git a/tests/nodes/reshape_negative_extended_dims/input_0.cairo b/tests/nodes/reshape_negative_extended_dims/input_0.cairo new file mode 100644 index 000000000..1bf8d2578 --- /dev/null +++ b/tests/nodes/reshape_negative_extended_dims/input_0.cairo @@ -0,0 +1,38 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(2); + shape.append(3); + shape.append(4); + + let mut data = ArrayTrait::new(); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/reshape_negative_extended_dims/output_0.cairo b/tests/nodes/reshape_negative_extended_dims/output_0.cairo new file mode 100644 index 000000000..66d21516d --- /dev/null +++ b/tests/nodes/reshape_negative_extended_dims/output_0.cairo @@ -0,0 +1,39 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(1); + shape.append(2); + shape.append(3); + shape.append(4); + + let mut data = ArrayTrait::new(); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/reduce_sum_i32_1D.cairo b/tests/nodes/reshape_one_dim.cairo similarity index 59% rename from tests/nodes/reduce_sum_i32_1D.cairo rename to tests/nodes/reshape_one_dim.cairo index 7a31579df..f55ccc386 100644 --- a/tests/nodes/reduce_sum_i32_1D.cairo +++ b/tests/nodes/reshape_one_dim.cairo @@ -4,17 +4,17 @@ mod output_0; use orion::utils::{assert_eq, assert_seq_eq}; use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::I32TensorPartialEq; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{I32Tensor, I32TensorMul}; +use orion::operators::tensor::I32TensorPartialEq; #[test] #[available_gas(2000000000)] -fn test_reduce_sum_i32_1D() { +fn test_reshape_one_dim() { let input_0 = input_0::input_0(); - let z = output_0::output_0(); + let z_0 = output_0::output_0(); - let y = input_0.reduce_sum(0, false); + let y_0 = input_0.reshape(array![24].span(), false); - assert_eq(y, z); + assert_eq(y_0, z_0); } diff --git a/tests/nodes/reshape_one_dim/input_0.cairo b/tests/nodes/reshape_one_dim/input_0.cairo new file mode 100644 index 000000000..1bf8d2578 --- /dev/null +++ b/tests/nodes/reshape_one_dim/input_0.cairo @@ -0,0 +1,38 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(2); + shape.append(3); + shape.append(4); + + let mut data = ArrayTrait::new(); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/reshape_one_dim/output_0.cairo b/tests/nodes/reshape_one_dim/output_0.cairo new file mode 100644 index 000000000..a6ad8efcb --- /dev/null +++ b/tests/nodes/reshape_one_dim/output_0.cairo @@ -0,0 +1,36 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(24); + + let mut data = ArrayTrait::new(); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/reshape_reduced_dims.cairo b/tests/nodes/reshape_reduced_dims.cairo new file mode 100644 index 000000000..7952505d1 --- /dev/null +++ b/tests/nodes/reshape_reduced_dims.cairo @@ -0,0 +1,20 @@ +mod input_0; +mod output_0; + + +use orion::utils::{assert_eq, assert_seq_eq}; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::I32TensorPartialEq; + +#[test] +#[available_gas(2000000000)] +fn test_reshape_reduced_dims() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let y_0 = input_0.reshape(array![2,12].span(), false); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/reshape_reduced_dims/input_0.cairo b/tests/nodes/reshape_reduced_dims/input_0.cairo new file mode 100644 index 000000000..1bf8d2578 --- /dev/null +++ b/tests/nodes/reshape_reduced_dims/input_0.cairo @@ -0,0 +1,38 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(2); + shape.append(3); + shape.append(4); + + let mut data = ArrayTrait::new(); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/reshape_reduced_dims/output_0.cairo b/tests/nodes/reshape_reduced_dims/output_0.cairo new file mode 100644 index 000000000..3ab9777df --- /dev/null +++ b/tests/nodes/reshape_reduced_dims/output_0.cairo @@ -0,0 +1,37 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(2); + shape.append(12); + + let mut data = ArrayTrait::new(); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/reshape_reordered_all_dims.cairo b/tests/nodes/reshape_reordered_all_dims.cairo new file mode 100644 index 000000000..237c867c2 --- /dev/null +++ b/tests/nodes/reshape_reordered_all_dims.cairo @@ -0,0 +1,20 @@ +mod input_0; +mod output_0; + + +use orion::utils::{assert_eq, assert_seq_eq}; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::I32TensorPartialEq; + +#[test] +#[available_gas(2000000000)] +fn test_reshape_reordered_all_dims() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let y_0 = input_0.reshape(array![4,2,3].span(), false); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/reshape_reordered_all_dims/input_0.cairo b/tests/nodes/reshape_reordered_all_dims/input_0.cairo new file mode 100644 index 000000000..1bf8d2578 --- /dev/null +++ b/tests/nodes/reshape_reordered_all_dims/input_0.cairo @@ -0,0 +1,38 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(2); + shape.append(3); + shape.append(4); + + let mut data = ArrayTrait::new(); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/reshape_reordered_all_dims/output_0.cairo b/tests/nodes/reshape_reordered_all_dims/output_0.cairo new file mode 100644 index 000000000..2308361dc --- /dev/null +++ b/tests/nodes/reshape_reordered_all_dims/output_0.cairo @@ -0,0 +1,38 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(4); + shape.append(2); + shape.append(3); + + let mut data = ArrayTrait::new(); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/reshape_reordered_last_dims.cairo b/tests/nodes/reshape_reordered_last_dims.cairo new file mode 100644 index 000000000..5c5f4fd7e --- /dev/null +++ b/tests/nodes/reshape_reordered_last_dims.cairo @@ -0,0 +1,20 @@ +mod input_0; +mod output_0; + + +use orion::utils::{assert_eq, assert_seq_eq}; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::I32TensorPartialEq; + +#[test] +#[available_gas(2000000000)] +fn test_reshape_reordered_last_dims() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let y_0 = input_0.reshape(array![2,4,3].span(), false); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/reshape_reordered_last_dims/input_0.cairo b/tests/nodes/reshape_reordered_last_dims/input_0.cairo new file mode 100644 index 000000000..1bf8d2578 --- /dev/null +++ b/tests/nodes/reshape_reordered_last_dims/input_0.cairo @@ -0,0 +1,38 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(2); + shape.append(3); + shape.append(4); + + let mut data = ArrayTrait::new(); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/reshape_reordered_last_dims/output_0.cairo b/tests/nodes/reshape_reordered_last_dims/output_0.cairo new file mode 100644 index 000000000..bb307aeb5 --- /dev/null +++ b/tests/nodes/reshape_reordered_last_dims/output_0.cairo @@ -0,0 +1,38 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(2); + shape.append(4); + shape.append(3); + + let mut data = ArrayTrait::new(); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/reshape_zero_and_negative_dim.cairo b/tests/nodes/reshape_zero_and_negative_dim.cairo new file mode 100644 index 000000000..3f4f3230d --- /dev/null +++ b/tests/nodes/reshape_zero_and_negative_dim.cairo @@ -0,0 +1,20 @@ +mod input_0; +mod output_0; + + +use orion::utils::{assert_eq, assert_seq_eq}; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::I32TensorPartialEq; + +#[test] +#[available_gas(2000000000)] +fn test_reshape_zero_and_negative_dim() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let y_0 = input_0.reshape(array![3, 4, 0].span(), true); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/argmax_i32_1D_default/input_0.cairo b/tests/nodes/reshape_zero_and_negative_dim/input_0.cairo similarity index 81% rename from tests/nodes/argmax_i32_1D_default/input_0.cairo rename to tests/nodes/reshape_zero_and_negative_dim/input_0.cairo index 97fbd451a..f8da52ecd 100644 --- a/tests/nodes/argmax_i32_1D_default/input_0.cairo +++ b/tests/nodes/reshape_zero_and_negative_dim/input_0.cairo @@ -1,14 +1,14 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; fn input_0() -> Tensor { let mut shape = ArrayTrait::::new(); + shape.append(0); shape.append(3); + shape.append(4); let mut data = ArrayTrait::new(); - data.append(-54); - data.append(29); - data.append(81); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/argmax_i32_1D_keepdims_false/input_0.cairo b/tests/nodes/reshape_zero_and_negative_dim/output_0.cairo similarity index 74% rename from tests/nodes/argmax_i32_1D_keepdims_false/input_0.cairo rename to tests/nodes/reshape_zero_and_negative_dim/output_0.cairo index 7a2414371..7cec007a8 100644 --- a/tests/nodes/argmax_i32_1D_keepdims_false/input_0.cairo +++ b/tests/nodes/reshape_zero_and_negative_dim/output_0.cairo @@ -1,14 +1,14 @@ use core::array::{ArrayTrait, SpanTrait}; use orion::operators::tensor::{TensorTrait, Tensor}; use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; -fn input_0() -> Tensor { +fn output_0() -> Tensor { let mut shape = ArrayTrait::::new(); shape.append(3); + shape.append(4); + shape.append(0); let mut data = ArrayTrait::new(); - data.append(-69); - data.append(51); - data.append(-49); TensorTrait::new(shape.span(), data.span()) } diff --git a/tests/nodes/reshape_zero_dim.cairo b/tests/nodes/reshape_zero_dim.cairo new file mode 100644 index 000000000..95d8d6620 --- /dev/null +++ b/tests/nodes/reshape_zero_dim.cairo @@ -0,0 +1,20 @@ +mod input_0; +mod output_0; + + +use orion::utils::{assert_eq, assert_seq_eq}; +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::I32TensorPartialEq; + +#[test] +#[available_gas(2000000000)] +fn test_reshape_zero_dim() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let y_0 = input_0.reshape(array![2, 0, 4, 1].span(), false); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/reshape_zero_dim/input_0.cairo b/tests/nodes/reshape_zero_dim/input_0.cairo new file mode 100644 index 000000000..1bf8d2578 --- /dev/null +++ b/tests/nodes/reshape_zero_dim/input_0.cairo @@ -0,0 +1,38 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(2); + shape.append(3); + shape.append(4); + + let mut data = ArrayTrait::new(); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/reshape_zero_dim/output_0.cairo b/tests/nodes/reshape_zero_dim/output_0.cairo new file mode 100644 index 000000000..4c6823a34 --- /dev/null +++ b/tests/nodes/reshape_zero_dim/output_0.cairo @@ -0,0 +1,39 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{I32Tensor, I32TensorAdd}; +use orion::numbers::NumberTrait; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(2); + shape.append(3); + shape.append(4); + shape.append(1); + + let mut data = ArrayTrait::new(); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + data.append(0); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/softmax_fp16x16.cairo b/tests/nodes/softmax_axis_0.cairo similarity index 68% rename from tests/nodes/softmax_fp16x16.cairo rename to tests/nodes/softmax_axis_0.cairo index 84fe1cf3d..135107f47 100644 --- a/tests/nodes/softmax_fp16x16.cairo +++ b/tests/nodes/softmax_axis_0.cairo @@ -2,19 +2,19 @@ mod input_0; mod output_0; -use orion::operators::nn::NNTrait; -use orion::operators::tensor::FP16x16TensorPartialEq; +use orion::utils::{assert_eq, assert_seq_eq}; use orion::operators::nn::FP16x16NN; +use orion::operators::nn::NNTrait; use orion::numbers::FixedTrait; -use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::tensor::FP16x16TensorPartialEq; #[test] #[available_gas(2000000000)] -fn test_softmax_fp16x16() { +fn test_softmax_axis_0() { let input_0 = input_0::input_0(); - let z = output_0::output_0(); + let z_0 = output_0::output_0(); - let y = NNTrait::softmax(@input_0, 1); + let y_0 = NNTrait::softmax(@input_0, Option::Some(0)); - assert_eq(y, z); + assert_eq(y_0, z_0); } diff --git a/tests/nodes/softmax_axis_0/input_0.cairo b/tests/nodes/softmax_axis_0/input_0.cairo new file mode 100644 index 000000000..b67797ca4 --- /dev/null +++ b/tests/nodes/softmax_axis_0/input_0.cairo @@ -0,0 +1,74 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(3); + shape.append(4); + shape.append(5); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 77748, sign: false }); + data.append(FP16x16 { mag: 20181, sign: false }); + data.append(FP16x16 { mag: 66586, sign: false }); + data.append(FP16x16 { mag: 39564, sign: false }); + data.append(FP16x16 { mag: 55469, sign: false }); + data.append(FP16x16 { mag: 15765, sign: false }); + data.append(FP16x16 { mag: 31745, sign: false }); + data.append(FP16x16 { mag: 64291, sign: false }); + data.append(FP16x16 { mag: 64704, sign: false }); + data.append(FP16x16 { mag: 95806, sign: false }); + data.append(FP16x16 { mag: 42434, sign: false }); + data.append(FP16x16 { mag: 107711, sign: false }); + data.append(FP16x16 { mag: 63051, sign: false }); + data.append(FP16x16 { mag: 93445, sign: false }); + data.append(FP16x16 { mag: 241, sign: false }); + data.append(FP16x16 { mag: 131759, sign: false }); + data.append(FP16x16 { mag: 74671, sign: false }); + data.append(FP16x16 { mag: 44973, sign: false }); + data.append(FP16x16 { mag: 92338, sign: false }); + data.append(FP16x16 { mag: 36204, sign: false }); + data.append(FP16x16 { mag: 12200, sign: false }); + data.append(FP16x16 { mag: 73821, sign: false }); + data.append(FP16x16 { mag: 13038, sign: false }); + data.append(FP16x16 { mag: 21598, sign: false }); + data.append(FP16x16 { mag: 75353, sign: false }); + data.append(FP16x16 { mag: 41470, sign: false }); + data.append(FP16x16 { mag: 11370, sign: false }); + data.append(FP16x16 { mag: 62793, sign: false }); + data.append(FP16x16 { mag: 19117, sign: false }); + data.append(FP16x16 { mag: 95800, sign: false }); + data.append(FP16x16 { mag: 40696, sign: false }); + data.append(FP16x16 { mag: 95240, sign: false }); + data.append(FP16x16 { mag: 103492, sign: false }); + data.append(FP16x16 { mag: 36412, sign: false }); + data.append(FP16x16 { mag: 22269, sign: false }); + data.append(FP16x16 { mag: 201968, sign: false }); + data.append(FP16x16 { mag: 40874, sign: false }); + data.append(FP16x16 { mag: 14038, sign: false }); + data.append(FP16x16 { mag: 55733, sign: false }); + data.append(FP16x16 { mag: 65120, sign: false }); + data.append(FP16x16 { mag: 128415, sign: false }); + data.append(FP16x16 { mag: 86247, sign: false }); + data.append(FP16x16 { mag: 47611, sign: false }); + data.append(FP16x16 { mag: 34746, sign: false }); + data.append(FP16x16 { mag: 23589, sign: false }); + data.append(FP16x16 { mag: 51498, sign: false }); + data.append(FP16x16 { mag: 6664, sign: false }); + data.append(FP16x16 { mag: 32348, sign: false }); + data.append(FP16x16 { mag: 31728, sign: false }); + data.append(FP16x16 { mag: 43457, sign: false }); + data.append(FP16x16 { mag: 41874, sign: false }); + data.append(FP16x16 { mag: 17514, sign: false }); + data.append(FP16x16 { mag: 42083, sign: false }); + data.append(FP16x16 { mag: 30365, sign: false }); + data.append(FP16x16 { mag: 133274, sign: false }); + data.append(FP16x16 { mag: 54633, sign: false }); + data.append(FP16x16 { mag: 168600, sign: false }); + data.append(FP16x16 { mag: 15559, sign: false }); + data.append(FP16x16 { mag: 50448, sign: false }); + data.append(FP16x16 { mag: 70775, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/softmax_axis_0/output_0.cairo b/tests/nodes/softmax_axis_0/output_0.cairo new file mode 100644 index 000000000..662d59d5b --- /dev/null +++ b/tests/nodes/softmax_axis_0/output_0.cairo @@ -0,0 +1,74 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(3); + shape.append(4); + shape.append(5); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 18542, sign: false }); + data.append(FP16x16 { mag: 10909, sign: false }); + data.append(FP16x16 { mag: 29920, sign: false }); + data.append(FP16x16 { mag: 24368, sign: false }); + data.append(FP16x16 { mag: 22071, sign: false }); + data.append(FP16x16 { mag: 15584, sign: false }); + data.append(FP16x16 { mag: 27139, sign: false }); + data.append(FP16x16 { mag: 25287, sign: false }); + data.append(FP16x16 { mag: 31157, sign: false }); + data.append(FP16x16 { mag: 26751, sign: false }); + data.append(FP16x16 { mag: 22100, sign: false }); + data.append(FP16x16 { mag: 31519, sign: false }); + data.append(FP16x16 { mag: 18307, sign: false }); + data.append(FP16x16 { mag: 36393, sign: false }); + data.append(FP16x16 { mag: 6545, sign: false }); + data.append(FP16x16 { mag: 15502, sign: false }); + data.append(FP16x16 { mag: 11319, sign: false }); + data.append(FP16x16 { mag: 28971, sign: false }); + data.append(FP16x16 { mag: 31211, sign: false }); + data.append(FP16x16 { mag: 15422, sign: false }); + data.append(FP16x16 { mag: 6820, sign: false }); + data.append(FP16x16 { mag: 24731, sign: false }); + data.append(FP16x16 { mag: 13216, sign: false }); + data.append(FP16x16 { mag: 18525, sign: false }); + data.append(FP16x16 { mag: 29894, sign: false }); + data.append(FP16x16 { mag: 23068, sign: false }); + data.append(FP16x16 { mag: 19887, sign: false }); + data.append(FP16x16 { mag: 24716, sign: false }); + data.append(FP16x16 { mag: 15540, sign: false }); + data.append(FP16x16 { mag: 26749, sign: false }); + data.append(FP16x16 { mag: 21522, sign: false }); + data.append(FP16x16 { mag: 26057, sign: false }); + data.append(FP16x16 { mag: 33933, sign: false }); + data.append(FP16x16 { mag: 15242, sign: false }); + data.append(FP16x16 { mag: 9159, sign: false }); + data.append(FP16x16 { mag: 45254, sign: false }); + data.append(FP16x16 { mag: 6759, sign: false }); + data.append(FP16x16 { mag: 18070, sign: false }); + data.append(FP16x16 { mag: 17854, sign: false }); + data.append(FP16x16 { mag: 23976, sign: false }); + data.append(FP16x16 { mag: 40173, sign: false }); + data.append(FP16x16 { mag: 29894, sign: false }); + data.append(FP16x16 { mag: 22398, sign: false }); + data.append(FP16x16 { mag: 22641, sign: false }); + data.append(FP16x16 { mag: 13569, sign: false }); + data.append(FP16x16 { mag: 26883, sign: false }); + data.append(FP16x16 { mag: 18509, sign: false }); + data.append(FP16x16 { mag: 15532, sign: false }); + data.append(FP16x16 { mag: 18838, sign: false }); + data.append(FP16x16 { mag: 12034, sign: false }); + data.append(FP16x16 { mag: 21912, sign: false }); + data.append(FP16x16 { mag: 7959, sign: false }); + data.append(FP16x16 { mag: 13294, sign: false }); + data.append(FP16x16 { mag: 13899, sign: false }); + data.append(FP16x16 { mag: 49831, sign: false }); + data.append(FP16x16 { mag: 4778, sign: false }); + data.append(FP16x16 { mag: 47456, sign: false }); + data.append(FP16x16 { mag: 18494, sign: false }); + data.append(FP16x16 { mag: 16470, sign: false }); + data.append(FP16x16 { mag: 26136, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/softmax_axis_1.cairo b/tests/nodes/softmax_axis_1.cairo new file mode 100644 index 000000000..74517830b --- /dev/null +++ b/tests/nodes/softmax_axis_1.cairo @@ -0,0 +1,20 @@ +mod input_0; +mod output_0; + + +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::nn::FP16x16NN; +use orion::operators::nn::NNTrait; +use orion::numbers::FixedTrait; +use orion::operators::tensor::FP16x16TensorPartialEq; + +#[test] +#[available_gas(2000000000)] +fn test_softmax_axis_1() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let y_0 = NNTrait::softmax(@input_0, Option::Some(1)); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/softmax_axis_1/input_0.cairo b/tests/nodes/softmax_axis_1/input_0.cairo new file mode 100644 index 000000000..84f011140 --- /dev/null +++ b/tests/nodes/softmax_axis_1/input_0.cairo @@ -0,0 +1,74 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(3); + shape.append(4); + shape.append(5); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 55504, sign: false }); + data.append(FP16x16 { mag: 131012, sign: false }); + data.append(FP16x16 { mag: 66466, sign: false }); + data.append(FP16x16 { mag: 15137, sign: false }); + data.append(FP16x16 { mag: 184134, sign: false }); + data.append(FP16x16 { mag: 45919, sign: false }); + data.append(FP16x16 { mag: 61072, sign: false }); + data.append(FP16x16 { mag: 18808, sign: false }); + data.append(FP16x16 { mag: 10438, sign: false }); + data.append(FP16x16 { mag: 28335, sign: false }); + data.append(FP16x16 { mag: 19320, sign: false }); + data.append(FP16x16 { mag: 18945, sign: false }); + data.append(FP16x16 { mag: 51241, sign: false }); + data.append(FP16x16 { mag: 29903, sign: false }); + data.append(FP16x16 { mag: 9030, sign: false }); + data.append(FP16x16 { mag: 112806, sign: false }); + data.append(FP16x16 { mag: 28939, sign: false }); + data.append(FP16x16 { mag: 112572, sign: false }); + data.append(FP16x16 { mag: 89990, sign: false }); + data.append(FP16x16 { mag: 87594, sign: false }); + data.append(FP16x16 { mag: 56996, sign: false }); + data.append(FP16x16 { mag: 31238, sign: false }); + data.append(FP16x16 { mag: 66896, sign: false }); + data.append(FP16x16 { mag: 37962, sign: false }); + data.append(FP16x16 { mag: 26194, sign: false }); + data.append(FP16x16 { mag: 59208, sign: false }); + data.append(FP16x16 { mag: 6005, sign: false }); + data.append(FP16x16 { mag: 16581, sign: false }); + data.append(FP16x16 { mag: 27378, sign: false }); + data.append(FP16x16 { mag: 59336, sign: false }); + data.append(FP16x16 { mag: 11513, sign: false }); + data.append(FP16x16 { mag: 12294, sign: false }); + data.append(FP16x16 { mag: 4336, sign: false }); + data.append(FP16x16 { mag: 111725, sign: false }); + data.append(FP16x16 { mag: 45307, sign: false }); + data.append(FP16x16 { mag: 145057, sign: false }); + data.append(FP16x16 { mag: 44365, sign: false }); + data.append(FP16x16 { mag: 80274, sign: false }); + data.append(FP16x16 { mag: 50643, sign: false }); + data.append(FP16x16 { mag: 39432, sign: false }); + data.append(FP16x16 { mag: 53176, sign: false }); + data.append(FP16x16 { mag: 202691, sign: false }); + data.append(FP16x16 { mag: 54389, sign: false }); + data.append(FP16x16 { mag: 125453, sign: false }); + data.append(FP16x16 { mag: 101533, sign: false }); + data.append(FP16x16 { mag: 2658, sign: false }); + data.append(FP16x16 { mag: 31411, sign: false }); + data.append(FP16x16 { mag: 44406, sign: false }); + data.append(FP16x16 { mag: 82774, sign: false }); + data.append(FP16x16 { mag: 36316, sign: false }); + data.append(FP16x16 { mag: 37737, sign: false }); + data.append(FP16x16 { mag: 5076, sign: false }); + data.append(FP16x16 { mag: 48499, sign: false }); + data.append(FP16x16 { mag: 3099, sign: false }); + data.append(FP16x16 { mag: 168018, sign: false }); + data.append(FP16x16 { mag: 18863, sign: false }); + data.append(FP16x16 { mag: 16555, sign: false }); + data.append(FP16x16 { mag: 4096, sign: false }); + data.append(FP16x16 { mag: 227, sign: false }); + data.append(FP16x16 { mag: 35060, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/softmax_axis_1/output_0.cairo b/tests/nodes/softmax_axis_1/output_0.cairo new file mode 100644 index 000000000..6421c06e1 --- /dev/null +++ b/tests/nodes/softmax_axis_1/output_0.cairo @@ -0,0 +1,74 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(3); + shape.append(4); + shape.append(5); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 13548, sign: false }); + data.append(FP16x16 { mag: 37762, sign: false }); + data.append(FP16x16 { mag: 15252, sign: false }); + data.append(FP16x16 { mag: 10374, sign: false }); + data.append(FP16x16 { mag: 47109, sign: false }); + data.append(FP16x16 { mag: 11705, sign: false }); + data.append(FP16x16 { mag: 12989, sign: false }); + data.append(FP16x16 { mag: 7370, sign: false }); + data.append(FP16x16 { mag: 9656, sign: false }); + data.append(FP16x16 { mag: 4371, sign: false }); + data.append(FP16x16 { mag: 7800, sign: false }); + data.append(FP16x16 { mag: 6829, sign: false }); + data.append(FP16x16 { mag: 12090, sign: false }); + data.append(FP16x16 { mag: 12996, sign: false }); + data.append(FP16x16 { mag: 3256, sign: false }); + data.append(FP16x16 { mag: 32481, sign: false }); + data.append(FP16x16 { mag: 7954, sign: false }); + data.append(FP16x16 { mag: 30822, sign: false }); + data.append(FP16x16 { mag: 32508, sign: false }); + data.append(FP16x16 { mag: 10798, sign: false }); + data.append(FP16x16 { mag: 10292, sign: false }); + data.append(FP16x16 { mag: 17949, sign: false }); + data.append(FP16x16 { mag: 21309, sign: false }); + data.append(FP16x16 { mag: 10662, sign: false }); + data.append(FP16x16 { mag: 12553, sign: false }); + data.append(FP16x16 { mag: 10646, sign: false }); + data.append(FP16x16 { mag: 12213, sign: false }); + data.append(FP16x16 { mag: 9888, sign: false }); + data.append(FP16x16 { mag: 9072, sign: false }); + data.append(FP16x16 { mag: 20815, sign: false }); + data.append(FP16x16 { mag: 5141, sign: false }); + data.append(FP16x16 { mag: 13443, sign: false }); + data.append(FP16x16 { mag: 8203, sign: false }); + data.append(FP16x16 { mag: 32861, sign: false }); + data.append(FP16x16 { mag: 16804, sign: false }); + data.append(FP16x16 { mag: 39454, sign: false }); + data.append(FP16x16 { mag: 21930, sign: false }); + data.append(FP16x16 { mag: 26134, sign: false }); + data.append(FP16x16 { mag: 12939, sign: false }); + data.append(FP16x16 { mag: 15363, sign: false }); + data.append(FP16x16 { mag: 23034, sign: false }); + data.append(FP16x16 { mag: 55505, sign: false }); + data.append(FP16x16 { mag: 20245, sign: false }); + data.append(FP16x16 { mag: 35930, sign: false }); + data.append(FP16x16 { mag: 14595, sign: false }); + data.append(FP16x16 { mag: 10656, sign: false }); + data.append(FP16x16 { mag: 4067, sign: false }); + data.append(FP16x16 { mag: 17385, sign: false }); + data.append(FP16x16 { mag: 18734, sign: false }); + data.append(FP16x16 { mag: 5395, sign: false }); + data.append(FP16x16 { mag: 18199, sign: false }); + data.append(FP16x16 { mag: 2721, sign: false }); + data.append(FP16x16 { mag: 18505, sign: false }); + data.append(FP16x16 { mag: 5554, sign: false }); + data.append(FP16x16 { mag: 40252, sign: false }); + data.append(FP16x16 { mag: 13645, sign: false }); + data.append(FP16x16 { mag: 3242, sign: false }); + data.append(FP16x16 { mag: 9398, sign: false }); + data.append(FP16x16 { mag: 5316, sign: false }); + data.append(FP16x16 { mag: 5293, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/softmax_axis_2.cairo b/tests/nodes/softmax_axis_2.cairo new file mode 100644 index 000000000..87e8f6320 --- /dev/null +++ b/tests/nodes/softmax_axis_2.cairo @@ -0,0 +1,20 @@ +mod input_0; +mod output_0; + + +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::nn::FP16x16NN; +use orion::operators::nn::NNTrait; +use orion::numbers::FixedTrait; +use orion::operators::tensor::FP16x16TensorPartialEq; + +#[test] +#[available_gas(2000000000)] +fn test_softmax_axis_2() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let y_0 = NNTrait::softmax(@input_0, Option::Some(2)); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/softmax_axis_2/input_0.cairo b/tests/nodes/softmax_axis_2/input_0.cairo new file mode 100644 index 000000000..4584fe371 --- /dev/null +++ b/tests/nodes/softmax_axis_2/input_0.cairo @@ -0,0 +1,74 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(3); + shape.append(4); + shape.append(5); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 58553, sign: false }); + data.append(FP16x16 { mag: 53519, sign: false }); + data.append(FP16x16 { mag: 57124, sign: false }); + data.append(FP16x16 { mag: 43576, sign: false }); + data.append(FP16x16 { mag: 41799, sign: false }); + data.append(FP16x16 { mag: 176139, sign: false }); + data.append(FP16x16 { mag: 41400, sign: false }); + data.append(FP16x16 { mag: 87597, sign: false }); + data.append(FP16x16 { mag: 15096, sign: false }); + data.append(FP16x16 { mag: 38563, sign: false }); + data.append(FP16x16 { mag: 52406, sign: false }); + data.append(FP16x16 { mag: 62539, sign: false }); + data.append(FP16x16 { mag: 54826, sign: false }); + data.append(FP16x16 { mag: 55549, sign: false }); + data.append(FP16x16 { mag: 14067, sign: false }); + data.append(FP16x16 { mag: 21619, sign: false }); + data.append(FP16x16 { mag: 40071, sign: false }); + data.append(FP16x16 { mag: 43510, sign: false }); + data.append(FP16x16 { mag: 39683, sign: false }); + data.append(FP16x16 { mag: 121524, sign: false }); + data.append(FP16x16 { mag: 82816, sign: false }); + data.append(FP16x16 { mag: 75559, sign: false }); + data.append(FP16x16 { mag: 66467, sign: false }); + data.append(FP16x16 { mag: 122834, sign: false }); + data.append(FP16x16 { mag: 88244, sign: false }); + data.append(FP16x16 { mag: 1460, sign: false }); + data.append(FP16x16 { mag: 37949, sign: false }); + data.append(FP16x16 { mag: 39839, sign: false }); + data.append(FP16x16 { mag: 741, sign: false }); + data.append(FP16x16 { mag: 63886, sign: false }); + data.append(FP16x16 { mag: 27798, sign: false }); + data.append(FP16x16 { mag: 122499, sign: false }); + data.append(FP16x16 { mag: 56745, sign: false }); + data.append(FP16x16 { mag: 40400, sign: false }); + data.append(FP16x16 { mag: 34434, sign: false }); + data.append(FP16x16 { mag: 33694, sign: false }); + data.append(FP16x16 { mag: 33967, sign: false }); + data.append(FP16x16 { mag: 67256, sign: false }); + data.append(FP16x16 { mag: 59193, sign: false }); + data.append(FP16x16 { mag: 51674, sign: false }); + data.append(FP16x16 { mag: 158517, sign: false }); + data.append(FP16x16 { mag: 16432, sign: false }); + data.append(FP16x16 { mag: 21737, sign: false }); + data.append(FP16x16 { mag: 28953, sign: false }); + data.append(FP16x16 { mag: 44046, sign: false }); + data.append(FP16x16 { mag: 53588, sign: false }); + data.append(FP16x16 { mag: 83878, sign: false }); + data.append(FP16x16 { mag: 89156, sign: false }); + data.append(FP16x16 { mag: 60105, sign: false }); + data.append(FP16x16 { mag: 97829, sign: false }); + data.append(FP16x16 { mag: 11903, sign: false }); + data.append(FP16x16 { mag: 10343, sign: false }); + data.append(FP16x16 { mag: 35204, sign: false }); + data.append(FP16x16 { mag: 25359, sign: false }); + data.append(FP16x16 { mag: 121776, sign: false }); + data.append(FP16x16 { mag: 48421, sign: false }); + data.append(FP16x16 { mag: 41238, sign: false }); + data.append(FP16x16 { mag: 15248, sign: false }); + data.append(FP16x16 { mag: 15911, sign: false }); + data.append(FP16x16 { mag: 52419, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/softmax_axis_2/output_0.cairo b/tests/nodes/softmax_axis_2/output_0.cairo new file mode 100644 index 000000000..02082e0e3 --- /dev/null +++ b/tests/nodes/softmax_axis_2/output_0.cairo @@ -0,0 +1,74 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(3); + shape.append(4); + shape.append(5); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 14646, sign: false }); + data.append(FP16x16 { mag: 13563, sign: false }); + data.append(FP16x16 { mag: 14330, sign: false }); + data.append(FP16x16 { mag: 11653, sign: false }); + data.append(FP16x16 { mag: 11342, sign: false }); + data.append(FP16x16 { mag: 41084, sign: false }); + data.append(FP16x16 { mag: 5257, sign: false }); + data.append(FP16x16 { mag: 10639, sign: false }); + data.append(FP16x16 { mag: 3519, sign: false }); + data.append(FP16x16 { mag: 5034, sign: false }); + data.append(FP16x16 { mag: 13621, sign: false }); + data.append(FP16x16 { mag: 15899, sign: false }); + data.append(FP16x16 { mag: 14134, sign: false }); + data.append(FP16x16 { mag: 14291, sign: false }); + data.append(FP16x16 { mag: 7588, sign: false }); + data.append(FP16x16 { mag: 6804, sign: false }); + data.append(FP16x16 { mag: 9016, sign: false }); + data.append(FP16x16 { mag: 9502, sign: false }); + data.append(FP16x16 { mag: 8963, sign: false }); + data.append(FP16x16 { mag: 31248, sign: false }); + data.append(FP16x16 { mag: 11697, sign: false }); + data.append(FP16x16 { mag: 10471, sign: false }); + data.append(FP16x16 { mag: 9115, sign: false }); + data.append(FP16x16 { mag: 21542, sign: false }); + data.append(FP16x16 { mag: 12708, sign: false }); + data.append(FP16x16 { mag: 8068, sign: false }); + data.append(FP16x16 { mag: 14079, sign: false }); + data.append(FP16x16 { mag: 14491, sign: false }); + data.append(FP16x16 { mag: 7980, sign: false }); + data.append(FP16x16 { mag: 20915, sign: false }); + data.append(FP16x16 { mag: 7189, sign: false }); + data.append(FP16x16 { mag: 30496, sign: false }); + data.append(FP16x16 { mag: 11181, sign: false }); + data.append(FP16x16 { mag: 8713, sign: false }); + data.append(FP16x16 { mag: 7955, sign: false }); + data.append(FP16x16 { mag: 10138, sign: false }); + data.append(FP16x16 { mag: 10180, sign: false }); + data.append(FP16x16 { mag: 16918, sign: false }); + data.append(FP16x16 { mag: 14960, sign: false }); + data.append(FP16x16 { mag: 13338, sign: false }); + data.append(FP16x16 { mag: 42246, sign: false }); + data.append(FP16x16 { mag: 4833, sign: false }); + data.append(FP16x16 { mag: 5240, sign: false }); + data.append(FP16x16 { mag: 5850, sign: false }); + data.append(FP16x16 { mag: 7365, sign: false }); + data.append(FP16x16 { mag: 8883, sign: false }); + data.append(FP16x16 { mag: 14103, sign: false }); + data.append(FP16x16 { mag: 15286, sign: false }); + data.append(FP16x16 { mag: 9812, sign: false }); + data.append(FP16x16 { mag: 17449, sign: false }); + data.append(FP16x16 { mag: 6567, sign: false }); + data.append(FP16x16 { mag: 6413, sign: false }); + data.append(FP16x16 { mag: 9372, sign: false }); + data.append(FP16x16 { mag: 8064, sign: false }); + data.append(FP16x16 { mag: 35118, sign: false }); + data.append(FP16x16 { mag: 15713, sign: false }); + data.append(FP16x16 { mag: 14081, sign: false }); + data.append(FP16x16 { mag: 9471, sign: false }); + data.append(FP16x16 { mag: 9567, sign: false }); + data.append(FP16x16 { mag: 16701, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/softmax_axis_minus_1.cairo b/tests/nodes/softmax_axis_minus_1.cairo new file mode 100644 index 000000000..4dbe58eb1 --- /dev/null +++ b/tests/nodes/softmax_axis_minus_1.cairo @@ -0,0 +1,20 @@ +mod input_0; +mod output_0; + + +use orion::utils::{assert_eq, assert_seq_eq}; +use orion::operators::nn::FP16x16NN; +use orion::operators::nn::NNTrait; +use orion::numbers::FixedTrait; +use orion::operators::tensor::FP16x16TensorPartialEq; + +#[test] +#[available_gas(2000000000)] +fn test_softmax_axis_minus_1() { + let input_0 = input_0::input_0(); + let z_0 = output_0::output_0(); + + let y_0 = NNTrait::softmax(@input_0, Option::None); + + assert_eq(y_0, z_0); +} diff --git a/tests/nodes/softmax_axis_minus_1/input_0.cairo b/tests/nodes/softmax_axis_minus_1/input_0.cairo new file mode 100644 index 000000000..5714cbcc6 --- /dev/null +++ b/tests/nodes/softmax_axis_minus_1/input_0.cairo @@ -0,0 +1,74 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn input_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(3); + shape.append(4); + shape.append(5); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 54590, sign: false }); + data.append(FP16x16 { mag: 61178, sign: false }); + data.append(FP16x16 { mag: 18943, sign: false }); + data.append(FP16x16 { mag: 9534, sign: false }); + data.append(FP16x16 { mag: 42629, sign: false }); + data.append(FP16x16 { mag: 42173, sign: false }); + data.append(FP16x16 { mag: 42740, sign: false }); + data.append(FP16x16 { mag: 113571, sign: false }); + data.append(FP16x16 { mag: 56924, sign: false }); + data.append(FP16x16 { mag: 41383, sign: false }); + data.append(FP16x16 { mag: 44527, sign: false }); + data.append(FP16x16 { mag: 4303, sign: false }); + data.append(FP16x16 { mag: 85774, sign: false }); + data.append(FP16x16 { mag: 55924, sign: false }); + data.append(FP16x16 { mag: 158412, sign: false }); + data.append(FP16x16 { mag: 23021, sign: false }); + data.append(FP16x16 { mag: 128482, sign: false }); + data.append(FP16x16 { mag: 55066, sign: false }); + data.append(FP16x16 { mag: 54463, sign: false }); + data.append(FP16x16 { mag: 95350, sign: false }); + data.append(FP16x16 { mag: 34220, sign: false }); + data.append(FP16x16 { mag: 50177, sign: false }); + data.append(FP16x16 { mag: 36693, sign: false }); + data.append(FP16x16 { mag: 32645, sign: false }); + data.append(FP16x16 { mag: 48677, sign: false }); + data.append(FP16x16 { mag: 18999, sign: false }); + data.append(FP16x16 { mag: 5924, sign: false }); + data.append(FP16x16 { mag: 13009, sign: false }); + data.append(FP16x16 { mag: 15491, sign: false }); + data.append(FP16x16 { mag: 32026, sign: false }); + data.append(FP16x16 { mag: 21516, sign: false }); + data.append(FP16x16 { mag: 58238, sign: false }); + data.append(FP16x16 { mag: 81336, sign: false }); + data.append(FP16x16 { mag: 23454, sign: false }); + data.append(FP16x16 { mag: 34911, sign: false }); + data.append(FP16x16 { mag: 50619, sign: false }); + data.append(FP16x16 { mag: 45742, sign: false }); + data.append(FP16x16 { mag: 48601, sign: false }); + data.append(FP16x16 { mag: 34036, sign: false }); + data.append(FP16x16 { mag: 57483, sign: false }); + data.append(FP16x16 { mag: 37301, sign: false }); + data.append(FP16x16 { mag: 100657, sign: false }); + data.append(FP16x16 { mag: 20333, sign: false }); + data.append(FP16x16 { mag: 32171, sign: false }); + data.append(FP16x16 { mag: 57271, sign: false }); + data.append(FP16x16 { mag: 75649, sign: false }); + data.append(FP16x16 { mag: 25921, sign: false }); + data.append(FP16x16 { mag: 989, sign: false }); + data.append(FP16x16 { mag: 35410, sign: false }); + data.append(FP16x16 { mag: 43432, sign: false }); + data.append(FP16x16 { mag: 34144, sign: false }); + data.append(FP16x16 { mag: 11011, sign: false }); + data.append(FP16x16 { mag: 101436, sign: false }); + data.append(FP16x16 { mag: 73487, sign: false }); + data.append(FP16x16 { mag: 9987, sign: false }); + data.append(FP16x16 { mag: 87623, sign: false }); + data.append(FP16x16 { mag: 35873, sign: false }); + data.append(FP16x16 { mag: 215046, sign: false }); + data.append(FP16x16 { mag: 8835, sign: false }); + data.append(FP16x16 { mag: 40411, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/softmax_axis_minus_1/output_0.cairo b/tests/nodes/softmax_axis_minus_1/output_0.cairo new file mode 100644 index 000000000..3ff8c002a --- /dev/null +++ b/tests/nodes/softmax_axis_minus_1/output_0.cairo @@ -0,0 +1,74 @@ +use core::array::{ArrayTrait, SpanTrait}; +use orion::operators::tensor::{TensorTrait, Tensor}; +use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorAdd}; +use orion::numbers::{FixedTrait, FP16x16}; + +fn output_0() -> Tensor { + let mut shape = ArrayTrait::::new(); + shape.append(3); + shape.append(4); + shape.append(5); + + let mut data = ArrayTrait::new(); + data.append(FP16x16 { mag: 16293, sign: false }); + data.append(FP16x16 { mag: 18016, sign: false }); + data.append(FP16x16 { mag: 9457, sign: false }); + data.append(FP16x16 { mag: 8192, sign: false }); + data.append(FP16x16 { mag: 13575, sign: false }); + data.append(FP16x16 { mag: 9074, sign: false }); + data.append(FP16x16 { mag: 9153, sign: false }); + data.append(FP16x16 { mag: 26976, sign: false }); + data.append(FP16x16 { mag: 11365, sign: false }); + data.append(FP16x16 { mag: 8965, sign: false }); + data.append(FP16x16 { mag: 6367, sign: false }); + data.append(FP16x16 { mag: 3446, sign: false }); + data.append(FP16x16 { mag: 11948, sign: false }); + data.append(FP16x16 { mag: 7577, sign: false }); + data.append(FP16x16 { mag: 36196, sign: false }); + data.append(FP16x16 { mag: 5345, sign: false }); + data.append(FP16x16 { mag: 26720, sign: false }); + data.append(FP16x16 { mag: 8716, sign: false }); + data.append(FP16x16 { mag: 8636, sign: false }); + data.append(FP16x16 { mag: 16117, sign: false }); + data.append(FP16x16 { mag: 11835, sign: false }); + data.append(FP16x16 { mag: 15098, sign: false }); + data.append(FP16x16 { mag: 12290, sign: false }); + data.append(FP16x16 { mag: 11554, sign: false }); + data.append(FP16x16 { mag: 14756, sign: false }); + data.append(FP16x16 { mag: 13375, sign: false }); + data.append(FP16x16 { mag: 10956, sign: false }); + data.append(FP16x16 { mag: 12207, sign: false }); + data.append(FP16x16 { mag: 12678, sign: false }); + data.append(FP16x16 { mag: 16317, sign: false }); + data.append(FP16x16 { mag: 8738, sign: false }); + data.append(FP16x16 { mag: 15304, sign: false }); + data.append(FP16x16 { mag: 21770, sign: false }); + data.append(FP16x16 { mag: 9001, sign: false }); + data.append(FP16x16 { mag: 10720, sign: false }); + data.append(FP16x16 { mag: 13696, sign: false }); + data.append(FP16x16 { mag: 12714, sign: false }); + data.append(FP16x16 { mag: 13281, sign: false }); + data.append(FP16x16 { mag: 10634, sign: false }); + data.append(FP16x16 { mag: 15208, sign: false }); + data.append(FP16x16 { mag: 9807, sign: false }); + data.append(FP16x16 { mag: 25787, sign: false }); + data.append(FP16x16 { mag: 7570, sign: false }); + data.append(FP16x16 { mag: 9069, sign: false }); + data.append(FP16x16 { mag: 13301, sign: false }); + data.append(FP16x16 { mag: 22282, sign: false }); + data.append(FP16x16 { mag: 10433, sign: false }); + data.append(FP16x16 { mag: 7131, sign: false }); + data.append(FP16x16 { mag: 12058, sign: false }); + data.append(FP16x16 { mag: 13629, sign: false }); + data.append(FP16x16 { mag: 9350, sign: false }); + data.append(FP16x16 { mag: 6569, sign: false }); + data.append(FP16x16 { mag: 26106, sign: false }); + data.append(FP16x16 { mag: 17042, sign: false }); + data.append(FP16x16 { mag: 6467, sign: false }); + data.append(FP16x16 { mag: 7100, sign: false }); + data.append(FP16x16 { mag: 3223, sign: false }); + data.append(FP16x16 { mag: 49623, sign: false }); + data.append(FP16x16 { mag: 2133, sign: false }); + data.append(FP16x16 { mag: 3454, sign: false }); + TensorTrait::new(shape.span(), data.span()) +} diff --git a/tests/nodes/softmax_fp16x16/input_0.cairo b/tests/nodes/softmax_fp16x16/input_0.cairo deleted file mode 100644 index eb5a6bc69..000000000 --- a/tests/nodes/softmax_fp16x16/input_0.cairo +++ /dev/null @@ -1,17 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorSub}; -use orion::numbers::{FixedTrait, FP16x16}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(FP16x16 { mag: 93078, sign: true }); - data.append(FP16x16 { mag: 53025, sign: false }); - data.append(FP16x16 { mag: 183455, sign: true }); - data.append(FP16x16 { mag: 61044, sign: true }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/softmax_fp16x16/output_0.cairo b/tests/nodes/softmax_fp16x16/output_0.cairo deleted file mode 100644 index 22ee5fe31..000000000 --- a/tests/nodes/softmax_fp16x16/output_0.cairo +++ /dev/null @@ -1,17 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP16x16Tensor, FP16x16TensorSub}; -use orion::numbers::{FixedTrait, FP16x16}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(FP16x16 { mag: 6366, sign: false }); - data.append(FP16x16 { mag: 59169, sign: false }); - data.append(FP16x16 { mag: 8768, sign: false }); - data.append(FP16x16 { mag: 56767, sign: false }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/softmax_fp8x23.cairo b/tests/nodes/softmax_fp8x23.cairo deleted file mode 100644 index 616810b5a..000000000 --- a/tests/nodes/softmax_fp8x23.cairo +++ /dev/null @@ -1,20 +0,0 @@ -mod input_0; -mod output_0; - - -use orion::operators::tensor::FP8x23TensorPartialEq; -use orion::operators::nn::NNTrait; -use orion::numbers::FixedTrait; -use orion::utils::{assert_eq, assert_seq_eq}; -use orion::operators::nn::FP8x23NN; - -#[test] -#[available_gas(2000000000)] -fn test_softmax_fp8x23() { - let input_0 = input_0::input_0(); - let z = output_0::output_0(); - - let y = NNTrait::softmax(@input_0, 0); - - assert_eq(y, z); -} diff --git a/tests/nodes/softmax_fp8x23/input_0.cairo b/tests/nodes/softmax_fp8x23/input_0.cairo deleted file mode 100644 index 673dc8546..000000000 --- a/tests/nodes/softmax_fp8x23/input_0.cairo +++ /dev/null @@ -1,17 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorSub}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn input_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 12134368, sign: false }); - data.append(FP8x23 { mag: 22252681, sign: true }); - data.append(FP8x23 { mag: 1818273, sign: false }); - data.append(FP8x23 { mag: 18287369, sign: true }); - TensorTrait::new(shape.span(), data.span()) -} diff --git a/tests/nodes/softmax_fp8x23/output_0.cairo b/tests/nodes/softmax_fp8x23/output_0.cairo deleted file mode 100644 index a8f691a14..000000000 --- a/tests/nodes/softmax_fp8x23/output_0.cairo +++ /dev/null @@ -1,17 +0,0 @@ -use core::array::{ArrayTrait, SpanTrait}; -use orion::operators::tensor::{TensorTrait, Tensor}; -use orion::operators::tensor::{FP8x23Tensor, FP8x23TensorSub}; -use orion::numbers::{FixedTrait, FP8x23}; - -fn output_0() -> Tensor { - let mut shape = ArrayTrait::::new(); - shape.append(2); - shape.append(2); - - let mut data = ArrayTrait::new(); - data.append(FP8x23 { mag: 6490929, sign: false }); - data.append(FP8x23 { mag: 3221031, sign: false }); - data.append(FP8x23 { mag: 1897678, sign: false }); - data.append(FP8x23 { mag: 5167576, sign: false }); - TensorTrait::new(shape.span(), data.span()) -}