// Copyright (C) 2023-2025 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
include "memoryManagement.fbs";

namespace MVCNN;

/// Generally modeled around v2 infrastructure for software layers.

struct order3{
  x: ubyte;
  y: ubyte;
  z: ubyte;
}

// ------- NN SOFTWARE LAYERS PARAMS ------- //

table QuantizeParams{
    scale: [ushort];
    zero: [ushort];
}

table DummyParams{
  message: string;
  executeShaveKernel: bool = false;
  inputs_number: int32;
  outputs_number: int32;
}

table DetectionOutputParams{
    // Required
    num_classes: int;
    keep_top_k: int = -1;
    nms_threshold: float;

    // Optional
    background_label_id: int;
    top_k: int = -1;
    variance_encoded_in_target: bool;
    code_type: string;
    share_location: bool = true;
    confidence_threshold: float = -65504; // Min half value
    clip_before_nms: bool;
    clip_after_nms: bool;
    decrease_label_id: int;
    normalized: bool;
    input_height: int = 1;
    input_width: int = 1;
    objectness_score: float;
}

table DeconvolutionParams{
  kernel: order3;
  strides: order3;
  dilations: order3;
  pads_begin: order3;
  pads_end: order3;
  output_padding: order3;
  is_depthwise: bool;
}

// Reference Convolution
table ConvolutionParams {
    kernel: order3;
    strides: order3;
    dilations: order3;
    pads_begin: order3;
    pads_end: order3;
    group: int32;
}

// SW Convolution
table SWConvolutionParams {
    kernel: order3;
    strides: order3;
    dilations: order3;
    pads_begin: order3;
    pads_end: order3;
    group: int32;
}

table FlattenParams{

}

enum InterpolationCoordTransMode : int {
    HALF_PIXEL           = 0,
    PYTORCH_HALF_PIXEL   = 1,
    ASYMMETRIC           = 2,
    TF_HALF_PIXEL_FOR_NN = 3,
    ALIGN_CORNERS        = 4
}

table InterpParams{
    pad_beg: uint;
    pad_end: uint;
    align_corners: bool = true;
    coord_transform_mode: InterpolationCoordTransMode = ASYMMETRIC;
}

table NormalizeParams{
    // Required
    eps: float; // Must be positive

    // Optional
    across_spatial: int = 0;
    channel_shared: int = 0;
}

table PermuteParams{
  permute_order: order3;
}

table PermuteNDParams{
  permute_nd_order: [int];
}

table PriorboxParams{
  min_sizes: [float];
  max_sizes: [float];
  aspect_ratios: [float];
  variances: [float];
  flip: uint;
  clip: uint;
  step_w: float;
  step_h: float;
  offset: float;
}

table ROIPoolingParams {
  pooled_w: uint;
  pooled_h: uint;
  spatial_scale: float;
  roi_pooling_method: uint;
  num_rois: uint;
}

enum PSROIPoolingMode : byte {
  AVERAGE = 0,
  BILINEAR = 1,
  BILINEAR_DEFORMABLE = 2
}

table PSROIPoolingParams {
  output_dim: uint;
  group_size: uint;
  spatial_scale: float;
  pooled_w: uint;
  pooled_h: uint;
  spatial_bin_x: uint;
  spatial_bin_y: uint;
  mode: PSROIPoolingMode = AVERAGE;
}

table ProposalParams{
    //
    // These parameters are required
    //
    base_size: uint;
    pre_nms_topn: uint;
    post_nms_topn: uint;
    nms_thresh: float;
    feat_stride: uint;
    min_size: uint;
    ratio: [float];
    scale: [float];

    imageInfo: [float] (deprecated); // This comes from another input blob now

    //
    // These parameters are optional
    //
    pre_nms_thresh: float = 0.0;
    clip_before_nms: bool = 1;
    clip_after_nms: bool = 0;
    normalize: bool = 0;
    box_size_scale: float = 1.0;
    box_coordinate_scale: float = 1.0;
    framework: string;
    for_deformable: bool = 0;
}

