###################################
## EDIT HERE, NOT AUTOGENERATED! ## 
###################################
#------------------------------------
# Python

import math, itertools, functools, copy, asyncio, time, importlib, datetime, importlib, os, dataclasses, platform
from datetime import datetime
from PIL import Image
from dataclasses import dataclass, asdict, is_dataclass
from typing import Union, Optional, TypeVar, Callable, Any

import numpy as np
import pandas as pd
import scipy
import matplotlib.pyplot as plt

#------------------------------------
# PyTorch

import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
from torchvision import datasets
from torch.utils.data import DataLoader, TensorDataset

torch.set_printoptions(linewidth=200)

#------------------------------------
# runtime

def in_colab():
    "Check if the code is running in Google Colaboratory"
    try:
        from google import colab
        return True
    except: return False

def in_notebook():
    "Check if the code is running in a jupyter notebook"
    if in_colab(): return True
    try:
        shell = get_ipython().__class__.__name__
        if shell == 'ZMQInteractiveShell': # Jupyter notebook, Spyder or qtconsole
            import IPython
            #IPython version lower then 6.0.0 don't work with output you update
            return IPython.__version__ >= '6.0.0'
        elif shell == 'TerminalInteractiveShell': return False  # Terminal running IPython
        else: return False  # Other type (?)
    except NameError: return False      # Probably standard Python interpreter

IN_NOTEBOOK = in_notebook()

if IN_NOTEBOOK: from tqdm.notebook import trange, tqdm
else: from tqdm import trange, tqdm

#------------------------------------
# python commons

def exists(val): return val is not None
def default(val, d):
    if exists(val): return val
    return d() if isfunction(d) else d

#------------------------------------
# ....
