Page MenuHomec4science

Network.py
No OneTemporary

File Metadata

Created
Thu, Feb 13, 00:30

Network.py

# -*- coding: utf-8 -*-
"""
Created on Tue Dec 26 07:14:15 2023
@author: srpv
contact: vigneashwara.solairajapandiyan@empa.ch
contact: vigneashwara.pandiyan@tii.ae
The codes in this following script will be used for the publication of the following work
"Dynamics of in-situ alloying of Ti6Al4V-Fe by means of acoustic emission monitoring
supported by operando synchrotron X-ray diffraction"
@any reuse of this code should be authorized by the first owner, code author
"""
# %%
# Librariies to import
import matplotlib.pyplot as plt
import numpy as np
from prettytable import PrettyTable
import torch.nn as nn
import torch
''' Network to be trained'''
class Network(nn.Module):
def __init__(self, emb_dim=4):
super(Network, self).__init__()
self.conv = nn.Sequential(
nn.Conv1d(in_channels=1, out_channels=8, kernel_size=32, stride=5),
nn.BatchNorm1d(8),
nn.PReLU(),
nn.Dropout(0.1),
nn.Conv1d(8, 16, kernel_size=16, stride=3),
nn.BatchNorm1d(16),
nn.PReLU(),
nn.Dropout(0.1),
nn.Conv1d(16, 32, kernel_size=8, stride=3),
nn.BatchNorm1d(32),
nn.PReLU(),
nn.Dropout(0.1),
nn.Conv1d(32, 64, kernel_size=5, stride=3),
nn.BatchNorm1d(64),
nn.PReLU(),
nn.Dropout(0.1),
nn.Conv1d(64, 128, kernel_size=3, stride=2),
nn.BatchNorm1d(128),
nn.PReLU(),
nn.Dropout(0.1),
)
self.fc = nn.Sequential(
nn.Linear(128*17, 256),
nn.PReLU(),
nn.Linear(256, 64),
nn.PReLU(),
nn.Linear(64, emb_dim),
)
def forward(self, x):
x = self.conv(x)
x = x.view(-1, 128*17)
x = self.fc(x)
return x

Event Timeline