table RegionYOLOParams{
    // Required
    coords: int;
    classes: int;
    num: int;

    // Optional
    do_softmax: bool = true;
    mask: [int];
}

table ReorgYOLOParams{
    stride: int;
}

table ReshapeParams{

}

table SoftmaxParams {
    axis: uint;
}

table FullyConnectedParams {}

// The params for a custom layer are special in comparison to other SoftwareLayerParams.
// For custom soft layers, the compiler is not expected to be aware of the layer's
// configuration. Instead, it is expected to directly forward the the layers configuration
// and its associated parameters as an opaque BinaryData.
//
// It is the custom layer provider's responsibility to ensure the custom shave kernel can
// correctly interpret it's configuration BinaryData.
//
// It is also the layer provider's responsibility to select the leonPreambleID appropriate for
// their custom kernel
//
table CustomLayerOclParams{
  // Internally, leon code configures shaves for execution. The leonPreambleID allows the
  // custom layer provider to select the most appropriate leon routine to load their soft
  // kernel.
  leonPreambleID: uint;
  // This is the executable shave kernel to be loaded by the selected leonPreambleID.
  kernelData: BinaryData (force_align:64);
  // The shave kernel's configuration data to be specified by the custom layer provider. Unlike
  // some custom layers, leon will not ever interpret the paramData, and instead will forward
  // it to the custom soft kernel directly
  paramData: BinaryData (force_align:64);
}

table CustomLayerCppParams{
  leonPreambleID: uint;
  kernelData: BinaryData (force_align:64);
  paramData: BinaryData (force_align:64);
}

enum DataType : ubyte {
  UNKNOWN = 0,
  INT1 = 1,
  INT8 = 2,
  INT16 = 3,
  INT32 = 4,
  INT64 = 5,
  UINT8 = 6,
  UINT16 = 7,
  UINT32 = 8,
  UINT64 = 9,
  FLOAT16 = 10,
  FLOAT32 = 11,
  FLOAT64 = 12
}

struct InitValue {
  needInit: bool;
  isInt: bool;
  intValue: long;
  floatValue: double;
}

struct Term {
  factor: int;
  idx: uint;
}

table Polynomial {
  terms: [Term];
  constant: int;
}

table DmaTransfer {
  // Is DDR->CMX?
  fromDDR: bool;
  // Size of data type
  dataTypeSize: ubyte;
  // The position of buffer in the function argument list
  bufArg: ubyte;
  // The DMA transfer position, e.g., before inner block / after middle block
  stage: ubyte;
  // Local cache shape
  localShape: [uint];
  // Global buffer shape
  globalShape: [uint];
  // Ranges of the tensor dimensions
  ranges: [uint];
  // Bases of the tensor dimensions
  bases: Polynomial;
}

table EdslParams {
  // This is the executable shave kernel to be loaded by the selected leonPreambleID.
  kernelData: BinaryData (force_align:8);
  // The shave kernel's configuration data to be specified by the edsl layer provider.
  paramData: BinaryData (force_align:8);
  // Outer loop indices' ranges
  outerRanges: [uint];
  // Outer loop indices' steps
  outerSteps: [uint];
  // Middle loop ranges
  middleRanges: [uint];
  // Middle loop indices' steps
  middleSteps: [uint];
  // DMA transfer
  dmaTransfers: [DmaTransfer];
  // Output initialization values
  initOutputs: [InitValue];
  // Inputs' data types
  inputDataTypes: [DataType];
  // Outputs' data types
  outputDataTypes: [DataType];
}

// A null operation layer that passes IO through a software layer (input --> output) without
// modification.
table PassthroughParams {
  // the minimum stall time before this layer completes in microseconds
  min_delay_us: uint;
}

// Identical in operation to PassthroughParams, but the shave runtime library will record the
// the passed tensor.
table LayerRecordParams {

}

