We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 73e9467 commit 90e78bcCopy full SHA for 90e78bc
torch2c/emitters.py
@@ -266,6 +266,28 @@ def free_tpl(self):
266
register(Add, torch.autograd._functions.basic_ops.Add)
267
268
269
+class AddConstant(Emitter):
270
+
271
+ def __init__(self, obj, prevfns):
272
+ Emitter.__init__(self, obj, prevfns)
273
+ print(obj.constant)
274
+ self.def_vars({'input': id(prevfns[0])})
275
+ self.infer_type_var = 'input'
276
+ self.def_args({'constant': obj.constant})
277
278
+ def call_tpl(self):
279
+ return '''
280
+ TH${T}Tensor *$id = TH${T}Tensor_new();
281
+ TH${T}Tensor_add($id,$input,$constant);
282
+ '''
283
284
+ def free_tpl(self):
285
286
+ TH${T}Tensor_free($id);
287
288
289
+register(AddConstant, torch.autograd._functions.basic_ops.AddConstant)
290
291
292
293
class Softmax(Emitter):
0 commit comments