diff --git a/paddle/framework/tensor.h b/paddle/framework/tensor.h index 657d3e6628b9aa68bd10bbfc1557305ce6f41c83..9d05b87408043332e40953f50e558c75e00870e4 100644 --- a/paddle/framework/tensor.h +++ b/paddle/framework/tensor.h @@ -76,7 +76,7 @@ class Tensor { inline T* mutable_data(DDim dims, platform::Place place); /*! Size of a single element in data() */ - inline size_t element_size() { return holder_->element_size(); } + inline size_t element_size() const { return holder_->element_size(); } /*! Return the dimensions of the memory block. */ inline const DDim& dims() const; diff --git a/paddle/framework/tensor_test.cc b/paddle/framework/tensor_test.cc index da0a4d636398721e6fa87ad0cf5074cbfe110a05..7747cb34fc13c671fba5b71faa25099a5487db1d 100644 --- a/paddle/framework/tensor_test.cc +++ b/paddle/framework/tensor_test.cc @@ -36,7 +36,7 @@ TEST(Tensor, DataAssert) { } catch (paddle::platform::EnforceNotMet err) { caught = true; std::string msg = - "holder_ should not be null\nTenosr holds no memory. Call " + "holder_ should not be null\nTensor holds no memory. Call " "Tensor::mutable_data first."; const char* what = err.what(); for (size_t i = 0; i < msg.length(); ++i) { @@ -114,7 +114,7 @@ TEST(Tensor, ShareDataWith) { } catch (paddle::platform::EnforceNotMet err) { caught = true; std::string msg = - "holder_ should not be null\nTenosr holds no memory. Call " + "holder_ should not be null\nTensor holds no memory. Call " "Tensor::mutable_data first."; const char* what = err.what(); for (size_t i = 0; i < msg.length(); ++i) {