在caffe中,Blob类实现的源码位于caffe根目录下的src/caffe/路径中的blob.cpp文件中,本文对这个文件进行详细解读。

#include <climits>
#include <vector>

#include "caffe/blob.hpp"
#include "caffe/common.hpp"
#include "caffe/syncedmem.hpp"
#include "caffe/util/math_functions.hpp"

这几行代码是blob.cpp文件包含的头文件。

namespace caffe {

这一行定义caffe命名空间

template <typename Dtype>
void Blob<Dtype>::Reshape(const int num, const int channels, const int height,
    const int width) {
  vector<int> shape(4);
  shape[0] = num;
  shape[1] = channels;
  shape[2] = height;
  shape[3] = width;
  Reshape(shape);
}

这个函数的是Blob的变形函数,使用num、channels、height、width这四个维度信息对Blob进行变形。在函数中,将这四个维度信息保存到shape向量中,根据shape向量来改变Blob形状。

template <typename Dtype>
void Blob<Dtype>::Reshape(const vector<int>& shape) {
  CHECK_LE(shape.size(), kMaxBlobAxes);
  count_ = 1;
  shape_.resize(shape.size());
  if (!shape_data_ || shape_data_->size() < shape.size() * sizeof(int)) {
    shape_data_.reset(new SyncedMemory(shape.size() * sizeof(int)));
  }
  int* shape_data = static_cast<int*>(shape_data_->mutable_cpu_data());
  for (int i = 0; i < shape.size(); ++i) {
    CHECK_GE(shape[i], 0);
    if (count_ != 0) {
      CHECK_LE(shape[i], INT_MAX / count_) << "blob size exceeds INT_MAX";
    }
    count_ *= shape[i];
    shape_[i] = shape[i];
    shape_data[i] = shape[i];
  }
  if (count_ > capacity_) {
    capacity_ = count_;
    data_.reset(new SyncedMemory(capacity_ * sizeof(Dtype)));
    diff_.reset(new SyncedMemory(capacity_ * sizeof(Dtype)));
  }
}

        这个函数是Reshape函数的落实函数,通过shape向量来改变Blob的形状。在这个函数中,还对类的成员函数进行赋值,为数据分配内存空间。

        函数中先是判断shape的尺寸是否小于或等于最大的Blob尺寸,然后将成员变量shape_的尺寸赋值为shape的尺寸。

        接下来shape_data_.reset(new SyncedMemory(shape.size() * sizeof(int)));为shape_data_分配内存空间。int* shape_data = static_cast<int*>(shape_data_->mutable_cpu_data());的作用是定义一个指向shape_data_的指针shape_data。

        接下来在一个for循环中,对shape的每个维度进行遍历,先判断每个shape[i]是否大于等于0,然后判断shape[i]是否小于允许的最大值(即整数的最大值/count_),然后将每个shape[i]累乘到count_上,并将shape[i]赋值给shape_[i],再将shape[i]赋值给shape_data指向的内存空间数据。

