Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
chaitanyakamarapu committed Jan 21, 2025
1 parent 6d0692b commit e0bdcb8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
16 changes: 6 additions & 10 deletions src/Dialect/ONNX/ElementsAttr/ElementsAttrBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,34 +510,30 @@ result = input
for i in enumerate(sequence_lens)
list<pair<destpos, sourcepos> dstSrcPositionPairs
list<list<position>> timeAxisPosList1 with size input[0] dimsize for
batch_index=1 ( it will be input[1] dimsize for batch_index=0)
for idx on input
batch_axis=1 ( it will be input[1] dimsize for batch_axis=0) for idx on input
begin
if( batch_index==1 and idx[1] == i and idx[0] < sequence_lens[i] )
if( batch_axis==1 and idx[1] == i and idx[0] < sequence_lens[i] )
dstSrcPositionPairs.push(idx.pos,0) // the destination pos which will be
replaced is added, the source postion form where it will be replaced
will be computed later
timeAxisPosList1[idx[0]].push(idx.pos) // Add this pos to
the correspoding timeAxis list.
else if ( batch_index==0 and idx[0] == i and idx[1] < sequence_lens[i] )
else if ( batch_axis==0 and idx[0] == i and idx[1] < sequence_lens[i] )
dstSrcPositionPairs.push(idx.pos,0)
timeAxisPosList1[idx[1]].push(idx.pos)
end
list<list<position>> timeAxisPosList2 with size input[0] dimsize for
batch_index=1 ( it will be input[1] dimsize for batch_index=0)
for idx on input
batch_axis=1 ( it will be input[1] dimsize for batch_axis=0) for idx on input
begin
if( batch_index==1 and idx[1] == i and idx[0] < sequence_lens[i] )
if( batch_axis==1 and idx[1] == i and idx[0] < sequence_lens[i] )
timeAxisPosList2[idx[0]].push(idx.pos)
positionWithinList = timeAxisPosList2[idx[0]].size()
listAsPerRevSeq = timeAxisPosList1.size()-idx[0]-1
sourcePosition = timeAxisPosList1[listAsPerRevSeq][positionWithinList]
update the pair in dstSrcPositionPairs for idx.pos with sourcePosition
else if( batch_index==0 and idx[0] == i and idx[1] < sequence_lens[i] )
else if( batch_axis==0 and idx[0] == i and idx[1] < sequence_lens[i] )
timeAxisPosList2[idx[1]].push(idx.pos)
positionWithinList = timeAxisPosList2[idx[1]].size()
Expand Down
2 changes: 0 additions & 2 deletions test/mlir/onnx/onnx_constprop.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -2611,7 +2611,6 @@ func.func @test_reverse_seq_sameseq_values_int() -> tensor<3x3x1x2xi32> {

// -----
//---------------------------------------------//
// reverseSequence tests
// CHECK-LABEL: @test_reverse_seq_batch_axis_1() -> tensor<3x3x1x2xf32>
func.func @test_reverse_seq_batch_axis_1() -> tensor<3x3x1x2xf32> {
%0 = onnx.Constant dense<[3,2,1]> : tensor<3xi64>
Expand All @@ -2638,7 +2637,6 @@ func.func @test_reverse_seq_sameseq_values_batch_axis_1() -> tensor<3x3x1x2xf32>

// -----
//---------------------------------------------//
// reverseSequence tests
// CHECK-LABEL: @test_reverse_seq_int_batch_axis_1() -> tensor<3x3x1x2xi32>
func.func @test_reverse_seq_int_batch_axis_1() -> tensor<3x3x1x2xi32> {
%0 = onnx.Constant dense<[3,2,1]> : tensor<3xi64>
Expand Down

0 comments on commit e0bdcb8

Please sign in to comment.