class_docstr: Policy net with Categorical distribution for discrete scalar actions.
  
  This is a combination of a network with a top-layer distribution for
  action sampling.
  
  Args:
      action_space (optional): An instance of :class:`~texar.tf.agents.Space`
          specifying the action space. If not given, an discrete action space
          `[0, high]` is created with `high` specified in :attr:`hparams`.
      network (optional): A network that takes in state and returns
          outputs for generating actions. For example, an instance of subclass
          of :class:`~texar.tf.modules.FeedForwardNetworkBase`. If `None`,
          a network is created as specified in :attr:`hparams`.
      network_kwargs (dict, optional): Keyword arguments for network
          constructor.
          Note that the `hparams` argument for network
          constructor is specified in the "network_hparams" field of
          :attr:`hparams` and should not be included in `network_kwargs`.
          Ignored if :attr:`network` is given.
      hparams (dict or HParams, optional): Hyperparameters. Missing
          hyperparamerter will be set to default values. See
          :meth:`default_hparams` for the hyperparameter sturcture and
          default values.
  
  .. document private functions
  .. automethod:: _build
class_docstr_tok: ["Policy","net","with","Categorical","distribution","for","discrete","scalar","actions",".","This","is","a","combination","of","a","network","with","a","top-layer","distribution","for","action","sampling",".","Args",":","action_space","(","optional",")",":","An","instance","of",":","class",":","`","~texar.tf.agents.Space","`","specifying","the","action","space",".","If","not","given",",","an","discrete","action","space","`","[","0",",","high","]","`","is","created","with","`","high","`","specified","in",":","attr",":","`","hparams","`",".","network","(","optional",")",":","A","network","that","takes","in","state","and","returns","outputs","for","generating","actions",".","For","example",",","an","instance","of","subclass","of",":","class",":","`","~texar.tf.modules.FeedForwardNetworkBase","`",".","If","`","None","`",",","a","network","is","created","as","specified","in",":","attr",":","`","hparams","`",".","network_kwargs","(","dict",",","optional",")",":","Keyword","arguments","for","network","constructor",".","Note","that","the","`","hparams","`","argument","for","network","constructor","is","specified","in","the","``","network_hparams","''","field","of",":","attr",":","`","hparams","`","and","should","not","be","included","in","`","network_kwargs","`",".","Ignored","if",":","attr",":","`","network","`","is","given",".","hparams","(","dict","or","HParams",",","optional",")",":","Hyperparameters",".","Missing","hyperparamerter","will","be","set","to","default","values",".","See",":","meth",":","`","default_hparams","`","for","the","hyperparameter","sturcture","and","default","values",".","..","document","private","functions","..","automethod",":",":","_build"]
docstr: Returns a dictionary of hyperparameters with default values.
  
  .. code-block:: python
  
      {
          'network_type': 'FeedForwardNetwork',
          'network_hparams': {
              'layers': [
                  {
                      'type': 'Dense',
                      'kwargs': {'units': 256, 'activation': 'relu'}
                  },
                  {
                      'type': 'Dense',
                      'kwargs': {'units': 256, 'activation': 'relu'}
                  },
              ]
          },
          'distribution_kwargs': {
              'dtype': 'int32',
              'validate_args': False,
              'allow_nan_stats': True
          },
          'action_space': 2,
          'make_output_layer': True,
          'name': 'categorical_policy_net'
      }
  
  Here:
  
  "distribution_kwargs": dict
      Keyword arguments for the :tf_main:`Categorical
      <distributions/Categorical>` distribution constructor. Arguments
      `logits` and `probs` should not be included as they are inferred
      from the inputs. Argument `dtype` can be a string (e.g., `int32`)
      and will be converted to a corresponding tf dtype.
  
  "action_space": int
      Upper bound of the action space. The resulting action space is
      all discrete scalar numbers between 0 and the upper bound specified
      here (both inclusive).
  
  "make_output_layer": bool
      Whether to append a dense layer to the network to transform
      features to logits for action sampling. If `False`, the final layer
      output of network must match the action space.
  
  See :class:`~texar.tf.modules.PolicyNetBase.default_hparams` for details
  of other hyperparameters.
