Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified testdata/dnn/onnx/data/input_argmax.npy
Binary file not shown.
Binary file modified testdata/dnn/onnx/data/input_argmin.npy
Binary file not shown.
Binary file modified testdata/dnn/onnx/data/output_argmax.npy
Binary file not shown.
Binary file modified testdata/dnn/onnx/data/output_argmin.npy
Binary file not shown.
4 changes: 2 additions & 2 deletions testdata/dnn/onnx/generate_onnx_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2665,7 +2665,7 @@ def __init__(self, *args, **kwargs):
super(ArgMax, self).__init__()

def forward(self, x):
return torch.argmax(x, dim=2, keepdims=False).to(torch.float32)
return torch.argmax(x, dim=2, keepdims=False)

model = ArgMax()
input_ = Variable(torch.randn(2, 3, 4, 5, dtype=torch.float32))
Expand All @@ -2676,7 +2676,7 @@ def __init__(self, *args, **kwargs):
super(ArgMin, self).__init__()

def forward(self, x):
return torch.argmin(x, dim=-1, keepdims=True).to(torch.float32)
return torch.argmin(x, dim=-1, keepdims=True)

model = ArgMin()
input_ = Variable(torch.randn(2, 3, 4, 5, dtype=torch.float32))
Expand Down
Binary file modified testdata/dnn/onnx/models/argmax.onnx
Binary file not shown.
Binary file modified testdata/dnn/onnx/models/argmin.onnx
Binary file not shown.
Binary file modified testdata/dnn/tensorflow/argmax_in.npy
Binary file not shown.
Binary file modified testdata/dnn/tensorflow/argmax_net.pb
Binary file not shown.
Binary file modified testdata/dnn/tensorflow/argmax_out.npy
Binary file not shown.
Binary file modified testdata/dnn/tensorflow/argmin_in.npy
Binary file not shown.
Binary file modified testdata/dnn/tensorflow/argmin_net.pb
Binary file not shown.
Binary file modified testdata/dnn/tensorflow/argmin_out.npy
Binary file not shown.
14 changes: 13 additions & 1 deletion testdata/dnn/tensorflow/generate_tf2_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def writeBlob(data, name, nchw = False):
# NDHWC->NCDHW
data = data.transpose(0, 4, 1, 2, 3)

data = np.ascontiguousarray(data.astype(np.float32))
data = np.ascontiguousarray(data)
np.save(name + '.npy', data)


Expand Down Expand Up @@ -148,6 +148,18 @@ def saveBroken(graph, name):
y = tf.compat.v1.nn.conv2d_backprop_input(input_sizes=tf.constant([1, 3, 4, 2]), filter=kernel, out_backprop=x, data_format = "NHWC", padding = [[0, 0], [2, 1], [2, 1], [0, 0]], strides = [1, 3, 2, 1])
model = tf.keras.Model(x, y)
save(model, 'conv2d_backprop_input_asymmetric_pads_nhwc', False, x=tf.TensorSpec(shape=(1, 2, 3, 3), dtype=tf.float32))
################################################################################
tf.keras.backend.set_image_data_format('channels_first')
x = tf.keras.layers.Input(batch_shape = (2, 3, 4), name='x')
y = tf.math.argmax(x, axis=-1)
model = tf.keras.Model(x, y)
save(model, 'argmax', True, x=tf.TensorSpec(shape=(2, 3, 4), dtype=tf.float32))
################################################################################
tf.keras.backend.set_image_data_format('channels_last')
x = tf.keras.layers.Input(batch_shape = (2, 3, 4), name='x')
y = tf.math.argmin(x, axis=1)
model = tf.keras.Model(x, y)
save(model, 'argmin', False, x=tf.TensorSpec(shape=(2, 3, 4), dtype=tf.float32))

# Uncomment to print the final graph.
# with tf.io.gfile.GFile('tf2_prelu_net.pb', 'rb') as f:
Expand Down
8 changes: 0 additions & 8 deletions testdata/dnn/tensorflow/generate_tf_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1070,14 +1070,6 @@ def pad_depth(x, desired_channels):
square = tf.square(inp)
save(inp, square, 'square')
################################################################################
inp = tf.placeholder(tf.float32, [2, 3, 4], 'input')
argmax = tf.argmax(inp, -1)
save(inp, argmax, 'argmax')
################################################################################
inp = tf.placeholder(tf.float32, [2, 3, 4], 'input')
argmin = tf.argmin(inp, 1)
save(inp, argmin, 'argmin')
################################################################################
# Generate graph and test data for Reshape permutations check
stride = 1
kernel_size = 3
Expand Down