class_docstr: Simple Vanilla Policy Gradient.
  
  Args:
      env_spec (EnvSpec): Environment specification.
      policy (garage.tf.policies.StochasticPolicy): Policy.
      sampler (garage.sampler.Sampler): Sampler.
class_docstr_tok: ["Simple","Vanilla","Policy","Gradient",".","Args",":","env_spec","(","EnvSpec",")",":","Environment","specification",".","policy","(","garage.tf.policies.StochasticPolicy",")",":","Policy",".","sampler","(","garage.sampler.Sampler",")",":","Sampler","."]
docstr: Initialize optimizer and build computation graph.
docstr_tok: ["Initialize","optimizer","and","build","computation","graph","."]
code: def init_opt(self):
      """Initialize optimizer and build computation graph."""
      observation_dim = self.policy.observation_space.flat_dim
      action_dim = self.policy.action_space.flat_dim
      with tf.name_scope("inputs"):
          self._observation = tf.compat.v1.placeholder(
              tf.float32,
              shape=[None, observation_dim],
              name="observation",
          )
          self._action = tf.compat.v1.placeholder(
              tf.float32, shape=[None, action_dim], name="action"
          )
          self._returns = tf.compat.v1.placeholder(
              tf.float32, shape=[None], name="return"
          )
      policy_dist = self.policy.build(
          self._observation, name="policy"
      ).dist
      with tf.name_scope("loss"):
          ll = policy_dist.log_prob(self._action, name="log_likelihood")
          loss = -tf.reduce_mean(ll * self._returns)
      with tf.name_scope("train"):
          self._train_op = tf.compat.v1.train.AdamOptimizer(
              1e-3
          ).minimize(loss)
  
file_path: garage/src/garage/examples/tf/tutorial_vpg.py
imports: import numpy
  import tensorflow
  from garage import EpisodeBatch, log_performance, wrap_experiment
  from garage.envs import PointEnv
  from garage.experiment.deterministic import set_seed
  from garage.np import discount_cumsum
  from garage.sampler import LocalSampler
  from garage.tf.policies import GaussianMLPPolicy
  from garage.trainer import TFTrainer
label_desc: Use image node_id 2 for calling the SimpleVPG obj's underlying member method code with example usage: obj.init_opt() without return types