# source_cell

id: 1d53cbbe766542599055cbed1a5f91a9
name: personal-info
cell_type: code
checksum: 2f463bfa0602a7155576ddf994915071
notebook_id: dc8c62a996b249caac6df0d8212715ea
source:
  #| export
  def personal_info() -> Dict[str, str]:
      """
      Return personal information for this TinyTorch installation.
      
      TODO: Implement personal information configuration.
      
      STEP-BY-STEP:
      1. Create a dictionary with your personal details
      2. Include: developer (your name), email, institution, system_name, version
      3. Use your actual information (not placeholder text)
      4. Make system_name unique and descriptive
      5. Keep version as '1.0.0' for now
      
      EXAMPLE:
      {
          'developer': 'Vijay Janapa Reddi',
          'email': 'vj@eecs.harvard.edu', 
          'institution': 'Harvard University',
          'system_name': 'VJ-TinyTorch-Dev',
          'version': '1.0.0'
      }
      
      HINTS:
      - Replace the example with your real information
      - Use a descriptive system_name (e.g., 'YourName-TinyTorch-Dev')
      - Keep email format valid (contains @ and domain)
      - Make sure all values are strings
      """
      # YOUR CODE HERE
      raise NotImplementedError()


id: cdf595e8a93f46c494bf539d625ff407
name: system-info
cell_type: code
checksum: 9830bbad200b36dbcba411fdd32e6c47
notebook_id: dc8c62a996b249caac6df0d8212715ea
source:
  #| export
  def system_info() -> Dict[str, Any]:
      """
      Query and return system information for this TinyTorch installation.
      
      TODO: Implement system information queries.
      
      STEP-BY-STEP:
      1. Get Python version using sys.version_info
      2. Get platform using platform.system()
      3. Get architecture using platform.machine()
      4. Get CPU count using psutil.cpu_count()
      5. Get memory using psutil.virtual_memory().total
      6. Convert memory from bytes to GB (divide by 1024^3)
      7. Return all information in a dictionary
      
      EXAMPLE OUTPUT:
      {
          'python_version': '3.9.7',
          'platform': 'Darwin', 
          'architecture': 'arm64',
          'cpu_count': 8,
          'memory_gb': 16.0
      }
      
      HINTS:
      - Use f-string formatting for Python version: f"{major}.{minor}.{micro}"
      - Memory conversion: bytes / (1024^3) = GB
      - Round memory to 1 decimal place for readability
      - Make sure data types are correct (strings for text, int for cpu_count, float for memory_gb)
      """
      # YOUR CODE HERE
      raise NotImplementedError()


id: e74c10100ab74f71a63a38516132dd35
name: test-personal-info
cell_type: code
checksum: daef2867cc35e885160ba2d662a3586b
notebook_id: dc8c62a996b249caac6df0d8212715ea
source:
  # Test personal information configuration
  print("Testing personal information...")

  # Test personal_info function
  personal = personal_info()

  # Test return type
  assert isinstance(personal, dict), "personal_info should return a dictionary"

  # Test required keys
  required_keys = ['developer', 'email', 'institution', 'system_name', 'version']
  for key in required_keys:
      assert key in personal, f"Dictionary should have '{key}' key"

  # Test non-empty values
  for key, value in personal.items():
      assert isinstance(value, str), f"Value for '{key}' should be a string"
      assert len(value) > 0, f"Value for '{key}' cannot be empty"

  # Test email format
  assert '@' in personal['email'], "Email should contain @ symbol"
  assert '.' in personal['email'], "Email should contain domain"

  # Test version format
  assert personal['version'] == '1.0.0', "Version should be '1.0.0'"

  # Test system name (should be unique/personalized)
  assert len(personal['system_name']) > 5, "System name should be descriptive"

  print("✅ Personal info function tests passed!")
  print(f"✅ TinyTorch configured for: {personal['developer']}")
  print(f"✅ System: {personal['system_name']}")


id: e91aa041c33f43d4a7887edc300f312b
name: test-system-info
cell_type: code
checksum: f6d731bf3fffbb3ded6ebec73a2dd5fe
notebook_id: dc8c62a996b249caac6df0d8212715ea
source:
  # Test system information queries
  print("Testing system information...")

  # Test system_info function
  sys_info = system_info()

  # Test return type
  assert isinstance(sys_info, dict), "system_info should return a dictionary"

  # Test required keys
  required_keys = ['python_version', 'platform', 'architecture', 'cpu_count', 'memory_gb']
  for key in required_keys:
      assert key in sys_info, f"Dictionary should have '{key}' key"

  # Test data types
  assert isinstance(sys_info['python_version'], str), "python_version should be string"
  assert isinstance(sys_info['platform'], str), "platform should be string"
  assert isinstance(sys_info['architecture'], str), "architecture should be string"
  assert isinstance(sys_info['cpu_count'], int), "cpu_count should be integer"
  assert isinstance(sys_info['memory_gb'], (int, float)), "memory_gb should be number"

  # Test reasonable values
  assert sys_info['cpu_count'] > 0, "CPU count should be positive"
  assert sys_info['memory_gb'] > 0, "Memory should be positive"
  assert len(sys_info['python_version']) > 0, "Python version should not be empty"

  # Test that values are actually queried (not hardcoded)
  actual_version = f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}"
  assert sys_info['python_version'] == actual_version, "Python version should match actual system"

  print("✅ System info function tests passed!")
  print(f"✅ Python: {sys_info['python_version']} on {sys_info['platform']}")
  print(f"✅ Hardware: {sys_info['cpu_count']} cores, {sys_info['memory_gb']} GB RAM")


