class_docstr: Generate a sample with the given search space and policy (factory) that is expected to work on the space.
  When the metric is ready, it returns the whole trajectory.
  
  The generator is single-threaded, meaning that it can't generate multiple samples,
  and wait for their rewards simultaneously.
  For parallelization, you can create multiple generators and share one policy.
  
  Parameters
  ----------
  policy
      The policy to use.
      For the first generator, as the environment is never created,
      it's recommended to use a factory.
      For the following generators, you can reuse the same policy.
  search_space
      The search space to search.
  
  Attributes
  ----------
  policy
      The policy it uses. Use the attribute as parameter of another generator to reuse the policy.
  env
      The environment it uses.
  sample
      The sample it just generated.
  sample_logits
      The logits of the sample.
class_docstr_tok: ["Generate","a","sample","with","the","given","search","space","and","policy","(","factory",")","that","is","expected","to","work","on","the","space",".","When","the","metric","is","ready",",","it","returns","the","whole","trajectory",".","The","generator","is","single-threaded",",","meaning","that","it","ca","n't","generate","multiple","samples",",","and","wait","for","their","rewards","simultaneously",".","For","parallelization",",","you","can","create","multiple","generators","and","share","one","policy",".","Parameters","--","--","--","--","--","policy","The","policy","to","use",".","For","the","first","generator",",","as","the","environment","is","never","created",",","it","'s","recommended","to","use","a","factory",".","For","the","following","generators",",","you","can","reuse","the","same","policy",".","search_space","The","search","space","to","search",".","Attributes","--","--","--","--","--","policy","The","policy","it","uses",".","Use","the","attribute","as","parameter","of","another","generator","to","reuse","the","policy",".","env","The","environment","it","uses",".","sample","The","sample","it","just","generated",".","sample_logits","The","logits","of","the","sample","."]
docstr: Return the expected length of a trajectory.
docstr_tok: ["Return","the","expected","length","of","a","trajectory","."]
code: def expected_trajectory_length(self) -> int:
      """Return the expected length of a trajectory."""
      return self.env.num_steps
  
imports: from __future__ import annotations
  from copy import deepcopy
  from typing import Tuple, Callable
  import gym
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from typing_extensions import TypedDict
  from gym import spaces
  from tianshou.data import ReplayBuffer, Batch, to_torch, to_numpy
  from tianshou.policy import BasePolicy, PPOPolicy
  from nni.mutable import Categorical, CategoricalMultiple, Mutable, MutableAnnotation, Sample
label_desc: Use image node_id 2 for calling the TuningTrajectoryGenerator obj's underlying member method code with example usage: obj.expected_trajectory_length() and returns: self