// The defaults here are not exactly what are specified in OV docs, but the default
// Flatbuffers value of 0 doesn't make a lot of sense
table ArgMaxParams {
    // Required
    // If an axis is specified and out_max_val is true:
    // Dim(axis[]) = top_k
    // If out_max_val == true, axis[] contains the maximum value for each sub-axis.
    // If false, axis[] contains the index of the max value
    // If no axis specified, returns a vector <ind1, ind2, ..., indN, val1, val2, ... valN> across all sub-axes
    out_max_val: bool = false;
    top_k: uint = 1;

    // Optional
    // Axis is based off NCHW channel ordering, i.e. 0 = N, W=3
    // This is consistent with the TensorReference ordering of dimensions
    axis: int = 99; // 99 to signal nothing specified, since -3..3 including 0 are valid values
}

table NormParams{
  // Required
  alpha: float;
  beta: float;
  region: string;
  local_size: int;
}

table EltwiseI32 {
    value: int32;
}

table EltwiseFP32 {
    value: float;
}

union EltwiseParam {
    i32: EltwiseI32,
    fp: EltwiseFP32
}

table EltwisePostOpEmpty{
}

table EltwisePostOpPReLU{
    reluNegSlope: EltwiseParam;
    clampMinValue: EltwiseParam;
    clampMaxValue: EltwiseParam;
}

union EltwisePostOpsNestedParams {
  EltwisePostOpEmpty,
  EltwisePostOpPReLU
}

table EltwiseParams{
  // Not required: default value is 'sum'
  operation: string;
  // Not required: default value is 1
  coeff1: EltwiseParam;
  // Not required: default value is 1
  coeff2: EltwiseParam;
  // Not required: default value is EltwisePostOpEmpty
  postop_params : EltwisePostOpsNestedParams;
}

table ReduceParams{
  operation: string;
  keep_dims: bool = false;
  axes_value: [int64];
}

enum InterpolationMethod : int {
  NEAREST     = 0,
  BILINEAR    = 1,
  BICUBIC     = 2,
  LINEARONNX  = 3
}

enum InterpolationNearestMode : int {
  ROUND_PREFER_FLOOR   = 0,
  ROUND_PREFER_CEIL    = 1,
  FLOOR                = 2,
  CEIL                 = 3,
  SIMPLE               = 4
}

table ResampleParams {
  interpolation: InterpolationMethod = NEAREST;
  antialias: bool;
}

table InterpolateParams {
  interpolationMode: InterpolationMethod = NEAREST;
  nearestMode: InterpolationNearestMode = ROUND_PREFER_FLOOR;
  coordTransformMode: InterpolationCoordTransMode = ASYMMETRIC;
  align_corners: bool = false;
  antialias: bool = false;
}

table ReversesequenceParams {
  seq_axis: int = 0;
  batch_axis: int = 0;
}

table CorrelationParams {
    kernel_size: int;
    max_displacement: int;
    pad_size: int;
    stride1: int;
    stride2: int;
    correlation_type: uint = 0;
}

table MVNParams {
  eps: float = 1e-8;
  across_channels: bool = false;
  normalize_variance: bool = false;
}

table GRNParams {
  bias: float;
}

table CTCDecoderParams {
    ctc_merge_repeated: bool = false;
}

table SpatialTransformParams {
  theta: [float];
}

table FakeQuantizeParams{
    levels : uint;
    input_low: [ushort];
    input_high: [ushort];
    output_low: [ushort];
    output_high: [ushort];
}

// Pooling: used for max and average pooling layers
table PoolingParams{
  // Required
  kernel: order3;
  pool_method: string;
  exclude_pad: string;

  // Optional
  strides: order3;
  pads_begin: order3;
  pads_end: order3;
  rounding_type: string;
  auto_pad: string;
}

table TileParams{
  axis: uint;
  tiles: uint;
}

