1. 14 7月, 2017 2 次提交
    • 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
    • F
      Refactor `Tensor::CopyFrom()` · a1dc4311
      fengjiayi 提交于
      a1dc4311
  2. 12 7月, 2017 2 次提交
    • F
      Add Tensor::CopyFrom and Tensor::mutable_data(Place place) · 69d99d48
      fengjiayi 提交于
      1. Add `Tensor::CopyFrom`. Current version can only support CPU memory
      copy. The support of GPU will be provided later by `paddle::memory`.
      The current implementation of `Tensor::CopyFrom` is a little inefficient:
      Every time `CopyFrom` is called, tensor will re-allocate its memory. However, if
      we try to check and reuse `placeholder_`, we have to provide a template
      parameter for `CopyFrom` to indicate the data type. It seems strange for
      a simple copy function.
      
      2. Add `Tensor::mutable_data(Place place)`, which directly use member
      variable `dims_` as its dim parameter. This interface is required by
      `Op::InferShape`.
      69d99d48
    • F
      fix some syntax problems · 2dccab87
      fengjiayi 提交于
      2dccab87
  3. 11 7月, 2017 2 次提交
    • F
      add more test · 0665dc97
      fengjiayi 提交于
      0665dc97
    • F
      Add several interfaces for Tensor class · ca39515e
      fengjiayi 提交于
      1. Add member variable 'DDim dims_' and a getter function 'dims()'.
      'dims' is supposed to hold tensor's shape during Op::InferShape.
      2. Remove 'mutable_data' which use default Place. User must specify a
      explicit Place when call 'mutable_data'.
      3. A PlaceHolder may be shared by more than one tensor, and some of them may be the others' slices. So we add a new member variable 'offset_' for Tensor, which is used to show the byte offset between PlaceHolder::ptr_ and where tensor's data really begins.
      4. Add functions 'ShareDataFrom' and 'Slice' for Tensor.
      
      TODO: Tensor needs a 'CopyFrom' function.
      ca39515e
  4. 03 7月, 2017 6 次提交
  5. 28 6月, 2017 2 次提交
  6. 27 6月, 2017 1 次提交