        在函数的最后,判断Blob的元素数量count_是否大于Blob的容量capacity_。如果大于,将容量修改为与元素数相等,最后为data_和diff_分配内存空间。

template <typename Dtype>
void Blob<Dtype>::Reshape(const BlobShape& shape) {
  CHECK_LE(shape.dim_size(), kMaxBlobAxes);
  vector<int> shape_vec(shape.dim_size());
  for (int i = 0; i < shape.dim_size(); ++i) {
    shape_vec[i] = shape.dim(i);
  }
  Reshape(shape_vec);
}

上面这个函数也是一个Reshape函数,它的输入为BlobShape类型变量shape,在函数中,先判断shape的维度数是否小于等于最大的维度数。然后将shape每个维度的尺寸赋值给shape_vec向量,并依据shape_vec来调用相应的Reshape函数来改变blob的形状。

template <typename Dtype>
void Blob<Dtype>::ReshapeLike(const Blob<Dtype>& other) {
  Reshape(other.shape());
}

上面这个函数的作用是将本类的Blob尺寸改变为与other相同的尺寸,函数中调用Reshape函数实现。

template <typename Dtype>
Blob<Dtype>::Blob(const int num, const int channels, const int height,
    const int width)
  // capacity_ must be initialized before calling Reshape
  : capacity_(0) {
  Reshape(num, channels, height, width);
}

这个函数是Blob的构造函数,输入为num、channels、height、width这四个维度信息,调用Reshape函数来实现。

template <typename Dtype>
Blob<Dtype>::Blob(const vector<int>& shape)
  // capacity_ must be initialized before calling Reshape
  : capacity_(0) {
  Reshape(shape);
}

这个函数是Blob的另一个构造函数,它的输入为shape向量。

template <typename Dtype>
const int* Blob<Dtype>::gpu_shape() const {
  CHECK(shape_data_);
  return (const int*)shape_data_->gpu_data();
}

这个函数是读取gpu_shape地址的函数,函数返回指向shape_data_的指针。

template <typename Dtype>
const Dtype* Blob<Dtype>::cpu_data() const {
  CHECK(data_);
  return (const Dtype*)data_->cpu_data();
}

这个函数返回指向cpu_data的指针。

template <typename Dtype>
void Blob<Dtype>::set_cpu_data(Dtype* data) {
  CHECK(data);
  // Make sure CPU and GPU sizes remain equal
  size_t size = count_ * sizeof(Dtype);
  if (data_->size() != size) {
    data_.reset(new SyncedMemory(size));
    diff_.reset(new SyncedMemory(size));
  }
  data_->set_cpu_data(data);
}

这个函数用来设置cpu_data,用data指向的数据替代data_所指向的cpu数据。

template <typename Dtype>
const Dtype* Blob<Dtype>::gpu_data() const {
  CHECK(data_);
  return (const Dtype*)data_->gpu_data();
}

这个函数返回指向gpu_data的指针。

template <typename Dtype>
void Blob<Dtype>::set_gpu_data(Dtype* data) {
  CHECK(data);
  // Make sure CPU and GPU sizes remain equal
  size_t size = count_ * sizeof(Dtype);
  if (data_->size() != size) {
    data_.reset(new SyncedMemory(size));
    diff_.reset(new SyncedMemory(size));
  }
  data_->set_gpu_data(data);
}

这个函数用来设置gpu_data,用data指向的数据替代data_所指向的gpu数据。

template <typename Dtype>
const Dtype* Blob<Dtype>::cpu_diff() const {
  CHECK(diff_);
  return (const Dtype*)diff_->cpu_data();
}

这个函数返回指向cpu_diff的指针。

template <typename Dtype>
const Dtype* Blob<Dtype>::gpu_diff() const {
  CHECK(diff_);
  return (const Dtype*)diff_->gpu_data();
}

这个函数返回指向gpu_diff的指针。

template <typename Dtype>
Dtype* Blob<Dtype>::mutable_cpu_data() {
  CHECK(data_);
  return static_cast<Dtype*>(data_->mutable_cpu_data());
}

这个函数返回指向可以读写的cpu_data的指针。

template <typename Dtype>
Dtype* Blob<Dtype>::mutable_gpu_data() {
  CHECK(data_);
  return static_cast<Dtype*>(data_->mutable_gpu_data());
}

这个函数返回指向可以读写的gpu_data的指针。

template <typename Dtype>
Dtype* Blob<Dtype>::mutable_cpu_diff() {
  CHECK(diff_);
  return static_cast<Dtype*>(diff_->mutable_cpu_data());
}

这个函数返回指向可以读写的cpu_diff的指针。

template <typename Dtype>
Dtype* Blob<Dtype>::mutable_gpu_diff() {
  CHECK(diff_);
  return static_cast<Dtype*>(diff_->mutable_gpu_data());
}

这个函数返回指向可以读写的gpu_diff的指针。

template <typename Dtype>
void Blob<Dtype>::ShareData(const Blob& other) {
  CHECK_EQ(count_, other.count());
  data_ = other.data();
}

这个函数的作用是分享另一个Blob的数据data,在函数中如果other与本类Blob的元素数相等,则将other中的data复制到data_中。

template <typename Dtype>
void Blob<Dtype>::ShareDiff(const Blob& other) {
  CHECK_EQ(count_, other.count());
  diff_ = other.diff();
}

这个函数的作用是分享另一个Blob的数据diff,在函数中,如果other与本类Blob的元素数相等,则将other中的diff复制到diff_中。

template <> void Blob<unsigned int>::Update() { NOT_IMPLEMENTED; }
template <> void Blob<int>::Update() { NOT_IMPLEMENTED; }

这两行声明了两个Blob的更新函数。

template <typename Dtype>
void Blob<Dtype>::Update() {
  // We will perform update based on where the data is located.
  switch (data_->head()) {
  case SyncedMemory::HEAD_AT_CPU:
    // perform computation on CPU
    caffe_axpy<Dtype>(count_, Dtype(-1),
        static_cast<const Dtype*>(diff_->cpu_data()),
        static_cast<Dtype*>(data_->mutable_cpu_data()));
    break;
  case SyncedMemory::HEAD_AT_GPU:
  case SyncedMemory::SYNCED:
#ifndef CPU_ONLY
    // perform computation on GPU
    caffe_gpu_axpy<Dtype>(count_, Dtype(-1),
        static_cast<const Dtype*>(diff_->gpu_data()),
        static_cast<Dtype*>(data_->mutable_gpu_data()));
#else
    NO_GPU;
#endif
    break;
  default:
    LOG(FATAL) << "Syncedmem not initialized.";
  }
}

这个函数是更新函数Update的详细定义。首先通过一个switch语句判断data_位于哪里,如果在CPU中,则调用caffe_axpy函数计算法diff_和data_各元素的和。如果数据在GPU或者在CPU和GPU中同步,则调用caffe_gpu_axpy来计算diff_和data_各元素的和。需要注意的是,如果caffe编译时使能了CPU_ONLY选项,则不进行GPU相关的计算。其中caffe_axpy和caffe_gpu_axpy函数在math_functions.hpp文件中定义,这个文件位于caffe根目录下的include/caffe/util/路径中,有兴趣可以自己研究一下这个函数的实现过程。

template <> unsigned int Blob<unsigned int>::asum_data() const {
  NOT_IMPLEMENTED;
  return 0;
}

template <> int Blob<int>::asum_data() const {
  NOT_IMPLEMENTED;
  return 0;
}

这几行代码,声明了两个计算data元素绝对值和(L1范数)的函数。

template <typename Dtype>
Dtype Blob<Dtype>::asum_data() const {
  if (!data_) { return 0; }
  switch (data_->head()) {
  case SyncedMemory::HEAD_AT_CPU:
    return caffe_cpu_asum(count_, cpu_data());
  case SyncedMemory::HEAD_AT_GPU:
  case SyncedMemory::SYNCED:
#ifndef CPU_ONLY
  {
    Dtype asum;
    caffe_gpu_asum(count_, gpu_data(), &asum);
    return asum;
  }
#else
    NO_GPU;
#endif
  case SyncedMemory::UNINITIALIZED:
    return 0;
  default:
    LOG(FATAL) << "Unknown SyncedMemory head state: " << data_->head();
  }
  return 0;
}

上面的函数是计算data元素绝对值和的详细定义。这个函数使用的方法与更新函数类似,也是使用一个switch语句判断data_位于哪里,如果在CPU中,则调用caffe_cpu_asum函数计算法data_各元素的绝对值和。如果数据在GPU或者在CPU和GPU中同步,则调用caffe_gpu_asum函数计算法data_各元素的绝对值和。如果caffe编译时使能了CPU_ONLY选项,则不进行GPU相关的计算。其中,caffe_cpu_asum和caffe_gpu_asum函数也是在math_functions.hpp文件中定义。

template <> unsigned int Blob<unsigned int>::asum_diff() const {
  NOT_IMPLEMENTED;
  return 0;
}

template <> int Blob<int>::asum_diff() const {
  NOT_IMPLEMENTED;
  return 0;
}

这几行代码,声明了两个计算diff元素绝对值和(L1范数)的函数。

template <typename Dtype>
Dtype Blob<Dtype>::asum_diff() const {
  if (!diff_) { return 0; }
  switch (diff_->head()) {
  case SyncedMemory::HEAD_AT_CPU:
    return caffe_cpu_asum(count_, cpu_diff());
  case SyncedMemory::HEAD_AT_GPU:
  case SyncedMemory::SYNCED:
#ifndef CPU_ONLY
  {
    Dtype asum;
    caffe_gpu_asum(count_, gpu_diff(), &asum);
    return asum;
  }
#else
    NO_GPU;
#endif
  case SyncedMemory::UNINITIALIZED:
    return 0;
  default:
    LOG(FATAL) << "Unknown SyncedMemory head state: " << diff_->head();
  }
  return 0;
}

上面的函数是计算diff元素绝对值和的详细定义。与计算data元素绝对值和的函数实现是完全一样的,大家可以自行分析。

template <> unsigned int Blob<unsigned int>::sumsq_data() const {
  NOT_IMPLEMENTED;
  return 0;
}

template <> int Blob<int>::sumsq_data() const {
  NOT_IMPLEMENTED;
  return 0;
}

这几行代码,声明了两个计算data元素平方和(L2范数)的函数。

template <typename Dtype>
Dtype Blob<Dtype>::sumsq_data() const {
  Dtype sumsq;
  const Dtype* data;
  if (!data_) { return 0; }
  switch (data_->head()) {
  case SyncedMemory::HEAD_AT_CPU:
    data = cpu_data();
    sumsq = caffe_cpu_dot(count_, data, data);
    break;
  case SyncedMemory::HEAD_AT_GPU:
  case SyncedMemory::SYNCED:
#ifndef CPU_ONLY
    data = gpu_data();
    caffe_gpu_dot(count_, data, data, &sumsq);
#else
    NO_GPU;
#endif
    break;
  case SyncedMemory::UNINITIALIZED:
    return 0;
  default:
    LOG(FATAL) << "Unknown SyncedMemory head state: " << data_->head();
  }
  return sumsq;
}

上面的函数是计算data元素平方和的详细定义。这个函数也是使用一个switch语句判断data_位于哪里,如果在CPU中,则调用caffe_cpu_dot函数计算法data_各元素的平方和。如果数据在GPU或者在CPU和GPU中同步,则调用caffe_gpu_dot函数计算法data_各元素的平方和。如果caffe编译时使能了CPU_ONLY选项,则不进行GPU相关的计算。其中,caffe_cpu_dot和caffe_gpu_dot函数也是在math_functions.hpp文件中定义。

template <> unsigned int Blob<unsigned int>::sumsq_diff() const {
  NOT_IMPLEMENTED;
  return 0;
}

template <> int Blob<int>::sumsq_diff() const {
  NOT_IMPLEMENTED;
  return 0;
}

这几行代码,声明了两个计算diff元素平方和(L2范数)的函数。

template <typename Dtype>
Dtype Blob<Dtype>::sumsq_diff() const {
  Dtype sumsq;
  const Dtype* diff;
  if (!diff_) { return 0; }
  switch (diff_->head()) {
  case SyncedMemory::HEAD_AT_CPU:
    diff = cpu_diff();
    sumsq = caffe_cpu_dot(count_, diff, diff);
    break;
  case SyncedMemory::HEAD_AT_GPU:
  case SyncedMemory::SYNCED:
#ifndef CPU_ONLY
    diff = gpu_diff();
    caffe_gpu_dot(count_, diff, diff, &sumsq);
    break;
#else
    NO_GPU;
#endif
  case SyncedMemory::UNINITIALIZED:
    return 0;
  default:
    LOG(FATAL) << "Unknown SyncedMemory head state: " << data_->head();
  }
  return sumsq;
}

上面的函数是计算diff元素绝平方和的详细定义。与计算data元素平方和的函数实现是完全一样的,大家可以自行分析。

template <> void Blob<unsigned int>::scale_data(unsigned int scale_factor) {
  NOT_IMPLEMENTED;
}

template <> void Blob<int>::scale_data(int scale_factor) {
  NOT_IMPLEMENTED;
}

这几行代码,声明了两个对data元素进行比例缩放的函数。

template <typename Dtype>
void Blob<Dtype>::scale_data(Dtype scale_factor) {
  Dtype* data;
  if (!data_) { return; }
  switch (data_->head()) {
  case SyncedMemory::HEAD_AT_CPU:
    data = mutable_cpu_data();
    caffe_scal(count_, scale_factor, data);
    return;
  case SyncedMemory::HEAD_AT_GPU:
  case SyncedMemory::SYNCED:
#ifndef CPU_ONLY
    data = mutable_gpu_data();
    caffe_gpu_scal(count_, scale_factor, data);
    return;
#else
    NO_GPU;
#endif
  case SyncedMemory::UNINITIALIZED:
    return;
  default:
    LOG(FATAL) << "Unknown SyncedMemory head state: " << data_->head();
  }
}

上面的函数是对data元素进行比例缩放的详细定义。这个函数也是使用一个switch语句判断data_位于哪里,如果在CPU中,则调用caffe_scal函数计算法data_各元素的比例缩放,缩放系数为scale_factor。如果数据在GPU或者在CPU和GPU中同步,则调用caffe_gpu_scal函数计算法data_各元素的比例缩放。如果caffe编译时使能了CPU_ONLY选项,则不进行GPU相关的计算。其中,caffe_scal和caffe_gpu_scal函数也是在math_functions.hpp文件中定义。

template <> void Blob<unsigned int>::scale_diff(unsigned int scale_factor) {
  NOT_IMPLEMENTED;
}

template <> void Blob<int>::scale_diff(int scale_factor) {
  NOT_IMPLEMENTED;
}

这几行代码,声明了两个对diff元素进行比例缩放的函数。

template <typename Dtype>
void Blob<Dtype>::scale_diff(Dtype scale_factor) {
  Dtype* diff;
  if (!diff_) { return; }
  switch (diff_->head()) {
  case SyncedMemory::HEAD_AT_CPU:
    diff = mutable_cpu_diff();
    caffe_scal(count_, scale_factor, diff);
    return;
  case SyncedMemory::HEAD_AT_GPU:
  case SyncedMemory::SYNCED:
#ifndef CPU_ONLY
    diff = mutable_gpu_diff();
    caffe_gpu_scal(count_, scale_factor, diff);
    return;
#else
    NO_GPU;
#endif
  case SyncedMemory::UNINITIALIZED:
    return;
  default:
    LOG(FATAL) << "Unknown SyncedMemory head state: " << diff_->head();
  }
}

上面的函数是计算diff元素比例缩放的详细定义。与计算data元素比例缩放的函数实现是完全一样的,大家可以自行分析。

template <typename Dtype>
bool Blob<Dtype>::ShapeEquals(const BlobProto& other) {
  if (other.has_num() || other.has_channels() ||
      other.has_height() || other.has_width()) {
    // Using deprecated 4D Blob dimensions --
    // shape is (num, channels, height, width).
    // Note: we do not use the normal Blob::num(), Blob::channels(), etc.
    // methods as these index from the beginning of the blob shape, where legacy
    // parameter blobs were indexed from the end of the blob shape (e.g., bias
    // Blob shape (1 x 1 x 1 x N), IP layer weight Blob shape (1 x 1 x M x N)).
    return shape_.size() <= 4 &&
           LegacyShape(-4) == other.num() &&
           LegacyShape(-3) == other.channels() &&
           LegacyShape(-2) == other.height() &&
           LegacyShape(-1) == other.width();
  }
  vector<int> other_shape(other.shape().dim_size());
  for (int i = 0; i < other.shape().dim_size(); ++i) {
    other_shape[i] = other.shape().dim(i);
  }
  return shape_ == other_shape;
}

上面这个函数的作用是判断本类的Blob与函数形参other中定义的Blob形状是否相同。在函数中首先判断other中的维度信息是否是老版本的维度信息,即num、channels、height、width这四个维度。如果是,按照老版本的逻辑进行判断,如果维度信息则返回true。如果不是老版本的维度信息,则将other的维度信息赋值到other_shape向量中,然后判断other_shape与shape_是否相等,相等则返回true。

template <typename Dtype>
void Blob<Dtype>::CopyFrom(const Blob& source, bool copy_diff, bool reshape) {
  if (source.count() != count_ || source.shape() != shape_) {
    if (reshape) {
      ReshapeLike(source);
    } else {
      LOG(FATAL) << "Trying to copy blobs of different sizes.";
    }
  }
  switch (Caffe::mode()) {
  case Caffe::GPU:
    if (copy_diff) {
      caffe_copy(count_, source.gpu_diff(),
          static_cast<Dtype*>(diff_->mutable_gpu_data()));
    } else {
      caffe_copy(count_, source.gpu_data(),
          static_cast<Dtype*>(data_->mutable_gpu_data()));
    }
    break;
  case Caffe::CPU:
    if (copy_diff) {
      caffe_copy(count_, source.cpu_diff(),
          static_cast<Dtype*>(diff_->mutable_cpu_data()));
    } else {
      caffe_copy(count_, source.cpu_data(),
          static_cast<Dtype*>(data_->mutable_cpu_data()));
    }
    break;
  default:
    LOG(FATAL) << "Unknown caffe mode.";
  }
}

上面的这个函数是复制blob数据的函数,由source复制到本类的Blob中,copy_diff表示赋值diff数据,reshape表示是否允许改变Blob的形状。在函数中,首先判断source的元素中与本类Blob的元素数是否相同,并判断source的形状与本类的形状是否相同,两者之一不同,则判读是否允许改变Blob的形状,如果允许,则按照source改变本类Blob的形状。