table LeakyReluParams {
    negative_slope: float;
}

table HSigmoidParams {
}

table SigmoidParams {
}

table ReluParams {
}

table GatherParams {
    axis: uint;
    batch_dims: uint;
}

table GatherNDParams {
    batch_dims: uint;
}

table ClampParams {
    min: float;
    max: float;
}

table EluParams {
    x: float;
}

enum PadMode : byte {
  Constant = 0,
  Edge = 1,
  Reflect = 2,
  Symmetric = 3
}

table PadParams {
    pads_begin: [uint];
    pads_end: [uint];

    padValue: float;
    pad_mode: PadMode;
}

table GatherElementsParams{
  axis: uint;
  rowIndicesMode: bool;
}

table PowerParams {
    shift: float;
    scale: float;
    power: float;
}

table BiasLeakyReluParams {
    negative_slope: float;
}

table BiasReluParams {
    negative_slope: float;
}

table PReluParams {
}


table TanhParams {
}

table BiasParams {
}

table ScaleParams {
}

table ScaleShiftParams {
}

table HSwishParams {
}

table SwishParams {
    beta: float;
}

table MishParams {
}

table SoftPlusParams {
}

table FloorParams {
}

table CeilingParams {
}

table ExpParams {
}

enum RoundMode : byte {
  HALF_TO_EVEN = 0,
  HALF_AWAY_FROM_ZERO = 1
}

table RoundParams {
  mode: RoundMode;
}

table ErfParams {
}

enum GeluMode : byte {
  ERF = 0,
  TANH = 1
}

table GeluParams {
  mode: GeluMode;
}

table LogParams {
}

table CTCGreedyDecoderSeqLenParams {
  mergeRepeated: bool;
}

table SinhParams{
}

table CoshParams{
}

table SqrtParams {
}

table AsinhParams{
}

table AcoshParams{
}

table AbsParams {
}

table AtanParams {
}

table AsinParams {
}

table AcosParams {
}

table AtanhParams{
}

table SignParams {
}

table SinParams{
}

table CosParams{
}

table TanParams{
}

table SeluParams {
    alpha: float;
    lambda: float;
}

table HardSigmoidParams {
    alpha: float;
    beta: float;
}

table NegativeParams {
}

union PostOpsNestedParams {
  BiasParams,
  ScaleParams,
  ScaleShiftParams,
  ClampParams,
  EluParams,
  PowerParams,
  BiasLeakyReluParams,
  BiasReluParams,
  LeakyReluParams,
  ReluParams,
  PReluParams,
  SigmoidParams,
  TanhParams,
  HSwishParams,
  SwishParams,
  MishParams,
  SoftPlusParams,
  FloorParams,
  ErfParams,
  RoundParams,
  CeilingParams,
  GeluParams,
  LogParams,
  ExpParams,
  SinhParams,
  CoshParams,
  SqrtParams,
  AsinhParams,
  AcoshParams,
  AbsParams,
  AtanParams,
  AsinParams,
  AcosParams,
  AtanhParams,
  SignParams,
  SinParams,
  CosParams,
  TanParams,
  SeluParams,
  HSigmoidParams,
  HardSigmoidParams,
  NegativeParams
}

table PostOpsParams {
  has_weights : bool;
  has_bias : bool;
  nested_params : PostOpsNestedParams;
  axis: int = -1; // -1 to signal nothing specified
}

union UnaryOpNestedParams {
    LeakyReluParams,
    SigmoidParams,
    ReluParams
}

table UnaryOpParams {
    nested_params : UnaryOpNestedParams;
}

table ConvertParams {
  scale: float;
  bias: float;

  from_detection_output: bool;
  have_batch: bool;
  batch_id: int32;
}

enum SpaceToDepthMode: byte {
    BLOCKS_FIRST = 0,
    DEPTH_FIRST = 1
}

table SpaceToDepthParams {
  blockSize: int32;
  mode: SpaceToDepthMode;
}

