Exemplo n.º 1
0
  void allocate() {
    if (internal_ptr == NULL) {
      int status = dnnAllocateBuffer<Dtype>(
        reinterpret_cast<void **>(&internal_ptr), layout_int);
      CHECK_EQ(status, 0)
        << "Failed internal_ptr memory allocation with status "
        << status << "\n";

      caffe_set(prv_count(), Dtype(0), internal_ptr);
    }
  }
Exemplo n.º 2
0
  void create_conversions() {
    if (layout_int
        && !dnnLayoutCompare<Dtype>(layout_usr, layout_int)) {
      CHECK(layout_usr);
      int status = dnnConversionCreate<Dtype>(&convert_to_int, layout_usr,
              layout_int);
      CHECK_EQ(status, 0) << "Failed creation convert_to_int with status "
              << status << "\n";
      status = dnnConversionCreate<Dtype>(&convert_from_int, layout_int,
              layout_usr);
      CHECK_EQ(status, 0) << "Failed creation convert_from_int with status "
              << status << "\n";
      status = dnnAllocateBuffer<Dtype>(
              reinterpret_cast<void **>(&internal_ptr), layout_int);
      CHECK_EQ(status, 0)
              << "Failed internal_ptr memory allocation with status "
              << status << "\n";

      caffe_set(prv_count(), Dtype(0), internal_ptr);
    }
  }