        接下来通过一个switch语句判断当前是什么模式,如果是GPU模式,则通过caffe_copy函数复制data或者diff,目标地址为data_->mutable_gpu_data()或diff_->mutable_gpu_data()。如果模式是CPU模式,则复制的目标地址为data_->mutable_cpu_data()或diff_->mutable_cpu_data()。

template <typename Dtype>
void Blob<Dtype>::FromProto(const BlobProto& proto, bool reshape) {
  if (reshape) {
    vector<int> shape;
    if (proto.has_num() || proto.has_channels() ||
        proto.has_height() || proto.has_width()) {
      // Using deprecated 4D Blob dimensions --
      // shape is (num, channels, height, width).
      shape.resize(4);
      shape[0] = proto.num();
      shape[1] = proto.channels();
      shape[2] = proto.height();
      shape[3] = proto.width();
    } else {
      shape.resize(proto.shape().dim_size());
      for (int i = 0; i < proto.shape().dim_size(); ++i) {
        shape[i] = proto.shape().dim(i);
      }
    }
    Reshape(shape);
  } else {
    CHECK(ShapeEquals(proto)) << "shape mismatch (reshape not set)";
  }
  // copy data
  Dtype* data_vec = mutable_cpu_data();
  if (proto.double_data_size() > 0) {
    CHECK_EQ(count_, proto.double_data_size());
    for (int i = 0; i < count_; ++i) {
      data_vec[i] = proto.double_data(i);
    }
  } else {
    CHECK_EQ(count_, proto.data_size());
    for (int i = 0; i < count_; ++i) {
      data_vec[i] = proto.data(i);
    }
  }
  if (proto.double_diff_size() > 0) {
    CHECK_EQ(count_, proto.double_diff_size());
    Dtype* diff_vec = mutable_cpu_diff();
    for (int i = 0; i < count_; ++i) {
      diff_vec[i] = proto.double_diff(i);
    }
  } else if (proto.diff_size() > 0) {
    CHECK_EQ(count_, proto.diff_size());
    Dtype* diff_vec = mutable_cpu_diff();
    for (int i = 0; i < count_; ++i) {
      diff_vec[i] = proto.diff(i);
    }
  }
}

上面函数的作用是复制BlobProto数据结构中的数据到本类的BLob中。在函数中,第一步是确认本类BLob的形状,如果运行改变形状,则根据proto来改变Blob的形状,如果不允许改变形状,则检测本类Blob与proto形状是否相同,如果不同则直接退出。

