Skip to content

Commit

Permalink
add developing doc
Browse files Browse the repository at this point in the history
Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz committed Oct 24, 2024
1 parent c524b17 commit 401cfa4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions doc/development/create-a-model-pt.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,15 @@ class SomeAtomicModel(BaseAtomicModel, torch.nn.Module):
pass
```

### Floating-point precision

When creating a new component, the floating-point precision should obey the [Floating-point precision of the model](../model/precision.md) section.
In implementation, the component should

- store parameters in the component precision, except those for input and output normalization;
- store normalization parameters in {py:data}`deepmd.pt.utils.env.GLOBAL_PT_FLOAT_PRECISION`;
- after input normalization, cast the input tensor to the component precision; before output normalization, cast the output tensor to the {py:data}`deepmd.pt.utils.env.GLOBAL_PT_FLOAT_PRECISION`.

## Register new arguments

To let someone uses your new component in their input file, you need to create a new method that returns some `Argument` of your new component, and then register new arguments. For example, the code below
Expand Down

0 comments on commit 401cfa4

Please sign in to comment.