class_docstr: Unit tests for policy gradient.
class_docstr_tok: ["Unit","tests","for","policy","gradient","."]
code: def test_init_shared_representation(self, mock_parameters):
      action_space = spaces.Discrete(2)
      observation_space = spaces.Box(0, 1, (1,))
      self._setup_parameters(mock_parameters.return_value)
      mock_parameters.return_value.shared_representation = True
  
      sut = ActorCritic("", observation_space, action_space)
  
      self.assertEqual(sut._num_actions, 2)
      self.assertIsNone(sut._num_states)
      self.assertEqual(sut._shape_of_inputs, (1,))
      self.assertFalse(sut._discrete_observation_space)
      self.assertIsNone(sut._space_discretizer)
      self.assertIsNone(sut._preprocessor)
  
      self.assertTrue(
          set(sut._policy_network.parameters).issubset(
              set(sut._value_network.parameters)
          )
      )
      diff = set(sut._value_network.parameters).difference(
          set(sut._policy_network.parameters)
      )
      # one for W and one for b
      self.assertEqual(len(diff), 2)
  
      shapes = []
      for item in diff:
          shapes.append(item.shape)
      self.assertEqual(set(shapes), {(2, 1), (1,)})
  
imports: import unittest
  import cntk.contrib.deeprl.tests.spaces
  import numpy
  from cntk.contrib.deeprl.agent.policy_gradient import ActorCritic
  from cntk.layers import Dense
  from cntk.losses import cross_entropy_with_softmax
  from cntk.ops import input_variable, placeholder
label_desc: Use image node_id 6 for calling the PolicyGradientTest obj's underlying member method code with example usage: obj.test_init_shared_representation(mock_parameters) without return types