export { PassThroughStyle };

import { Int } from "./ValueDesc_Base.js";

/**
 * Describe convolution pass-through style parameter's id, range, name.
 *
 
//!!! (2022/05/21 Remarked) PASS_THROUGH_STYLE_FILTER_0_BIAS_1_ACTIVATION_NO_ESCAPING seems still need activation escaping.
//  * Convert number value into integer between [ 0, 1 ] representing operation:
//  *   - 0: PASS_THROUGH_STYLE_FILTER_1_BIAS_0_ACTIVATION_ESCAPING    (depthwise, pointwise)
//  *   - 1: PASS_THROUGH_STYLE_FILTER_0_BIAS_1_ACTIVATION_NO_ESCAPING (squeeze-and-excitation)

 *
 * Convert number value into integer between [ 0, 1 ] representing operation:
 *   - 0: PASS_THROUGH_STYLE_FILTER_1_BIAS_0 (depthwise, pointwise)
 *   - 1: PASS_THROUGH_STYLE_FILTER_0_BIAS_1 (squeeze-and-excitation)
 *
 */
class PassThroughStyle extends Int {

  constructor() {
    super( 0, 1,
      [
        "PASS_THROUGH_STYLE_FILTER_1_BIAS_0",
        "PASS_THROUGH_STYLE_FILTER_0_BIAS_1",
      ],

      [
        new PassThroughStyle.Info( 0, 1, 0 ),
        new PassThroughStyle.Info( 1, 0, 1 ),
      ]

//!!! (2022/05/21 Remarked) PASS_THROUGH_STYLE_FILTER_0_BIAS_1_ACTIVATION_NO_ESCAPING seems still need activation escaping.
//     super( 0, 1,
//       [
//         "PASS_THROUGH_STYLE_FILTER_1_BIAS_0_ACTIVATION_ESCAPING",
//         "PASS_THROUGH_STYLE_FILTER_0_BIAS_1_ACTIVATION_NO_ESCAPING",
//       ],
//
//       [
//         new PassThroughStyle.Info( 0, 1, 0,  true ),
//         new PassThroughStyle.Info( 1, 0, 1, false ),
//       ]
    );

  }

  /**
   * Convert pass-through style id to information object.
   *
   * @param {number} nPassThroughStyleId
   *   It should be one of ValueDesc.PassThroughStyle.Singleton.Ids.Xxx.
   *
   * @return {PassThroughStyle.Info}
   *   It should be one of ValueDesc.PassThroughStyle.Singleton.integerToObjectMap according to the nActivationId.
   */
  getInfoById( nPassThroughStyleId ) {
    let info = this.integerToObjectMap.get( nPassThroughStyleId );
    return info;
  }

}

/**
 *
 * @member {number} nPassThroughStyleId
 *   The pass-through style id (ValueDesc.PassThroughStyle.Singleton.Ids.Xxx).
 *
 * @member {number} filterValue
 *   The convolution filter value for the pass-through style.
 *
 * @member {number} biasValue
 *   The convolution bias value for the pass-through style.
 *

//!!! (2022/05/21 Remarked) PASS_THROUGH_STYLE_FILTER_0_BIAS_1_ACTIVATION_NO_ESCAPING seems still need activation escaping.
//  * @member {boolean} bActivationEscaping
//  *   If true, the pass-through style will calculate the scale for letting the convolution result could escaping the activation function's
//  * non-linear part when pass-through is necessary.

 */
PassThroughStyle.Info = class {

//!!! (2022/05/21 Remarked) PASS_THROUGH_STYLE_FILTER_0_BIAS_1_ACTIVATION_NO_ESCAPING seems still need activation escaping.
//  constructor( nPassThroughStyleId, filterValue, biasValue, bActivationEscaping ) {

  constructor( nPassThroughStyleId, filterValue, biasValue ) {
    this.nPassThroughStyleId = nPassThroughStyleId;
    this.filterValue = filterValue;
    this.biasValue = biasValue;

//!!! (2022/05/21 Remarked) PASS_THROUGH_STYLE_FILTER_0_BIAS_1_ACTIVATION_NO_ESCAPING seems still need activation escaping.
//    this.bActivationEscaping = bActivationEscaping;
  }
}

/** The only one ValueDesc.PassThroughStyle instance. */
PassThroughStyle.Singleton = new PassThroughStyle;

@@ -150,406 +150,8 @@
 %0A *%0A
- %0A//!!! (2022/05/21 Remarked) PASS_THROUGH_STYLE_FILTER_0_BIAS_1_ACTIVATION_NO_ESCAPING seems still need activation escaping.%0A//  * Convert number value into integer between %5B 0, 1 %5D representing operation:%0A//  *   - 0: PASS_THROUGH_STYLE_FILTER_1_BIAS_0_ACTIVATION_ESCAPING    (depthwise, pointwise)%0A//  *   - 1: PASS_THROUGH_STYLE_FILTER_0_BIAS_1_ACTIVATION_NO_ESCAPING (squeeze-and-excitation)%0A%0A
  *%0A 
@@ -666,454 +666,8 @@
    %5D
-%0A%0A//!!! (2022/05/21 Remarked) PASS_THROUGH_STYLE_FILTER_0_BIAS_1_ACTIVATION_NO_ESCAPING seems still need activation escaping.%0A//     super( 0, 1,%0A//       %5B%0A//         %22PASS_THROUGH_STYLE_FILTER_1_BIAS_0_ACTIVATION_ESCAPING%22,%0A//         %22PASS_THROUGH_STYLE_FILTER_0_BIAS_1_ACTIVATION_NO_ESCAPING%22,%0A//       %5D,%0A//%0A//       %5B%0A//         new PassThroughStyle.Info( 0, 1, 0,  true ),%0A//         new PassThroughStyle.Info( 1, 0, 1, false ),%0A//       %5D
 %0A   
@@ -1002,26 +1002,32 @@
 to the n
-Activation
+PassThroughStyle
 Id.%0A   *
@@ -1482,617 +1482,41 @@
 %0A *%0A
-%0A//!!! (2022/05/21 Remarked) PASS_THROUGH_STYLE_FILTER_0_BIAS_1_ACTIVATION_NO_ESCAPING seems still need activation escaping.%0A//  * @member %7Bboolean%7D bActivationEscaping%0A//  *   If true, the pass-through style will calculate the scale for letting the convolution result could escaping the activation function's%0A//  * non-linear part when pass-through is necessary.%0A%0A */%0APassThroughStyle.Info = class %7B%0A%0A//!!! (2022/05/21 Remarked) PASS_THROUGH_STYLE_FILTER_0_BIAS_1_ACTIVATION_NO_ESCAPING seems still need activation escaping.%0A//  constructor( nPassThroughStyleId, filterValue, biasValue, bActivationEscaping )
+ */%0APassThroughStyle.Info = class
  %7B%0A%0A
@@ -1701,187 +1701,8 @@
 lue;
-%0A%0A//!!! (2022/05/21 Remarked) PASS_THROUGH_STYLE_FILTER_0_BIAS_1_ACTIVATION_NO_ESCAPING seems still need activation escaping.%0A//    this.bActivationEscaping = bActivationEscaping;
 %0A  %7D

Update ValueDesc_PassThroughStyle.js