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 added testdata/dnn/onnx/data/input_reduce_max_axis_0.npy
Binary file not shown.
Binary file added testdata/dnn/onnx/data/input_reduce_max_axis_1.npy
Binary file not shown.
Binary file added testdata/dnn/onnx/data/output_reduce_max_axis_0.npy
Binary file not shown.
Binary file added testdata/dnn/onnx/data/output_reduce_max_axis_1.npy
Binary file not shown.
22 changes: 20 additions & 2 deletions testdata/dnn/onnx/generate_onnx_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -944,15 +944,33 @@ def forward(self, x):
model = Power(2)
save_data_and_model("pow2", x, model)

class ReduceMax(nn.Module):
class ReduceMaxGlobal(nn.Module):
def forward(self, x):
out = torch.max(x)
return torch.unsqueeze(out, 0)

x = Variable(torch.randn(1, 3, 2, 2))
model = ReduceMax()
model = ReduceMaxGlobal()
save_data_and_model("reduce_max", x, model)

class ReduceMax(nn.Module):
def __init__(self, axes):
super(ReduceMax, self).__init__()
self.axes = axes

def forward(self, x):
# torch.return_types.max(values, indices)
out = torch.max(x, dim=self.axes, keepdim=False)[0]
return out

x = Variable(torch.randn(1, 3, 2, 2))

model = ReduceMax(axes=0)
save_data_and_model("reduce_max_axis_0", x, model)

model = ReduceMax(axes=1)
save_data_and_model("reduce_max_axis_1", x, model)

class ResizeConv(nn.Module):
def __init__(
self,
Expand Down
Binary file added testdata/dnn/onnx/models/reduce_max_axis_0.onnx
Binary file not shown.
Binary file added testdata/dnn/onnx/models/reduce_max_axis_1.onnx
Binary file not shown.