diff options
author | Brandon Amos <bamos@cs.cmu.edu> | 2016-03-25 23:25:21 +0300 |
---|---|---|
committer | Brandon Amos <bamos@cs.cmu.edu> | 2016-03-25 23:25:21 +0300 |
commit | 0ad1f5c6bb905cb4606b0e199e800892d4943204 (patch) | |
tree | efbffa8d92b1c911fee18a654c5481eb85ace2e6 | |
parent | 3cab0aed4edc6e78bcb9687182cee4407dc7c367 (diff) |
README: Briefly mention Tensor checks.
-rw-r--r-- | README.md | 32 |
1 files changed, 25 insertions, 7 deletions
@@ -95,9 +95,9 @@ at all, `argcheck` will complain: ```lua arguments: { - x = number -- + x = number -- } - + stdin:2: invalid arguments ``` @@ -142,8 +142,8 @@ becomes more clear: ```lua > addfive('') stdin:2: invalid arguments - -This function is going to do a simple addition. + +This function is going to do a simple addition. Give a number, it adds 5. Amazing. arguments: @@ -188,9 +188,9 @@ hello world > addfive(4) stdin:2: invalid arguments - -This function is going to do a simple addition. -Give a number, it adds 5. Amazing. + +This function is going to do a simple addition. +Give a number, it adds 5. Amazing. arguments: { @@ -282,6 +282,24 @@ hello world nil ``` +### Torch Tensors +Argcheck supports Torch Tensors type checks. +Specific tensor types like `Int`, `Float`, or `Double` can be +checked with `torch.<Type>Tensor`. +Any tensor type can be checked with `torch.*Tensor`. + +```lua +check = argcheck{ + {name="anyTensor", type="torch.*Tensor"}, + {name="fTensor", type="torch.FloatTensor"} +} + +check(torch.IntTensor(), torch.FloatTensor()) -- Good. +check(torch.FloatTensor(), torch.FloatTensor()) -- Good. +check(torch.FloatTensor(), torch.IntTensor()) -- Invalid. +``` + + ### Specific per-rule check It is possible to add an extra specific checking function for a given checking |