vkML follows PyTorch's names and shapes deliberately, so code ports without translation. The table below is not a claim — it is extracted from the test suite, where every pair is an assertion that the two agree within a declared tolerance.
Verified equivalences
41 operators are tested directly against their torch counterpart. If a row is here, a test compares them on every run.
| PyTorch | vkML |
|---|---|
torch.abs | abs |
torch.add | add |
torch.amax | amax |
torch.amin | amin |
torch.argmax | argmax |
torch.argmin | argmin |
torch.cos | cos |
torch.div | div |
torch.eq | equal |
torch.erf | erf |
torch.erfc | erfc |
torch.exp | exp |
torch.nn.functional.gelu | gelu |
torch.gt | greater |
torch.ge | greater_equal |
torch.lt | less |
torch.le | less_equal |
torch.log | log |
torch.log_softmax | log_softmax |
torch.maximum | maximum |
torch.mean | mean |
torch.minimum | minimum |
torch.mul | mul |
torch.neg | neg |
torch.ne | not_equal |
torch.pow | pow |
torch.reciprocal | reciprocal |
torch.relu | relu |
torch.rsqrt | rsqrt |
torch.sigmoid | sigmoid |
torch.sign | sign |
torch.nn.functional.silu | silu |
torch.sin | sin |
torch.softmax | softmax |
torch.sqrt | sqrt |
torch.square | square |
torch.sub | sub |
torch.sum | sum |
torch.tanh | tanh |
torch.tril | tril |
torch.triu | triu |
Conventions that carry over
- Layout is row-major, as NumPy, PyTorch and DLPack.
shape()[0]is the outermost axis. - A
state_dictloads directly.Linearstores its weight as(out_features, in_features)and transposes inforward, exactly as PyTorch does, so the tensors line up. - Reductions take
dimandkeepdimwith torch's meanings.
Where it deliberately differs
.sizeis the element count, following NumPy rather than PyTorch, and it is a property:x.size()raises. Usex.shape.- Shape arguments are sequences:
x.reshape([3, 2]), notx.reshape(3, 2). maxandminreturn values, not(values, indices), and are spelledamaxandaminto say so.to()converts dtype, not device. Placement happens at creation:V.tensor(x, device=dev).- Seeds do not match.
manual_seedmirrors torch in spirit, not in stream — the two draw from different generators, so equal seeds give different weights.