File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -13,10 +13,9 @@ LlgaTensorImpl::LlgaTensorImpl(
13
13
c10::DispatchKeySet(DispatchKey::MkldnnCPU),
14
14
data_type),
15
15
desc_(desc) {
16
- for (int64_t i = 0 ; i < desc.sizes ().size (); i++) {
17
- c10::TensorImpl::set_size (i, desc.sizes ()[i]);
18
- }
19
- }
16
+ sizes_and_strides_.set_sizes (desc.sizes ());
17
+ refresh_numel ();
18
+ }
20
19
21
20
// The following are publically exposed as methods of Tensor
22
21
IntArrayRef LlgaTensorImpl::strides () const {
@@ -35,6 +34,11 @@ int64_t LlgaTensorImpl::storage_offset() const {
35
34
TORCH_CHECK (false , " Cannot access the storage_offset() of LlgaTensorImpl" );
36
35
}
37
36
37
+ // The following are some internal inherited methods that we do not support.
38
+ // They should never get called.
39
+ void LlgaTensorImpl::set_size (int64_t dim, int64_t new_size) {
40
+ TORCH_INTERNAL_ASSERT (false , " Cannot set_size for LlgaTensorImpl" );
41
+ }
38
42
void LlgaTensorImpl::set_stride (int64_t dim, int64_t new_stride) {
39
43
TORCH_INTERNAL_ASSERT (false , " Cannot set_stride for LlgaTensorImpl" );
40
44
}
Original file line number Diff line number Diff line change @@ -197,6 +197,7 @@ struct TORCH_API LlgaTensorImpl : public c10::TensorImpl {
197
197
at::MemoryFormat::Contiguous) const override ;
198
198
IntArrayRef strides () const override ;
199
199
int64_t stride (int64_t d) const override ;
200
+ void set_size (int64_t dim, int64_t new_size) override ;
200
201
void set_stride (int64_t dim, int64_t new_stride) override ;
201
202
void set_storage_offset (int64_t storage_offset) override ;
202
203
bool has_storage () const override ;
You can’t perform that action at this time.
0 commit comments