help@rskworld.in +91 93305 39277
RSK World
  • Home
  • Development
    • Web Development
    • Mobile Apps
    • Software
    • Games
    • Project
  • Technologies
    • Data Science
    • AI Development
    • Cloud Development
    • Blockchain
    • Cyber Security
    • Dev Tools
    • Testing Tools
  • Blog
  • About
  • Contact

Theme Settings

Color Scheme
Display Options
Font Size
100%
Back to Project
RSK World
tensorflow-deeplearning
/
tests
RSK World
tensorflow-deeplearning
Deep learning with TensorFlow and Keras
tests
  • __init__.py159 B
  • test_cnns.py1.4 KB
  • test_neural_networks.py1.7 KB
RELEASE_NOTES_v1.0.0.mdtest_neural_networks.py
tests/test_neural_networks.py
Raw Download
Find: Go to:
"""
Tests for Neural Networks Module
Author: RSK World
Website: https://rskworld.in
Email: help@rskworld.in
Phone: +91 93305 39277
"""

import unittest
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))

import numpy as np
from src.neural_networks import (
    create_simple_neural_network,
    create_deep_neural_network
)

class TestNeuralNetworks(unittest.TestCase):
    """Test cases for neural networks module."""
    
    def test_create_simple_neural_network(self):
        """Test simple neural network creation."""
        model = create_simple_neural_network(input_shape=(784,), num_classes=10)
        self.assertIsNotNone(model)
        self.assertEqual(model.input_shape, (None, 784))
        self.assertEqual(model.output_shape, (None, 10))
    
    def test_create_deep_neural_network(self):
        """Test deep neural network creation."""
        model = create_deep_neural_network(
            input_shape=(784,),
            num_classes=10,
            hidden_layers=[256, 128, 64]
        )
        self.assertIsNotNone(model)
        self.assertEqual(model.input_shape, (None, 784))
        self.assertEqual(model.output_shape, (None, 10))
    
    def test_model_prediction(self):
        """Test model prediction."""
        model = create_simple_neural_network(input_shape=(784,), num_classes=10)
        test_input = np.random.randn(1, 784).astype('float32')
        prediction = model.predict(test_input, verbose=0)
        self.assertEqual(prediction.shape, (1, 10))
        self.assertAlmostEqual(np.sum(prediction[0]), 1.0, places=5)

if __name__ == '__main__':
    unittest.main()
51 lines•1.7 KB
python

About RSK World

Founded by Molla Samser, with Designer & Tester Rima Khatun, RSK World is your one-stop destination for free programming resources, source code, and development tools.

Founder: Molla Samser
Designer & Tester: Rima Khatun

Development

  • Game Development
  • Web Development
  • Mobile Development
  • AI Development
  • Development Tools

Legal

  • Terms & Conditions
  • Privacy Policy
  • Disclaimer

Contact Info

Nutanhat, Mongolkote
Purba Burdwan, West Bengal
India, 713147

+91 93305 39277

hello@rskworld.in
support@rskworld.in

© 2026 RSK World. All rights reserved.

Content used for educational purposes only. View Disclaimer