class_docstr: Base class for defining an agent.
docstr: Preprocess state to generate input to neural network.
  
  When state is a scalar which is the index of the state space, convert
  it using one-hot encoding.
  
  For other cases, state and input are the same, roughly.
  
  CNTK only supports float32 and float64. Performs appropriate
  type conversion as well.
docstr_tok: ["Preprocess","state","to","generate","input","to","neural","network",".","When","state","is","a","scalar","which","is","the","index","of","the","state","space",",","convert","it","using","one-hot","encoding",".","For","other","cases",",","state","and","input","are","the","same",",","roughly",".","CNTK","only","supports","float32","and","float64",".","Performs","appropriate","type","conversion","as","well","."]
code: def _preprocess_state(self, state):
      """Preprocess state to generate input to neural network.
  
      When state is a scalar which is the index of the state space, convert
      it using one-hot encoding.
  
      For other cases, state and input are the same, roughly.
  
      CNTK only supports float32 and float64. Performs appropriate
      type conversion as well.
      """
      o = self._discretize_state_if_necessary(state)
      if self._discrete_observation_space:
          o = self._index_to_vector(o, self._num_states)
      if self._preprocessor is not None:
          o = self._preprocessor.preprocess(o)
      # TODO: allow float64 dtype.
      if o.dtype.name != "float32":
          o = o.astype(np.float32)
      return o
  
imports: from abc import ABCMeta, abstractmethod
  import numpy
  from importlib import import_module
  from .shared.discretize import BoxSpaceDiscretizer
label_desc: Use image node_id 15 for calling the AgentBaseClass obj's underlying member method code with example usage: obj._preprocess_state(state) and returns: o