class_docstr: Creates tensor collections for SageMaker Debugger.
class_docstr_tok: ["Creates","tensor","collections","for","SageMaker","Debugger","."]
docstr: Constructor for collection configuration.
  
  Args:
      name (str or PipelineVariable): Required. The name of the collection configuration.
      parameters (dict[str, str] or dict[str, PipelineVariable]): Optional. The parameters
          for the collection configuration.
  
  **Example of creating a CollectionConfig object:**
  
  .. code-block:: python
  
      from sagemaker.debugger import CollectionConfig
  
      collection_configs=[
          CollectionConfig(name="tensor_collection_1")
          CollectionConfig(name="tensor_collection_2")
          ...
          CollectionConfig(name="tensor_collection_n")
      ]
  
  For a full list of Debugger built-in collection, see
  `Debugger Built in Collections
  <https://github.com/awslabs/sagemaker-debugger/blob/master
  /docs/api.md#built-in-collections>`_.
  
  **Example of creating a CollectionConfig object with parameter adjustment:**
  
  You can use the following CollectionConfig template in two ways:
  (1) to adjust the parameters of the built-in tensor collections,
  and (2) to create custom tensor collections.
  
  If you put the built-in collection names to the ``name`` parameter,
  ``CollectionConfig`` takes it to match the built-in collections and adjust parameters.
  If you specify a new name to the ``name`` parameter,
  ``CollectionConfig`` creates a new tensor collection, and you must use
  ``include_regex`` parameter to specify regex of tensors you want to collect.
  
  .. code-block:: python
  
      from sagemaker.debugger import CollectionConfig
  
      collection_configs=[
          CollectionConfig(
              name="tensor_collection",
              parameters={
                  "key_1": "value_1",
                  "key_2": "value_2"
                  ...
                  "key_n": "value_n"
              }
          )
      ]
  
  The following list shows the available CollectionConfig parameters.
  
  +--------------------------+---------------------------------------------------------+
  | Parameter Key            | Descriptions                                            |
  +==========================+=========================================================+
  |``include_regex``         |  Specify a list of regex patterns of tensors to save.   |
  |                          |                                                         |
  |                          |  Tensors whose names match these patterns will be saved.|
  +--------------------------+---------------------------------------------------------+
  |``save_histogram``        |  Set *True* if want to save histogram output data for   |
  |                          |                                                         |
  |                          |  TensorFlow visualization.                              |
  +--------------------------+---------------------------------------------------------+
  |``reductions``            |  Specify certain reduction values of tensors.           |
  |                          |                                                         |
  |                          |  This helps reduce the amount of data saved and         |
  |                          |                                                         |
  |                          |  increase training speed.                               |
  |                          |                                                         |
  |                          |  Available values are ``min``, ``max``, ``median``,     |
  |                          |                                                         |
  |                          |  ``mean``, ``std``, ``variance``, ``sum``, and ``prod``.|
  +--------------------------+---------------------------------------------------------+
  |``save_interval``         |  Specify how often to save tensors in steps.            |
  |                          |                                                         |
  |``train.save_interval``   |  You can also specify the save intervals                |
  |                          |                                                         |
  |``eval.save_interval``    |  in TRAIN, EVAL, PREDICT, and GLOBAL modes.             |
  |                          |                                                         |
  |``predict.save_interval`` |  The default value is 500 steps.                        |
  |                          |                                                         |
  |``global.save_interval``  |                                                         |
  +--------------------------+---------------------------------------------------------+
  |``save_steps``            |  Specify the exact step numbers to save tensors.        |
  |                          |                                                         |
  |``train.save_steps``      |  You can also specify the save steps                    |
  |                          |                                                         |
  |``eval.save_steps``       |  in TRAIN, EVAL, PREDICT, and GLOBAL modes.             |
  |                          |                                                         |
  |``predict.save_steps``    |                                                         |
  |                          |                                                         |
  |``global.save_steps``     |                                                         |
  +--------------------------+---------------------------------------------------------+
  |``start_step``            |  Specify the exact start step to save tensors.          |
  |                          |                                                         |
  |``train.start_step``      |  You can also specify the start steps                   |
  |                          |                                                         |
  |``eval.start_step``       |  in TRAIN, EVAL, PREDICT, and GLOBAL modes.             |
  |                          |                                                         |
  |``predict.start_step``    |                                                         |
  |                          |                                                         |
  |``global.start_step``     |                                                         |
  +--------------------------+---------------------------------------------------------+
  |``end_step``              |  Specify the exact end step to save tensors.            |
  |                          |                                                         |
  |``train.end_step``        |  You can also specify the end steps                     |
  |                          |                                                         |
  |``eval.end_step``         |  in TRAIN, EVAL, PREDICT, and GLOBAL modes.             |
  |                          |                                                         |
  |``predict.end_step``      |                                                         |
  |                          |                                                         |
  |``global.end_step``       |                                                         |
  +--------------------------+---------------------------------------------------------+
  
  For example, the following code shows how to control the save_interval parameters
  of the built-in ``losses`` tensor collection. With the following collection configuration,
  Debugger collects loss values every 100 steps from training loops and every 10 steps
  from evaluation loops.
  
  .. code-block:: python
  
      collection_configs=[
          CollectionConfig(
              name="losses",
              parameters={
                  "train.save_interval": "100",
                  "eval.save_interval": "10"
              }
          )
      ]