enum DepthToSpaceMode: byte {
    BLOCKS_FIRST = 0,
    DEPTH_FIRST = 1
}

table DepthToSpaceParams {
  blockSize: int32;
  mode: DepthToSpaceMode;
}

table LSTMCellParams {
  RNNForward: int32;
  nCells: int32;
  nBatches: int32;
  useCellState: int32;
  outputsNumber: int32;
}

table GRUCellParams {
  hiddenSize: int32;
  batchSize: int32;
  sequenceLength: int32;
  clip: float;
  direction: int32;
  linearBeforeReset: bool;
}

table StridedSliceParams {
  begins: [uint];
  ends: [uint];
  strides: [uint];
}

enum TopKMode: byte {
  max = 0,
  min = 1
}

enum TopKSort: byte {
  none  = 0,
  value = 1,
  index = 2
}

table TopKParams {
  axis : int;
  mode : TopKMode;
  sort : TopKSort;
  hasValues  : bool;
  hasIndices : bool;
}

table ScatterElementsUpdateParams {
}

table ScatterUpdateParams {
}

table ScatterNDUpdateParams {
}

enum ExtractImagePatchesPadMode : int {
  VALID         = 0,
  SAME_UPPER    = 1,
  SAME_LOWER    = 2
}

table ExtractImagePatchesParams {
  sizeRows: int;
  sizeCols: int;
  strideRows: int;
  strideCols: int;
  rateRows: int;
  rateCols: int;
  autoPad: ExtractImagePatchesPadMode;
}

table NMSParams {
    box_encoding: bool;
    sort_result_descending: bool = true;

    // These variables are deprecated and provided as attributes instead of tensors from compiler
    has_maxOutBoxesPerClass : bool;
    has_IOUThreshold : bool;
    has_scoreThreshold : bool;
    has_softNmsSigma : bool;

    max_output_boxes_per_class: int;
    iou_threshold: float;
    score_threshold: float;
    soft_nms_sigma: float;
}

table OutShapeOfReshapeParams {
  specialZero: int;
}

table DesparsifyParams {
  storage_element_size: uint;
  sparse_point: int;
}

table UpsamplingParams {
  upsampling_factor_x: int;
  upsampling_factor_y: int;
  upsampling_factor_z: int;
  pad_x: [int];
  pad_y: [int];
  pad_z: [int];
}

enum BroadcastMode: byte {
    NUMPY = 0,
    EXPLICIT = 1,
    BIDIRECTIONAL = 2
}

table BroadcastParams {
  mode: BroadcastMode;
}

table NonZeroParams {
}

table InnerLRNParams {
  k: float;
  alpha: float;
  beta: float;
  local_size: int;
}

table ExpDetectionOutputParams {
  deltas_weights: [float];
  max_delta_log_wh: float;
  nms_threshold: float;
  score_threshold: float;
  max_detections_per_image: int;
  num_classes: int;
  post_nms_count: int;
  class_agnostic_box_regression: bool = false;
}

table ExpGenerateProposalsParams {
  min_size: float;
  nms_threshold: float;
  pre_nms_topn: int;
  post_nms_topn: int;
}

table ExpPriorGridGeneratorParams {
  flatten: bool = true;
  grid_h: int = 0;
  grid_w: int = 0;
  stride_x: float = 0.0;
  stride_y: float = 0.0;
}

table ExpTopKROIsParams {
  max_rois: int = 0;
}

enum ROIAlignMethod : byte {
  roi_align_avg = 0,
  roi_align_max = 1
}

enum ROIAlignStep : byte {
  repacking = 0,      // converting to chwc format
  roi_align_chwc = 1, // roi_align chwc version for repacked input
  roi_align = 2       // standard roi_align pipeline
}

table ROIAlignParams {
  pooled_w: uint;
  pooled_h: uint;
  sampling_ratio: uint;
  spatial_scale: float;
  method: ROIAlignMethod;
  roi_align_step: ROIAlignStep;
}

