Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
composable_kernel
Commits
e1832bcb
"src/libtorchaudio/rnnt/options.h" did not exist on "2d99fee29efac7fcd09f679ed6f7f3379eaac512"
Commit
e1832bcb
authored
Nov 27, 2023
by
Bartlomiej Kocot
Browse files
Fix for getLength
parent
81b79a77
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
19 deletions
+17
-19
example/64_tensor_transforms/tensor_transform_using_wrapper.cpp
...e/64_tensor_transforms/tensor_transform_using_wrapper.cpp
+5
-7
example/64_tensor_transforms/tensor_transform_wrapper.hpp
example/64_tensor_transforms/tensor_transform_wrapper.hpp
+12
-12
No files found.
example/64_tensor_transforms/tensor_transform_using_wrapper.cpp
View file @
e1832bcb
...
...
@@ -65,9 +65,9 @@ int main()
{
// Layout traverse in row-major
std
::
cout
<<
"Note: Layout traverse in column-major"
<<
std
::
endl
;
// Basic descriptor 0, 1, 2, ... 30, 31 (
run
time descriptor)
// Basic descriptor 0, 1, 2, ... 30, 31 (
compile-
time descriptor)
// (dims:4,8 strides:1,4)
const
auto
shape_4x8
=
ck
::
make_tuple
(
4
,
8
);
const
auto
shape_4x8
=
ck
::
make_tuple
(
ck
::
Number
<
4
>
{},
ck
::
Number
<
8
>
{}
);
const
auto
layout_4x8_s1x4
=
ck
::
tensor_transform_wrapper
::
make_layout
(
shape_4x8
);
std
::
cout
<<
"dims:4,8 strides:1,4"
<<
std
::
endl
;
Print2d
(
layout_4x8_s1x4
);
...
...
@@ -75,12 +75,10 @@ int main()
constexpr
ck
::
index_t
offset_0x0
=
layout_4x8_s1x4
.
template
operator
()
<
Cord0x0Type
>();
std
::
cout
<<
"Constexpr calculated [0, 0] offset:"
<<
offset_0x0
<<
std
::
endl
;
// Basic descriptor 0, 1, 8, 9, 16, 17, ... 30, 31 (
compile-
time descriptor)
// Basic descriptor 0, 1, 8, 9, 16, 17, ... 30, 31 (
run
time descriptor)
// dims:4,(2,4) strides:2,(1,8)
const
auto
shape_4x2x4
=
ck
::
make_tuple
(
ck
::
Number
<
4
>
{},
ck
::
make_tuple
(
ck
::
Number
<
2
>
{},
ck
::
Number
<
4
>
{}));
const
auto
strides_s2x1x8
=
ck
::
make_tuple
(
ck
::
Number
<
2
>
{},
ck
::
make_tuple
(
ck
::
Number
<
1
>
{},
ck
::
Number
<
8
>
{}));
const
auto
shape_4x2x4
=
ck
::
make_tuple
(
4
,
ck
::
make_tuple
(
2
,
4
));
const
auto
strides_s2x1x8
=
ck
::
make_tuple
(
2
,
ck
::
make_tuple
(
1
,
8
));
const
auto
layout_4x2x4_s2x1x8
=
ck
::
tensor_transform_wrapper
::
make_layout
(
shape_4x2x4
,
strides_s2x1x8
);
...
...
example/64_tensor_transforms/tensor_transform_wrapper.hpp
View file @
e1832bcb
...
...
@@ -317,9 +317,9 @@ struct Layout
const
auto
elem
=
shape_
.
At
(
Number
<
IDim
>
{});
if
constexpr
(
is_detected
<
is_tuple
,
tuple_element_t
<
IDim
,
Shape
>>::
value
)
{
using
U
nrolled
E
lement
=
decltype
(
UnrollNestedTuple
(
elem
)
)
;
return
TupleReduce
<
I0
.
value
,
U
nrolled
E
lement
::
Size
()
>
(
[](
auto
x
,
auto
y
)
{
return
x
*
y
;
},
U
nrolled
E
lement
{}
);
const
auto
u
nrolled
_e
lement
=
UnrollNestedTuple
(
elem
);
return
TupleReduce
<
I0
.
value
,
u
nrolled
_e
lement
.
Size
()
>
(
[](
auto
x
,
auto
y
)
{
return
x
*
y
;
},
u
nrolled
_e
lement
);
}
else
{
...
...
@@ -339,9 +339,9 @@ struct Layout
const
auto
elem
=
shape_
.
At
(
Number
<
IDim
>
{});
if
constexpr
(
is_detected
<
is_tuple
,
tuple_element_t
<
IDim
,
Shape
>>::
value
)
{
using
U
nrolled
E
lement
=
decltype
(
UnrollNestedTuple
(
elem
)
)
;
return
TupleReduce
<
I0
.
value
,
U
nrolled
E
lement
::
Size
()
>
(
[](
auto
x
,
auto
y
)
{
return
x
*
y
;
},
U
nrolled
E
lement
{}
);
const
auto
u
nrolled
_e
lement
=
UnrollNestedTuple
(
elem
);
return
TupleReduce
<
I0
.
value
,
u
nrolled
_e
lement
.
Size
()
>
(
[](
auto
x
,
auto
y
)
{
return
x
*
y
;
},
u
nrolled
_e
lement
);
}
else
{
...
...
@@ -356,9 +356,9 @@ struct Layout
*/
__host__
__device__
constexpr
index_t
GetLength
()
const
{
using
U
nrolled
S
hape
=
decltype
(
UnrollNestedTuple
(
shape_
)
)
;
return
TupleReduce
<
I0
.
value
,
U
nrolled
S
hape
::
Size
()
>
([](
auto
x
,
auto
y
)
{
return
x
*
y
;
},
U
nrolled
S
hape
{}
);
const
auto
u
nrolled
_s
hape
=
UnrollNestedTuple
(
shape_
);
return
TupleReduce
<
I0
.
value
,
u
nrolled
_s
hape
.
Size
()
>
([](
auto
x
,
auto
y
)
{
return
x
*
y
;
},
u
nrolled
_s
hape
);
}
/**
...
...
@@ -368,9 +368,9 @@ struct Layout
*/
__host__
__device__
constexpr
index_t
GetLength
()
{
using
U
nrolled
S
hape
=
decltype
(
UnrollNestedTuple
(
shape_
)
)
;
return
TupleReduce
<
I0
.
value
,
U
nrolled
S
hape
::
Size
()
>
([](
auto
x
,
auto
y
)
{
return
x
*
y
;
},
U
nrolled
S
hape
{}
);
const
auto
u
nrolled
_s
hape
=
UnrollNestedTuple
(
shape_
);
return
TupleReduce
<
I0
.
value
,
u
nrolled
_s
hape
.
Size
()
>
([](
auto
x
,
auto
y
)
{
return
x
*
y
;
},
u
nrolled
_s
hape
);
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment