File tree Expand file tree Collapse file tree 3 files changed +11
-11
lines changed Expand file tree Collapse file tree 3 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -265,22 +265,14 @@ const paddle::platform::Place& DenseTensor::place() const {
265265      storage_,
266266      paddle::platform::errors::PreconditionNotMet (
267267          " Tensor not initialized yet when Tensor::place() is called." 
268-   PADDLE_ENFORCE_NOT_NULL (
269-       storage_->data_shared (),
270-       paddle::platform::errors::PreconditionNotMet (
271-           " Tensor not initialized yet when Tensor::place() is called." 
272-   return  storage_->data_shared ()->place ();
268+   return  storage_->place ();
273269}
274270
275271paddle::framework::proto::VarType::Type DenseTensor::type () const  {
276272  PADDLE_ENFORCE_NOT_NULL (
277273      storage_,
278274      paddle::platform::errors::PreconditionNotMet (
279275          " Tensor not initialized yet when Tensor::type() is called." 
280-   PADDLE_ENFORCE_NOT_NULL (
281-       storage_->data_shared (),
282-       paddle::platform::errors::PreconditionNotMet (
283-           " Tensor not initialized yet when Tensor::type() is called." 
284276  return  TransToProtoVarType (meta_.dtype );
285277}
286278
Original file line number Diff line number Diff line change @@ -349,6 +349,15 @@ class DenseTensor : public TensorBase,
349349
350350  dnnl::memory::format_tag format_ = dnnl::memory::format_tag::undef;
351351#endif 
352+ 
353+   /*  ------------------------------ */ 
354+   /*    From framework::LoDTensor    */ 
355+   /*  ------------------------------ */ 
356+   /*  The following members & interfaces were copied from framework::Tensor,
357+      so as to facilitate the unification of different Tensors 
358+ 
359+      Will be adjusted/removed/moved in the near future 
360+    */  
352361};
353362
354363}  //  namespace pten
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ TEST(dense_tensor, meta) {
6565
6666TEST (dense_tensor, def_ctor) {
6767  DenseTensor tensor_0;
68-   CHECK (! tensor_0.valid ());
68+   CHECK (tensor_0.valid ());
6969}
7070
7171TEST (dense_tensor, ctor) {
@@ -97,7 +97,6 @@ TEST(dense_tensor, ctor) {
9797  check_dense_tensor (tensor_0, meta);
9898
9999  DenseTensor tensor_2 (make_intrusive<TensorStorage>(alloc), meta);
100-   CHECK (tensor_2.data <int8_t >() == nullptr );
101100  CHECK_NOTNULL (tensor_2.mutable_data <int8_t >());
102101  check_dense_tensor (tensor_2, meta);
103102}
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments