Skip to content

Commit

Permalink
add reshape DML scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Baunsgaard committed Jan 21, 2025
1 parent a84d7a9 commit 75020d9
Show file tree
Hide file tree
Showing 3 changed files with 171 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#-------------------------------------------------------------
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
#-------------------------------------------------------------


cols=$cols
rows=$rows
reCols=$reCols
reRows=$reRows
sparsity=$sparsity
min=$min
max=$max

X = rand(cols=cols, rows=rows, min=min, max=max, sparsity=$sparsity)
X = ceil(X)

X_C = compress(X)

while(FALSE){} # force a break

X_r = matrix(X, rows = reRows, cols=reCols)
X_Cr = matrix(X_C, rows = reRows, cols=reCols)

while(FALSE){} # force a second break

same = X == X_C
same2 = X_r == X_Cr

print(sum(same))
print(sum(same2))

nCells = cols * rows

if(nCells == sum(same) & sum(same) == sum(same2))
print("Success, the output contained the same values after reshaping")
else
print("Failed, the output did not contain the same values after reshaping")
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#-------------------------------------------------------------
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
#-------------------------------------------------------------


cols=$cols
rows=$rows
reCols=$reCols
reRows=$reRows
sparsity=$sparsity
min=$min
max=$max

X = rand(cols=cols, rows=rows, min=min, max=max, sparsity=$sparsity)
X = sqrt(X)

X = ceil(X)

X_C = compress(X)


while(FALSE){} # force a break

X_r = matrix(X, rows = reRows, cols=reCols)
X_Cr = matrix(X_C, rows = reRows, cols=reCols)

while(FALSE){} # force a second break

same = X == X_C
same2 = X_r == X_Cr

print(sum(same))
print(sum(same2))

nCells = cols * rows

if(nCells == sum(same) & sum(same) == sum(same2))
print("Success, the output contained the same values after reshaping")
else
print("Failed, the output did not contain the same values after reshaping")
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#-------------------------------------------------------------
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
#-------------------------------------------------------------


cols=$cols
rows=$rows
reCols=$reCols
reRows=$reRows
sparsity=$sparsity
min=$min
max=$max

X = rand(cols=cols, rows=rows, min=min, max=max, sparsity=$sparsity)
X = sqrt(X)

X = ceil(X)


X_C = compress(X)

X = X + 1
X_C = X_C + 1

while(FALSE){} # force a break

X_r = matrix(X, rows = reRows, cols=reCols)
X_Cr = matrix(X_C, rows = reRows, cols=reCols)

while(FALSE){} # force a second break

same = X == X_C
same2 = X_r == X_Cr

print(sum(same))
print(sum(same2))

nCells = cols * rows

if(nCells == sum(same) & sum(same) == sum(same2))
print("Success, the output contained the same values after reshaping")
else
print("Failed, the output did not contain the same values after reshaping")

0 comments on commit 75020d9

Please sign in to comment.