Spaces:
Running
on
L40S
Running
on
L40S
File size: 553 Bytes
2252f3d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
from copy import deepcopy
from time import time
from typing import Any
import torch
from dataclasses import dataclass
from core.opt import MeshOptimizer
@dataclass
class Snapshot:
step:int
time:float
vertices:torch.Tensor #V,3
faces:torch.Tensor #F,3
optimizer:Any=None
def snapshot(opt:MeshOptimizer):
opt = deepcopy(opt)
opt._vertices.requires_grad_(False)
return Snapshot(
step=opt._step,
time=time()-opt._start,
vertices=opt.vertices,
faces=opt.faces,
optimizer=opt,
) |