code: def GenerateText(self, num_characters, ch):
      # Given a starting symbol we feed a fake sequence of size 1 to
      # our RNN num_character times. After each time we use output
      # probabilities to pick a next character to feed to the network.
      # Same character becomes part of the output
      CreateNetOnce(self.forward_net)
  
      text = "" + ch
      for _i in range(num_characters):
          workspace.FeedBlob(
              "seq_lengths",
              np.array([1] * self.batch_size, dtype=np.int32),
          )
          workspace.RunNet(self.prepare_state.Name())
  
          input = np.zeros([1, self.batch_size, self.D]).astype(
              np.float32
          )
          input[0][0][self.char_to_idx[ch]] = 1
  
          workspace.FeedBlob("input_blob", input)
          workspace.RunNet(self.forward_net.Name())
  
          p = workspace.FetchBlob(self.predictions)
          next = np.random.choice(self.D, p=p[0][0])
  
          ch = self.idx_to_char[next]
          text += ch
  
      print(text)
  
file_path: pytorch/caffe2/python/examples/char_rnn.py
imports: from caffe2.python import core, workspace, model_helper, utils, brew
  from caffe2.python.rnn_cell import LSTM
  from caffe2.proto import caffe2_pb2
  from caffe2.python.optimizer import build_sgd
  import argparse
  import logging
  import numpy
  from datetime import datetime
label_desc: Use image node_id 5 for calling the CharRNN obj's underlying member method code with example usage: obj.GenerateText(num_characters, ch) without return types