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 193 : explicit DumpTensor(const TensorInfoT& tensorInfo)
20 193 : : dataType_(tensorInfo.dataType),
21 193 : format_(tensorInfo.format),
22 193 : shape_(tensorInfo.shape),
23 193 : originShape_(tensorInfo.originShape),
24 193 : size_(tensorInfo.tensorSize),
25 193 : address_(tensorInfo.tensorAddr),
26 193 : addrType_(tensorInfo.addrType),
27 193 : argsOffSet_(tensorInfo.argsOffSet)
28 193 : {}
29 :
30 328 : ~DumpTensor() = default;
31 : int32_t GetDataType() const;
32 : int32_t GetFormat() const;
33 : std::vector<int64_t> GetShape() const;
34 : std::vector<int64_t> GetOriginShape() const;
35 : size_t GetSize() const;
36 : const void* GetAddress() const;
37 : void SetAddress(const void* address);
38 : AddressType GetAddressType() const;
39 : uint32_t GetArgsOffSet() const;
40 :
41 : private:
42 : int32_t dataType_;
43 : int32_t format_;
44 : std::vector<int64_t> shape_;
45 : std::vector<int64_t> originShape_;
46 : size_t size_;
47 : const void* address_;
48 : AddressType addrType_;
49 : uint32_t argsOffSet_;
50 : };
51 : } // namespace Adx
52 : #endif // DUMP_TENSOR_H
|