File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -25,8 +25,10 @@ void FileReader::ReadNext(std::vector<LoDTensor> *out) {
25
25
if (out->empty ()) {
26
26
return ;
27
27
}
28
+
29
+ PADDLE_ENFORCE_EQ (out->size (), dims_.size ());
28
30
for (size_t i = 0 ; i < dims_.size (); ++i) {
29
- auto &actual = out-> at (i) .dims ();
31
+ auto &actual = (*out)[i] .dims ();
30
32
auto &expect = dims_[i];
31
33
32
34
PADDLE_ENFORCE_EQ (actual.size (), expect.size ());
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ template <typename T>
39
39
inline const T* Tensor::data () const {
40
40
check_memory_size ();
41
41
PADDLE_ENFORCE (std::is_same<T, void >::value ||
42
- holder_->type (). hash_code () == typeid (T). hash_code ( ),
42
+ holder_->type () == std::type_index ( typeid (T)),
43
43
" Tensor holds the wrong type, it holds %s" ,
44
44
this ->holder_ ->type ().name ());
45
45
@@ -53,7 +53,7 @@ template <typename T>
53
53
inline T* Tensor::data () {
54
54
check_memory_size ();
55
55
PADDLE_ENFORCE (std::is_same<T, void >::value ||
56
- holder_->type (). hash_code () == typeid (T). hash_code ( ),
56
+ holder_->type () == std::type_index ( typeid (T)),
57
57
" Tensor holds the wrong type, it holds %s" ,
58
58
this ->holder_ ->type ().name ());
59
59
return reinterpret_cast <T*>(reinterpret_cast <uintptr_t >(holder_->ptr ()) +
You can’t perform that action at this time.
0 commit comments