class_docstr: Implements a recurrent DQN designed to produce melody sequences.
class_docstr_tok: ["Implements","a","recurrent","DQN","designed","to","produce","melody","sequences","."]
docstr: Get note scores from the reward_rnn to use as a reward based on data.
  
  Runs the reward_rnn on an observation and initial state. Useful for
  maintaining the probabilities of the original LSTM model while training with
  reinforcement learning.
  
  Args:
    observation: One-hot encoding of the observed note.
    state: Vector representing the internal state of the target_q_network
      LSTM.
  
  Returns:
    Action scores produced by reward_rnn.
docstr_tok: ["Get","note","scores","from","the","reward_rnn","to","use","as","a","reward","based","on","data",".","Runs","the","reward_rnn","on","an","observation","and","initial","state",".","Useful","for","maintaining","the","probabilities","of","the","original","LSTM","model","while","training","with","reinforcement","learning",".","Args",":","observation",":","One-hot","encoding","of","the","observed","note",".","state",":","Vector","representing","the","internal","state","of","the","target_q_network","LSTM",".","Returns",":","Action","scores","produced","by","reward_rnn","."]
code: def get_reward_rnn_scores(self, observation, state):
      """Get note scores from the reward_rnn to use as a reward based on data.
  
      Runs the reward_rnn on an observation and initial state. Useful for
      maintaining the probabilities of the original LSTM model while training with
      reinforcement learning.
  
      Args:
        observation: One-hot encoding of the observed note.
        state: Vector representing the internal state of the target_q_network
          LSTM.
  
      Returns:
        Action scores produced by reward_rnn.
      """
      state = np.atleast_2d(state)
  
      input_batch = np.reshape(
          observation, (self.reward_rnn.batch_size, 1, self.num_actions)
      )
      lengths = np.full(self.reward_rnn.batch_size, 1, dtype=int)
  
      (rewards,) = self.session.run(
          self.reward_scores,
          {
              self.reward_rnn.melody_sequence: input_batch,
              self.reward_rnn.initial_state: state,
              self.reward_rnn.lengths: lengths,
          },
      )
      return rewards
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import os
  import random
  import urllib
  from magenta.models.rl_tuner import note_rnn_loader
  from magenta.models.rl_tuner import rl_tuner_eval_metrics
  from magenta.models.rl_tuner import rl_tuner_ops
  import matplotlib.pyplot
  from note_seq import melodies_lib
  from note_seq import midi_io
  import numpy
  import scipy.special
  from six.moves import range
  from six.moves import reload_module
  from six.moves import urllib
  import tensorflow.compat.v1
label_desc: Use image node_id 15 for calling the RLTuner obj's underlying member method code with example usage: obj.get_reward_rnn_scores(observation, state) and returns: rewards