Skip to content

Commit 7ddcb91

Browse files
houseroadezyang
authored andcommitted
Add more ONNX symbolics
1 parent 710f6d6 commit 7ddcb91

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

torch/onnx/symbolic.py

+22
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ def permute(g, self, dims):
206206

207207

208208
def view(g, self, size):
209+
if self.type().sizes()[0] == size[0]:
210+
return g.op("Flatten", self, axis_i=1)
209211
return g.op("Reshape", self, shape_i=size)
210212

211213

@@ -327,3 +329,23 @@ def abs(g, self):
327329

328330
def pow(g, self, exponent):
329331
return g.op("Pow", self, exponent)
332+
333+
334+
def clamp(g, self, min, max):
335+
return g.op("Clip", self, min_f=min, max_f=max)
336+
337+
338+
def max(g, self, other):
339+
return g.op("Max", self, other)
340+
341+
342+
def min(g, self, other):
343+
return g.op("Min", self, other)
344+
345+
346+
def eq(g, self, other):
347+
return g.op("Equal", self, other)
348+
349+
350+
def exp(g, self):
351+
return g.op("Exp", self)

0 commit comments

Comments
 (0)