• F
    Refactor Tensor::CopyFrom() · dcfcf687
    fengjiayi 提交于
    1. Add template T which indicates data type to `CopyFrom()`, `Slice()`
    and `ShareData()` functions. This makes `CopyData()` code much clearer.
    
    2. Add `set_dim()`.
    
    3. `product(DDim)` transforms `DDim` to `vector<int>` first and then calculate
    its product. That might be quite slow. For `product(dims_)` is frequently
    used in Tensor, we add a mumber variable `numel_` as a cache of the
    product result.
    TODO: refactor `product()` to make it more efficient.
    
    4. Unable Tensor::operator=
    
    5. Remove the limit of POD type, because `float16` and `int8` are not POD type.
    dcfcf687
tensor_test.cc 7.0 KB