class_docstr: Fits a Gaussian distribution to the outputs of a CNN.
  
  Args:
      env_spec (garage.envs.env_spec.EnvSpec): Environment specification.
      filters (Tuple[Tuple[int, Tuple[int, int]], ...]): Number and dimension
          of filters. For example, ((3, (3, 5)), (32, (3, 3))) means there
          are two convolutional layers. The filter for the first layer have 3
          channels and its shape is (3 x 5), while the filter for the second
          layer have 32 channels and its shape is (3 x 3).
      strides(tuple[int]): The stride of the sliding window. For example,
          (1, 2) means there are two convolutional layers. The stride of the
          filter for first layer is 1 and that of the second layer is 2.
      padding (str): The type of padding algorithm to use,
          either 'SAME' or 'VALID'.
      name (str): Model name, also the variable scope.
      hidden_sizes (list[int]): Output dimension of dense layer(s) for
          the Convolutional model for mean. For example, (32, 32) means the
          network consists of two dense layers, each with 32 hidden units.
      hidden_nonlinearity (Callable): Activation function for intermediate
          dense layer(s). It should return a tf.Tensor. Set it to
          None to maintain a linear activation.
      hidden_w_init (Callable): Initializer function for the weight
          of intermediate dense layer(s). The function should return a
          tf.Tensor.
      hidden_b_init (Callable): Initializer function for the bias
          of intermediate dense layer(s). The function should return a
          tf.Tensor.
      output_nonlinearity (Callable): Activation function for output dense
          layer. It should return a tf.Tensor. Set it to None to
          maintain a linear activation.
      output_w_init (Callable): Initializer function for the weight
          of output dense layer(s). The function should return a
          tf.Tensor.
      output_b_init (Callable): Initializer function for the bias
          of output dense layer(s). The function should return a
          tf.Tensor.
      name (str): Name of this model (also used as its scope).
      learn_std (bool): Whether to train the standard deviation parameter of
          the Gaussian distribution.
      init_std (float): Initial standard deviation for the Gaussian
          distribution.
      adaptive_std (bool): Whether to use a neural network to learn the
          standard deviation of the Gaussian distribution. Unless True, the
          standard deviation is learned as a parameter which is not
          conditioned on the inputs.
      std_share_network (bool): Boolean for whether the mean and standard
          deviation models share a CNN network. If True, each is a head from
          a single body network. Otherwise, the parameters are estimated
          using the outputs of two indepedent networks.
      std_filters (Tuple[Tuple[int, Tuple[int, int]], ...]): Number and
          dimension of filters. For example, ((3, (3, 5)), (32, (3, 3)))
          means there are two convolutional layers. The filter for the first
          layer have 3 channels and its shape is (3 x 5), while the filter
          for the second layer have 32 channels and its shape is (3 x 3).
      std_strides(tuple[int]): The stride of the sliding window. For example,
          (1, 2) means there are two convolutional layers. The stride of the
          filter for first layer is 1 and that of the second layer is 2.
      std_padding (str): The type of padding algorithm to use in std network,
          either 'SAME' or 'VALID'.
      std_hidden_sizes (list[int]): Output dimension of dense layer(s) for
          the Conv for std. For example, (32, 32) means the Conv consists
          of two hidden layers, each with 32 hidden units.
      std_hidden_nonlinearity (callable): Nonlinearity for each hidden layer
          in the std network.
      std_output_nonlinearity (Callable): Activation function for output
          dense layer in the std network. It should return a tf.Tensor. Set
          it to None to maintain a linear activation.
      layer_normalization (bool): Bool for using layer normalization or not.
      normalize_inputs (bool): Bool for normalizing inputs or not.
      normalize_outputs (bool): Bool for normalizing outputs or not.
      subsample_factor (float): The factor to subsample the data. By default
          it is 1.0, which means using all the data.
      optimizer (garage.tf.Optimizer): Optimizer used for fitting the model.
      optimizer_args (dict): Arguments for the optimizer. Default is None,
          which means no arguments.
      use_trust_region (bool): Whether to use a KL-divergence constraint.
      max_kl_step (float): KL divergence constraint for each iteration, if
          `use_trust_region` is active.
docstr: Fit regressor based on paths.
  
  Args:
      paths (dict[numpy.ndarray]): Sample paths.
docstr_tok: ["Fit","regressor","based","on","paths",".","Args",":","paths","(","dict","[","numpy.ndarray","]",")",":","Sample","paths","."]
code: def fit(self, paths):
      """Fit regressor based on paths.
  
      Args:
          paths (dict[numpy.ndarray]): Sample paths.
  
      """
      xs = np.concatenate([p["observations"] for p in paths])
      if isinstance(
          self._env_spec.observation_space, akro.Image
      ) and len(xs[0].shape) < len(
          self._env_spec.observation_space.shape
      ):
          xs = self._env_spec.observation_space.unflatten_n(xs)
      ys = np.concatenate([p["returns"] for p in paths])
      ys = ys.reshape((-1, 1))
  
      if self._subsample_factor < 1:
          num_samples_tot = xs.shape[0]
          idx = np.random.randint(
              0,
              num_samples_tot,
              int(num_samples_tot * self._subsample_factor),
          )
          xs, ys = xs[idx], ys[idx]
  
      if self._normalize_inputs:
          # recompute normalizing constants for inputs
          self._x_mean.load(np.mean(xs, axis=0, keepdims=True))
          self._x_std.load(np.std(xs, axis=0, keepdims=True) + 1e-8)
          self._old_network.x_mean.load(
              np.mean(xs, axis=0, keepdims=True)
          )
          self._old_network.x_std.load(
              np.std(xs, axis=0, keepdims=True) + 1e-8
          )
      if self._normalize_outputs:
          # recompute normalizing constants for outputs
          self._y_mean.load(np.mean(ys, axis=0, keepdims=True))
          self._y_std.load(np.std(ys, axis=0, keepdims=True) + 1e-8)
          self._old_network.y_mean.load(
              np.mean(ys, axis=0, keepdims=True)
          )
          self._old_network.y_std.load(
              np.std(ys, axis=0, keepdims=True) + 1e-8
          )
      inputs = [xs, ys]
      loss_before = self._optimizer.loss(inputs)
      tabular.record("{}/LossBefore".format(self._name), loss_before)
      self._optimizer.optimize(inputs)
      loss_after = self._optimizer.loss(inputs)
      tabular.record("{}/LossAfter".format(self._name), loss_after)
      if self._use_trust_region:
          tabular.record(
              "{}/MeanKL".format(self._name),
              self._optimizer.constraint_val(inputs),
          )
      tabular.record(
          "{}/dLoss".format(self._name), loss_before - loss_after
      )
      self._old_model.parameters = self.parameters
  
imports: import akro
  from dowel import tabular
  import numpy
  import tensorflow
  from garage import make_optimizer
  from garage.experiment import deterministic
  from garage.np.baselines.baseline import Baseline
  from garage.tf import compile_function
  from garage.tf.baselines.gaussian_cnn_baseline_model import GaussianCNNBaselineModel
  from garage.tf.optimizers import LBFGSOptimizer, PenaltyLBFGSOptimizer
label_desc: Use image node_id 3 for calling the GaussianCNNBaseline obj's underlying member method code with example usage: obj.fit(paths) without return types