        接下来就是数据复制的过程,分别复制data和diff,并区分数据类型为double还是 float类型,并分别采用相应的方法复制到本类的Blob的内存空间中。

template <>
void Blob<float>::ToProto(BlobProto* proto, bool write_diff) const {
  proto->clear_shape();
  for (int i = 0; i < shape_.size(); ++i) {
    proto->mutable_shape()->add_dim(shape_[i]);
  }
  proto->clear_data();
  proto->clear_diff();
  const float* data_vec = cpu_data();
  for (int i = 0; i < count_; ++i) {
    proto->add_data(data_vec[i]);
  }
  if (write_diff) {
    const float* diff_vec = cpu_diff();
    for (int i = 0; i < count_; ++i) {
      proto->add_diff(diff_vec[i]);
    }
  }
}

这个函数的作用是将本类的Blob数据写入到BlobProto数据结构proto中。在函数中,显示将形状信息写入到proto中,然后清除proto中的数据,并将data元素写入到proto中。最后根据函数形参write_diff是否为true来复制diff元素。

INSTANTIATE_CLASS(Blob);
template class Blob<int>;
template class Blob<unsigned int>;

}  // namespace caffe

这几行是blob.cpp的结尾,作用是实例化Blob模板类。至此我们完成了blob.cpp的介绍。

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