Copyright | (c) Sam Stites 2017 |
---|---|

License | BSD3 |

Maintainer | sam@stites.io |

Stability | experimental |

Portability | non-portable |

Safe Haskell | None |

Language | Haskell2010 |

## Synopsis

- _gather :: Dynamic -> Dynamic -> Word -> IndexDynamic -> IO ()
- _scatter :: Dynamic -> Word -> IndexDynamic -> Dynamic -> IO ()
- _scatterAdd :: Dynamic -> Word -> IndexDynamic -> Dynamic -> IO ()
- _scatterFill :: Dynamic -> Word -> IndexDynamic -> HsReal -> IO ()

# Documentation

:: Dynamic | |

-> Dynamic | |

-> Word | dimension to operate on |

-> IndexDynamic | |

-> IO () |

From the Lua docs:

Creates a new Tensor from the original tensor by gathering a number of values from each "row", where the rows are along the dimension dim. The values in a LongTensor, passed as index, specify which values to take from each row. Specifically, the resulting Tensor, which will have the same size as the index tensor, is given by

-- dim = 1 result[i][j][k]... = src[index[i][j][k]...][j][k]... -- dim = 2 result[i][j][k]... = src[i][index[i][j][k]...][k]... -- etc.

where src is the original Tensor.

The same number of values are selected from each row, and the same value cannot be selected from a row more than once. The values in the index tensor must not be larger than the length of the row, that is they must be between 1 and src:size(dim) inclusive. It can be somewhat confusing to ensure that the index tensor has the correct shape. Viewed pictorially:

:: Dynamic | |

-> Word | dimension to operate on |

-> IndexDynamic | |

-> Dynamic | |

-> IO () |

From the Lua docs:

Writes all values from tensor src or the scalar val into self at the specified indices. The indices are specified with respect to the given dimension, dim, in the manner described in gather. Note that, as for gather, the values of index must be between 1 and self:size(dim) inclusive and all values in a row along the specified dimension must be unique.

:: Dynamic | |

-> Word | dimension to operate on |

-> IndexDynamic | |

-> Dynamic | |

-> IO () |

TODO

:: Dynamic | |

-> Word | dimension to operate on |

-> IndexDynamic | |

-> HsReal | |

-> IO () |

TODO