class_docstr: A policy that outputs actions based on observation and latent context.
  
  In PEARL, policies are conditioned on current state and a latent context
  (adaptation data) variable Z. This inference network estimates the
  posterior probability of z given past transitions. It uses context
  information stored in the encoder to infer the probabilistic value of z and
  samples from a policy conditioned on z.
  
  Args:
      latent_dim (int): Latent context variable dimension.
      context_encoder (garage.torch.embeddings.ContextEncoder): Recurrent or
          permutation-invariant context encoder.
      policy (garage.torch.policies.Policy): Policy used to train the
          network.
      use_information_bottleneck (bool): True if latent context is not
          deterministic; false otherwise.
      use_next_obs (bool): True if next observation is used in context
          for distinguishing tasks; false otherwise.
class_docstr_tok: ["A","policy","that","outputs","actions","based","on","observation","and","latent","context",".","In","PEARL",",","policies","are","conditioned","on","current","state","and","a","latent","context","(","adaptation","data",")","variable","Z",".","This","inference","network","estimates","the","posterior","probability","of","z","given","past","transitions",".","It","uses","context","information","stored","in","the","encoder","to","infer","the","probabilistic","value","of","z","and","samples","from","a","policy","conditioned","on","z.","Args",":","latent_dim","(","int",")",":","Latent","context","variable","dimension",".","context_encoder","(","garage.torch.embeddings.ContextEncoder",")",":","Recurrent","or","permutation-invariant","context","encoder",".","policy","(","garage.torch.policies.Policy",")",":","Policy","used","to","train","the","network",".","use_information_bottleneck","(","bool",")",":","True","if","latent","context","is","not","deterministic",";","false","otherwise",".","use_next_obs","(","bool",")",":","True","if","next","observation","is","used","in","context","for","distinguishing","tasks",";","false","otherwise","."]
docstr: Return context.
  
  Returns:
      torch.Tensor: Context values, with shape :math:`(X, N, C)`.
          X is the number of tasks. N is batch size. C is the combined
          size of observation, action, reward, and next observation if
          next observation is used in context. Otherwise, C is the
          combined size of observation, action, and reward.
docstr_tok: ["Return","context",".","Returns",":","torch.Tensor",":","Context","values",",","with","shape",":","math",":","`","(","X",",","N",",","C",")","`",".","X","is","the","number","of","tasks",".","N","is","batch","size",".","C","is","the","combined","size","of","observation",",","action",",","reward",",","and","next","observation","if","next","observation","is","used","in","context",".","Otherwise",",","C","is","the","combined","size","of","observation",",","action",",","and","reward","."]
code: def context(self):
      """Return context.
  
      Returns:
          torch.Tensor: Context values, with shape :math:`(X, N, C)`.
              X is the number of tasks. N is batch size. C is the combined
              size of observation, action, reward, and next observation if
              next observation is used in context. Otherwise, C is the
              combined size of observation, action, and reward.
  
      """
      return self._context
  
file_path: garage/src/garage/torch/policies/context_conditioned_policy.py
imports: import numpy
  import torch
  from torch import nn
  import torch.nn.functional
  from garage.torch import global_device, product_of_gaussians
label_desc: Use image node_id 10 for calling the ContextConditionedPolicy obj's underlying member method code with example usage: obj.context() and returns: self