8000 Support C-Style `div` operation · Issue #328 · NVIDIA/Fuser · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Support C-Style div operation #328
Closed
@kevinstephano

Description

@kevinstephano

Supplying two integer inputs results in a type promotion to float which does not match C-Style div.

Repro:

import torch
from nvfuser import FusionDefinition, DataType

inputs = [
    torch.randint(255, (4, 4), device='cuda'),
    torch.randint(255, (4, 4), device='cuda'),
]

def fusion(fd: FusionDefinition):
    t0 = fd.from_pytorch(inputs[0])
    t1 = fd.from_pytorch(inputs[1])
    t2 = fd.ops.div(t0, t1)
    fd.add_output(t2)

with FusionDefinition() as fd:
    fusion(fd)

out = fd.execute(inputs)
print(inputs[0])
print(inputs[1])
print(out)

Output:

tensor([[ 68, 177, 192, 186],
        [186,  42, 199, 181],
        [ 56, 103,  79,  31],
        [199,  69,  54, 241]], device='cuda:0')
tensor([[ 98, 149,  45, 103],
        [ 90,  86,  58, 195],
        [ 77, 211, 142,  85],
        [ 11, 225, 232, 241]], device='cuda:0')
[tensor([[ 0.6939,  1.1879,  4.2667,  1.8058],
        [ 2.0667,  0.4884,  3.4310,  0.9282],
        [ 0.7273,  0.4882,  0.5563,  0.3647],
        [18.0909,  0.3067,  0.2328,  1.0000]], device='cuda:0')]

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0