MCPcopy Create free account
hub / github.com/apache/singa / get_value

Method get_value

src/core/tensor/tensor.cc:868–875  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

866
867template <typename SType>
868void Tensor::get_value(SType *value, const size_t num) const {
869 CHECK(device_ == defaultDevice);
870 Tensor t(shape_, device_, data_type_);
871 // transform function arrange data in memory considering stride
872 singa::Transform(*this, &t);
873 auto ptr = static_cast<const SType *>(t.block()->data());
874 for (size_t i = 0; i < num; i++) value[i] = ptr[i];
875}
876template void Tensor::get_value<float>(float *value, const size_t num) const;
877template void Tensor::get_value<half_float::half>(half_float::half *value,
878 const size_t num) const;

Callers 1

TEST_FFunction · 0.80

Calls 3

TransformFunction · 0.85
dataMethod · 0.45
blockMethod · 0.45

Tested by 1

TEST_FFunction · 0.64