mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/44735 Reviewed By: mruberry Differential Revision: D23731306 Pulled By: ezyang fbshipit-source-id: 0ba009a99e475ddbe22981be8ac636f8a1c8b02f
17 lines
389 B
Python
17 lines
389 B
Python
import torch
|
|
from utils import NUM_LOOP_ITERS
|
|
|
|
def add_tensors_loop(x, y):
|
|
z = torch.add(x, y)
|
|
for i in range(NUM_LOOP_ITERS):
|
|
z = torch.add(z, x)
|
|
return z
|
|
|
|
class SimpleAddModule(torch.nn.Module):
|
|
def __init__(self, add_op):
|
|
super(SimpleAddModule, self).__init__()
|
|
self.add_op = add_op
|
|
|
|
def forward(self, x, y):
|
|
return self.add_op(x, y)
|