This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # inputs.py | |
| import torch | |
| inputs = torch.FloatTensor([ | |
| [1,1], | |
| [2,2], | |
| ]) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # Network.py | |
| import torch | |
| import torch.nn as nn | |
| import torch.nn.functional as F | |
| class Network(nn.Module): | |
| def __init__(self): | |
| super(Network, self).__init__() | |
| self.fc1 = nn.Linear(2, 10) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import asyncio | |
| async def async_func(): | |
| await asyncio.sleep(1) # <- replace this with your async code | |
| loop = asyncio.get_event_loop() | |
| coroutine = async_func() | |
| loop.run_until_complete(coroutine) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import 'package:flutter/material.dart'; | |
| void main() { | |
| runApp(ExampleApp()); | |
| } | |
| class ExampleApp extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import asyncio | |
| async def func(): | |
| raise ValueError('encountered some error') | |
| async def run(loop): | |
| task = asyncio.create_task(func()) | |
| await asyncio.sleep(1) | |
| await asyncio.sleep(1) | |
| await asyncio.sleep(1) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import asyncio | |
| async def func(): | |
| try: | |
| raise ValueError('encountered some error') | |
| except ValueError as e: | |
| # do something with the error | |
| async def run(loop): | |
| task = asyncio.create_task(func()) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import asyncio | |
| async def func(): | |
| raise ValueError('encountered some error') | |
| async def run(loop): | |
| task = asyncio.create_task(func()) | |
| while True: | |
| await asyncio.sleep(1) | |
| print('ping an external api') | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import asyncio | |
| async def func(): | |
| raise ValueError('encountered some error') | |
| async def run(loop): | |
| await asyncio.create_task(func()) | |
| while True: | |
| await asyncio.sleep(1) | |
| print('ping an external api') | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | ping an external api | |
| ping an external api | |
| ping an external api | |
| ping an external api | |
| ping an external api | |
| ping an external api | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import asyncio | |
| async def func(): | |
| raise ValueError('encountered some error') | |
| async def run(loop): | |
| task = asyncio.create_task(func()) | |
| while True: | |
| await asyncio.sleep(1) | |
| print('ping an external api') |