table ROIFeatureExtractorParams {
  pooled_w: uint;
  pooled_h: uint;
  sampling_ratio: uint;
  levels_num: uint;
  use_output_rois: uint;
  pyramid_scales: [int];
}

table ConcatOffsets {
  offsets : [int32];
}

struct ConcatAttrs {
  axis: uint32;
  offset: uint32;
  stride: uint32;
}

table ConcatParams {
  per_axis: ConcatAttrs;
  static_offsets : [ConcatOffsets];
}

table CopyParams {
}

table CropParams {
  cropVal: uint;
  dimension: uint;
}

table SliceParams {
  begin: [uint];
  size: [uint];
}

table AlignParams {
  dimension: uint;
  pad: uint;
}

table SCReluParams {
  negSlope: float;
  axis: int;
}

enum RgbFormat : int {
  RGB   = 0,
  BGR   = 1
}

table ConvertColorNV12ToRGBParams {
  colorFormat: RgbFormat;
}

table ConvertColorI420ToRGBParams {
  colorFormat: RgbFormat;
}

table SplitParams {
  axis: uint;
  num_splits: uint;
}

table AdaptivePoolParams{
}

table CumSumParams {
  exclusive: bool = false;
  reverse: bool = false;
}

table EmbeddingBagOffsetsSumParams {
  indices : [int32];
  offsets : [int32];
  default_index : int32;
  weights : [ushort];
}

table RollParams{
}

enum BucketizeOutputType : int {
  I32 = 0,
  I64 = 1
}

table BucketizeParams{
  output_type: BucketizeOutputType = I64;
  with_right_bound: bool = true;
}

table BatchNormInferenceParams {
    epsilon: float;
    gamma: [ushort];
    beta: [ushort];
    mean: [ushort];
    variance: [ushort];
}

table BinaryConvolutionParams {
    kernel: order3;
    strides: order3;
    dilations: order3;
    pads_begin: order3;
    pads_end: order3;
    pad_value: float;
}

table DXILParams {
  kernelEntry: uint64;
  payloadBuffer: [uint64]; // One entry per shave. Number of shaves inferred from this count
}

enum DeformablePSROIPoolingMode : byte {
  AVERAGE = 0,
  BILINEAR = 1,
  BILINEAR_DEFORMABLE = 2
}

table DeformablePSROIPoolingParams {
  output_dim: uint;
  group_size: uint;
  spatial_scale: float;
  pooled_w: uint;
  pooled_h: uint;
  spatial_bins_x: uint;
  spatial_bins_y: uint;
  trans_std: float;
  part_size: uint;
  mode: DeformablePSROIPoolingMode = BILINEAR_DEFORMABLE;
}

table EmbeddingSegmentsSumParams {
  indices: [int32];
  segment_ids: [int32];
  num_segments: int32;
  default_index: int32;
  per_sample_weights: [ushort];
}