docstr_tok: ["Returns","a","dictionary","of","hyperparameters","with","default","values",".","..","code-block",":",":","python","{","'network_type","'",":","'FeedForwardNetwork","'",",","'network_hparams","'",":","{","'layers","'",":","[","{","'type","'",":","'Dense","'",",","'kwargs","'",":","{","'units","'",":","256",",","'activation","'",":","'relu","'","}","}",",","{","'type","'",":","'Dense","'",",","'kwargs","'",":","{","'units","'",":","256",",","'activation","'",":","'relu","'","}","}",",","]","}",",","'distribution_kwargs","'",":","{","'dtype","'",":","'int32","'",",","'validate_args","'",":","False",",","'allow_nan_stats","'",":","True","}",",","'action_space","'",":","2",",","'make_output_layer","'",":","True",",","'name","'",":","'categorical_policy_net'","}","Here",":","''","distribution_kwargs","''",":","dict","Keyword","arguments","for","the",":","tf_main",":","`","Categorical","<","distributions\/Categorical",">","`","distribution","constructor",".","Arguments","`","logits","`","and","`","probs","`","should","not","be","included","as","they","are","inferred","from","the","inputs",".","Argument","`","dtype","`","can","be","a","string","(","e.g.",",","`","int32","`",")","and","will","be","converted","to","a","corresponding","tf","dtype",".","``","action_space","''",":","int","Upper","bound","of","the","action","space",".","The","resulting","action","space","is","all","discrete","scalar","numbers","between","0","and","the","upper","bound","specified","here","(","both","inclusive",")",".","``","make_output_layer","''",":","bool","Whether","to","append","a","dense","layer","to","the","network","to","transform","features","to","logits","for","action","sampling",".","If","`","False","`",",","the","final","layer","output","of","network","must","match","the","action","space",".","See",":","class",":","`","~texar.tf.modules.PolicyNetBase.default_hparams","`","for","details","of","other","hyperparameters","."]
code: def default_hparams():
      """Returns a dictionary of hyperparameters with default values.
  
      .. code-block:: python
  
          {
              'network_type': 'FeedForwardNetwork',
              'network_hparams': {
                  'layers': [
                      {
                          'type': 'Dense',
                          'kwargs': {'units': 256, 'activation': 'relu'}
                      },
                      {
                          'type': 'Dense',
                          'kwargs': {'units': 256, 'activation': 'relu'}
                      },
                  ]
              },
              'distribution_kwargs': {
                  'dtype': 'int32',
                  'validate_args': False,
                  'allow_nan_stats': True
              },
              'action_space': 2,
              'make_output_layer': True,
              'name': 'categorical_policy_net'
          }
  
      Here:
  
      "distribution_kwargs": dict
          Keyword arguments for the :tf_main:`Categorical
          <distributions/Categorical>` distribution constructor. Arguments
          `logits` and `probs` should not be included as they are inferred
          from the inputs. Argument `dtype` can be a string (e.g., `int32`)
          and will be converted to a corresponding tf dtype.
  
      "action_space": int
          Upper bound of the action space. The resulting action space is
          all discrete scalar numbers between 0 and the upper bound specified
          here (both inclusive).
  
      "make_output_layer": bool
          Whether to append a dense layer to the network to transform
          features to logits for action sampling. If `False`, the final layer
          output of network must match the action space.
  
      See :class:`~texar.tf.modules.PolicyNetBase.default_hparams` for details
      of other hyperparameters.
      """
      hparams = PolicyNetBase.default_hparams()
      hparams.update(
          {
              "distribution_kwargs": {
                  "dtype": "int32",
                  "validate_args": False,
                  "allow_nan_stats": True,
              },
              "action_space": 2,
              "make_output_layer": True,
              "name": "categorical_policy_net",
          }
      )
      return hparams
  
imports: import numpy
  import tensorflow
  from tensorflow_probability import distributions
  from texar.tf.module_base import ModuleBase
  from texar.tf.agents.agent_utils import Space
  from texar.tf.utils import utils
  from texar.tf.utils.dtypes import get_tf_dtype
label_desc: Use image node_id 2 for calling the CategoricalPolicyNet obj's underlying member method code with example usage: obj.default_hparams() and returns: hparams