We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9355217 commit 67b3ddbCopy full SHA for 67b3ddb
src/libtorchaudio/accessor.h
@@ -9,6 +9,7 @@ using torch::stable::Tensor;
9
template<unsigned int k, typename T, bool IsConst = true>
10
class Accessor {
11
int64_t strides[k];
12
+ int64_t sizes[k];
13
T *data;
14
15
public:
@@ -19,6 +20,7 @@ class Accessor {
19
20
data = static_cast<T*>(raw_ptr);
21
for (unsigned int i = 0; i < k; i++) {
22
strides[i] = tensor.stride(i);
23
+ sizes[i] = tensor.size(i);
24
}
25
26
@@ -33,6 +35,10 @@ class Accessor {
33
35
return data[ix];
34
36
37
38
+ int64_t size(int dim) {
39
+ return sizes[dim];
40
+ }
41
+
42
template<bool C = IsConst>
43
typename std::enable_if<!C, void>::type set_index(T value, ...) {
44
va_list args;
0 commit comments