union SoftwareLayerParams{
  DummyParams,
  DetectionOutputParams,
  FlattenParams,
  InterpParams,       // Interp is a special case of Interpolate (stands for linear interpolation)
  NormalizeParams,
  PermuteParams,
  PriorboxParams,
  ProposalParams,
  RegionYOLOParams,
  ReorgYOLOParams,
  ReshapeParams,
  SoftmaxParams,
  CustomLayerOclParams,
  PassthroughParams,
  LayerRecordParams,
  ROIPoolingParams,
  QuantizeParams,
  ArgMaxParams,
  NormParams,
  EltwiseParams,
  ResampleParams,     // Resample is a special case of Interpolate (stands for nearest neighbour interpolation)
  CorrelationParams,
  MVNParams,
  GRNParams,
  CTCDecoderParams,
  SpatialTransformParams,
  FakeQuantizeParams,
  PoolingParams,
  EdslParams,
  TileParams,
  PSROIPoolingParams,
  DeconvolutionParams,
  UnaryOpParams,
  ConvolutionParams,
  GatherParams,
  PostOpsParams,
  NegativeParams,
  ConvertParams,
  CustomLayerCppParams,
  PermuteNDParams,
  PadParams,
  InterpolateParams,
  CTCGreedyDecoderSeqLenParams,
  SpaceToDepthParams,
  DepthToSpaceParams,
  GatherElementsParams,
  ReversesequenceParams,
  LSTMCellParams,
  StridedSliceParams,
  FullyConnectedParams,
  SWConvolutionParams,
  TopKParams,
  ScatterElementsUpdateParams,
  ScatterUpdateParams,
  GatherNDParams,
  DesparsifyParams,
  OutShapeOfReshapeParams,
  UpsamplingParams,
  BroadcastParams,
  NonZeroParams,
  InnerLRNParams,
  ExpDetectionOutputParams,
  NMSParams,
  ExpGenerateProposalsParams,
  ExpPriorGridGeneratorParams,
  ExpTopKROIsParams,
  ROIAlignParams,
  ROIFeatureExtractorParams,
  ConcatParams,
  CopyParams,
  CropParams,
  SliceParams,
  AlignParams,
  ReduceParams,
  SCReluParams,
  ScatterNDUpdateParams,
  ExtractImagePatchesParams,
  ConvertColorNV12ToRGBParams,
  ConvertColorI420ToRGBParams,
  SplitParams,
  AdaptivePoolParams,
  CumSumParams,
  RollParams,
  BucketizeParams,
  BatchNormInferenceParams,
  BinaryConvolutionParams,
  EmbeddingBagOffsetsSumParams,
  DXILParams,
  DeformablePSROIPoolingParams,
  EmbeddingSegmentsSumParams,
  GRUCellParams,
}


// ------- NN SOFTWARE LAYERS TASKS ------- //
table SNNLayerTask{
  // Allows the GF to configure soft layer specific parameters.
  // The SoftwareLayerParam type implies the soft layer type.
  softLayerParams: SoftwareLayerParams;
}

// Legacy tables needed only for 3.11.3 backwards compatibility. They can be completely removed after backward
// compatibility is not required

table Tensor{
  // Legacy Tensor Accessor
  dimX: uint;
  dimY: uint;
  dimZ: uint;
  strideX: uint;
  strideY: uint;
  strideZ: uint;
  offset: uint;
  location: uint;
  dataType: uint;
  order: uint;
}

table Conv2D{
  radixX: uint;
  radixY: uint;
  strideX: uint;
  strideY: uint;
  padX: uint;
  padY: uint;
  padStyle: uint;
  dilation: uint;
  input : TensorReference;
  output : TensorReference;
  weight : TensorReference;
  bias : TensorReference;
}

table Pooling{
  radixX: uint;
  radixY: uint;
  strideX: uint;
  strideY: uint;
  padX: uint;
  padY: uint;
  padStyle: uint;
  dilation: uint;
  input : TensorReference;
  output : TensorReference;
}

table ReLU{
  opX: uint;
  input : TensorReference;
  output : TensorReference;
  strideX: uint;
  strideY: uint;
}

table Passthrough{
  input : TensorReference;
  output : TensorReference;
}

table Custom{
  data: [byte];
  length: [long];
  id: short;
}

union SoftwareLayer {
  Conv2D,
  Pooling,
  ReLU,
  Passthrough,
  Custom
}

table MvTensorTask {
   layer: SoftwareLayer;
}

table PPEConfigure{
  vals: [byte]; // 16 of these
}
table PPEAssist {
  op: byte;
}

union NNHelper{
  PPEConfigure,  // Reload PPE Config
  PPEAssist,     // Backup for PPE Layer
  // SoftwareLayer   // NN Software Layers
}

table NNTensorTask{
  subtask: NNHelper;
}
