Line data Source code
1 : /**
2 : * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3 : * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4 : * CANN Open Software License Agreement Version 2.0 (the "License").
5 : * Please refer to the License for details. You may not use this file except in compliance with the License.
6 : * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7 : * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8 : * See LICENSE in the root of the software repository for the full text of the License.
9 : */
10 : #ifndef DUMP_TENSOR_H
11 : #define DUMP_TENSOR_H
12 :
13 : #include "adump_pub.h"
14 :
15 : namespace Adx {
16 : class DumpTensor {
17 : public:
18 : template<typename TensorInfoT>
19 177 : explicit DumpTensor(const TensorInfoT &tensorInfo)
20 177 : : dataType_(tensorInfo.dataType),
21 177 : format_(tensorInfo.format),
22 177 : shape_(tensorInfo.shape),
23 177 : originShape_(tensorInfo.originShape),
24 177 : size_(tensorInfo.tensorSize),
25 177 : address_(tensorInfo.tensorAddr),
26 177 : addrType_(tensorInfo.addrType),
27 177 : argsOffSet_(tensorInfo.argsOffSet) {}
28 :
29 312 : ~DumpTensor() = default;
30 : int32_t GetDataType() const;
31 : int32_t GetFormat() const;
32 : std::vector<int64_t> GetShape() const;
33 : std::vector<int64_t> GetOriginShape() const;
34 : size_t GetSize() const;
35 : const void *GetAddress() const;
36 : void SetAddress(const void *address);
37 : AddressType GetAddressType() const;
38 : uint32_t GetArgsOffSet() const;
39 :
40 : private:
41 : int32_t dataType_;
42 : int32_t format_;
43 : std::vector<int64_t> shape_;
44 : std::vector<int64_t> originShape_;
45 : size_t size_;
46 : const void *address_;
47 : AddressType addrType_;
48 : uint32_t argsOffSet_;
49 : };
50 : } // namespace Adx
51 : #endif // DUMP_TENSOR_H
|