# -*- coding: utf-8 -*-
"""
Created on Sun Nov  8 12:41:23 2020

@author: Sihoon
"""

import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import math

def linear_weights_init(m):
    if isinstance(m, nn.Linear):
        stdv = 1. / math.sqrt(m.weight.size(1))
        m.weight.data.uniform_(-stdv, stdv)
        if m.bias is not None:
            m.bias.data.uniform_(-stdv, stdv)


def conv_weights_init(m):
    if isinstance(m, nn.Conv2d):
        torch.nn.init.xavier_uniform_(m.weight.data)
        if m.bias is not None:
            torch.nn.init.zeros_(m.bias)