Exemplo n.º 1
0
 def test_get_backbone_network(self, mock_vars):
     """Test get_backbone_network."""
     mock_net = TrainOneStepWithLossScaleCell()
     mock_net.network = MagicMock()
     mock_cell = {'_cells': {'key': mock_net}}
     mock_vars.return_value = mock_cell
     res = AnalyzeObject.get_backbone_network(MagicMock())
     self.assertEqual(res, 'MagicMock')
Exemplo n.º 2
0
 def test_get_backbone_network_with_loss_cell(self, mock_vars):
     """Test get_backbone_network with loss_cell."""
     mock_cell = {
         '_cells': {
             'key':
             WithLossCell(MagicMock(), SoftmaxCrossEntropyWithLogits(0.1))
         }
     }
     mock_vars.return_value = mock_cell
     res = AnalyzeObject.get_backbone_network(MagicMock())
     self.assertEqual(res, 'MagicMock')