Example #1
0
def main():
	device = 'cuda'
	generator = sample_generator(train_batch_size, mod_n, NR)
	model = oampnet(num_layers, generator.constellation, generator.real_QAM_const, generator.imag_QAM_const, device=device)
	model = model.to(device=device)

	optimizer = torch.optim.Adam(model.parameters(), lr=learning_rate)
	train(model, optimizer, generator, device)
	print('******************************** Now Testing **********************************************')
Example #2
0
def main():
	generator = sample_generator(validtn_batch_size, mod_n, NR)
	device = 'cuda'
	model = oampnet(num_layers, generator.constellation, generator.real_QAM_const, generator.imag_QAM_const, device=device)
	model = model.to(device=device)
	model.load_state_dict(torch.load(model_filename))
	print('*******Successfully loaded pre-trained model*********** from directory : ', model_filename)

	test(model, generator, device)
	print('******************************** Now Testing **********************************************')
Example #3
0
def main():
	generator = sample_generator(time_batch_size, mod_n, NR)
	device = 'cuda'
	model_network = iterative_classifier(d_model, n_head, nhid, nlayers, mod_n, NR, d_transmitter_encoding, generator.real_QAM_const, generator.imag_QAM_const, generator.constellation, device, dropout)
	model_oampnet = oampnet(num_layers, generator.constellation, generator.real_QAM_const, generator.imag_QAM_const, device=device)

	model_network = model_network.to(device=device)
	model_oampnet = model_oampnet.to(device=device)

	network_checkpoint = torch.load(model_network_filename)

	model_network.load_state_dict(network_checkpoint['model_state_dict'])
	model_oampnet.load_state_dict(torch.load(model_oampnet_filename))
	print('*******Successfully loaded pre-trained model***********')

	test(model_network, model_oampnet, generator, device)
	print('******************************** Now Testing **********************************************')