code: def __init__(
      self,
      name: Union[str, PipelineVariable],
      parameters: Optional[
          Dict[str, Union[str, PipelineVariable]]
      ] = None,
  ):
      """Constructor for collection configuration.
  
      Args:
          name (str or PipelineVariable): Required. The name of the collection configuration.
          parameters (dict[str, str] or dict[str, PipelineVariable]): Optional. The parameters
              for the collection configuration.
  
      **Example of creating a CollectionConfig object:**
  
      .. code-block:: python
  
          from sagemaker.debugger import CollectionConfig
  
          collection_configs=[
              CollectionConfig(name="tensor_collection_1")
              CollectionConfig(name="tensor_collection_2")
              ...
              CollectionConfig(name="tensor_collection_n")
          ]
  
      For a full list of Debugger built-in collection, see
      `Debugger Built in Collections
      <https://github.com/awslabs/sagemaker-debugger/blob/master
      /docs/api.md#built-in-collections>`_.
  
      **Example of creating a CollectionConfig object with parameter adjustment:**
  
      You can use the following CollectionConfig template in two ways:
      (1) to adjust the parameters of the built-in tensor collections,
      and (2) to create custom tensor collections.
  
      If you put the built-in collection names to the ``name`` parameter,
      ``CollectionConfig`` takes it to match the built-in collections and adjust parameters.
      If you specify a new name to the ``name`` parameter,
      ``CollectionConfig`` creates a new tensor collection, and you must use
      ``include_regex`` parameter to specify regex of tensors you want to collect.
  
      .. code-block:: python
  
          from sagemaker.debugger import CollectionConfig
  
          collection_configs=[
              CollectionConfig(
                  name="tensor_collection",
                  parameters={
                      "key_1": "value_1",
                      "key_2": "value_2"
                      ...
                      "key_n": "value_n"
                  }
              )
          ]
  
      The following list shows the available CollectionConfig parameters.
  
      +--------------------------+---------------------------------------------------------+
      | Parameter Key            | Descriptions                                            |
      +==========================+=========================================================+
      |``include_regex``         |  Specify a list of regex patterns of tensors to save.   |
      |                          |                                                         |
      |                          |  Tensors whose names match these patterns will be saved.|
      +--------------------------+---------------------------------------------------------+
      |``save_histogram``        |  Set *True* if want to save histogram output data for   |
      |                          |                                                         |
      |                          |  TensorFlow visualization.                              |
      +--------------------------+---------------------------------------------------------+
      |``reductions``            |  Specify certain reduction values of tensors.           |
      |                          |                                                         |
      |                          |  This helps reduce the amount of data saved and         |
      |                          |                                                         |
      |                          |  increase training speed.                               |
      |                          |                                                         |
      |                          |  Available values are ``min``, ``max``, ``median``,     |
      |                          |                                                         |
      |                          |  ``mean``, ``std``, ``variance``, ``sum``, and ``prod``.|
      +--------------------------+---------------------------------------------------------+
      |``save_interval``         |  Specify how often to save tensors in steps.            |
      |                          |                                                         |
      |``train.save_interval``   |  You can also specify the save intervals                |
      |                          |                                                         |
      |``eval.save_interval``    |  in TRAIN, EVAL, PREDICT, and GLOBAL modes.             |
      |                          |                                                         |
      |``predict.save_interval`` |  The default value is 500 steps.                        |
      |                          |                                                         |
      |``global.save_interval``  |                                                         |
      +--------------------------+---------------------------------------------------------+
      |``save_steps``            |  Specify the exact step numbers to save tensors.        |
      |                          |                                                         |
      |``train.save_steps``      |  You can also specify the save steps                    |
      |                          |                                                         |
      |``eval.save_steps``       |  in TRAIN, EVAL, PREDICT, and GLOBAL modes.             |
      |                          |                                                         |
      |``predict.save_steps``    |                                                         |
      |                          |                                                         |
      |``global.save_steps``     |                                                         |
      +--------------------------+---------------------------------------------------------+
      |``start_step``            |  Specify the exact start step to save tensors.          |
      |                          |                                                         |
      |``train.start_step``      |  You can also specify the start steps                   |
      |                          |                                                         |
      |``eval.start_step``       |  in TRAIN, EVAL, PREDICT, and GLOBAL modes.             |
      |                          |                                                         |
      |``predict.start_step``    |                                                         |
      |                          |                                                         |
      |``global.start_step``     |                                                         |
      +--------------------------+---------------------------------------------------------+
      |``end_step``              |  Specify the exact end step to save tensors.            |
      |                          |                                                         |
      |``train.end_step``        |  You can also specify the end steps                     |
      |                          |                                                         |
      |``eval.end_step``         |  in TRAIN, EVAL, PREDICT, and GLOBAL modes.             |
      |                          |                                                         |
      |``predict.end_step``      |                                                         |
      |                          |                                                         |
      |``global.end_step``       |                                                         |
      +--------------------------+---------------------------------------------------------+
  
      For example, the following code shows how to control the save_interval parameters
      of the built-in ``losses`` tensor collection. With the following collection configuration,
      Debugger collects loss values every 100 steps from training loops and every 10 steps
      from evaluation loops.
  
      .. code-block:: python
  
          collection_configs=[
              CollectionConfig(
                  name="losses",
                  parameters={
                      "train.save_interval": "100",
                      "eval.save_interval": "10"
                  }
              )
          ]
  
      """
      self.name = name
      self.parameters = parameters
  
imports: from __future__ import absolute_import
  from abc import ABC
  from typing import Union, Optional, List, Dict
  import attr
  import smdebug_rulesconfig
  from sagemaker import image_uris
  from sagemaker.utils import build_dict, name_from_base
  from sagemaker.workflow.entities import PipelineVariable
  from sagemaker.debugger.profiler_constants import DETAIL_PROF_PROCESSING_DEFAULT_INSTANCE_TYPE, DETAIL_PROF_PROCESSING_DEFAULT_VOLUME_SIZE
label_desc: Use image node_id 1 to create a new CollectionConfig object from inherited base classes: object with example: obj = CollectionConfig(name, parameters)