Idiotproof file operations
This commit is contained in:
parent
5f4b34648d
commit
5b2b990ccb
@ -31,11 +31,9 @@ def main():
|
|||||||
loss_fn = torch.nn.MSELoss()
|
loss_fn = torch.nn.MSELoss()
|
||||||
|
|
||||||
loss = test(dataloader, model, loss_fn)
|
loss = test(dataloader, model, loss_fn)
|
||||||
with open('evaluation_results.txt', 'r+') as f:
|
with open('evaluation_results.txt', 'a+') as f:
|
||||||
f.read()
|
|
||||||
f.write(f'{str(loss)}\n')
|
f.write(f'{str(loss)}\n')
|
||||||
f.flush()
|
with open('evaluation_results.txt', 'r') as f:
|
||||||
f.seek(0)
|
|
||||||
values = [float(line) for line in f.readlines() if line]
|
values = [float(line) for line in f.readlines() if line]
|
||||||
make_plot(values)
|
make_plot(values)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user