mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Add device and key for lazy tensors (#61621)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/61621 Test Plan: CI Reviewed By: mruberry Differential Revision: D29912934 Pulled By: asuhan fbshipit-source-id: 493c32063a3e756d93cbf1d876563a35eaafb537
This commit is contained in:
committed by
Facebook GitHub Bot
parent
2945a73d90
commit
b176feec1e
@ -789,7 +789,7 @@ CPU: registered at {}:5 :: () -> () [ boxed unboxed ]
|
||||
class TestPythonDispatcher(TestCase):
|
||||
def test_basic(self):
|
||||
dispatcher = PythonDispatcher()
|
||||
dispatcher.register(["CPU", "XLA", "CompositeImplicitAutograd"])
|
||||
dispatcher.register(["CPU", "XLA", "Lazy", "CompositeImplicitAutograd"])
|
||||
self.assertExpectedInline(
|
||||
dispatcher.dispatchTable(),
|
||||
'''\
|
||||
@ -799,16 +799,18 @@ key kernel
|
||||
---------------------------
|
||||
CPU fn_CPU [kernel]
|
||||
XLA fn_XLA [kernel]
|
||||
Lazy fn_Lazy [kernel]
|
||||
QuantizedCPU fn_CompositeImplicitAutograd [math kernel]
|
||||
AutogradOther fn_CompositeImplicitAutograd [math kernel]
|
||||
AutogradCPU fallthrough [backend fallback]
|
||||
AutogradXLA fallthrough [backend fallback]
|
||||
AutogradLazy fallthrough [backend fallback]
|
||||
'''
|
||||
)
|
||||
|
||||
def test_math_autogradcpu(self):
|
||||
dispatcher = PythonDispatcher()
|
||||
dispatcher.register(["CPU", "XLA", "CompositeImplicitAutograd", "AutogradCPU"])
|
||||
dispatcher.register(["CPU", "XLA", "Lazy", "CompositeImplicitAutograd", "AutogradCPU"])
|
||||
self.assertExpectedInline(
|
||||
dispatcher.dispatchTable(),
|
||||
'''\
|
||||
@ -818,10 +820,12 @@ key kernel
|
||||
---------------------------
|
||||
CPU fn_CPU [kernel]
|
||||
XLA fn_XLA [kernel]
|
||||
Lazy fn_Lazy [kernel]
|
||||
QuantizedCPU fn_CompositeImplicitAutograd [math kernel]
|
||||
AutogradOther fn_CompositeImplicitAutograd [math kernel]
|
||||
AutogradCPU fn_AutogradCPU [kernel]
|
||||
AutogradXLA fallthrough [backend fallback]
|
||||
AutogradLazy fallthrough [backend fallback]
|
||||
'''
|
||||
)
|
||||
self.assertExpectedInline(
|
||||
@ -833,6 +837,7 @@ key kernel
|
||||
---------------------------
|
||||
CPU fn_CPU
|
||||
XLA fn_XLA
|
||||
Lazy fn_Lazy
|
||||
AutogradCPU fn_AutogradCPU
|
||||
CompositeImplicitAutograd[alias] fn_CompositeImplicitAutograd
|
||||
'''
|
||||
@ -840,7 +845,7 @@ CompositeImplicitAutograd[alias] fn_CompositeImplicitAutograd
|
||||
|
||||
def test_defaultbackend_autogradcpu(self):
|
||||
dispatcher = PythonDispatcher()
|
||||
dispatcher.register(["CPU", "XLA", "CompositeExplicitAutograd", "AutogradCPU"])
|
||||
dispatcher.register(["CPU", "XLA", "Lazy", "CompositeExplicitAutograd", "AutogradCPU"])
|
||||
self.assertExpectedInline(
|
||||
dispatcher.dispatchTable(),
|
||||
'''\
|
||||
@ -850,10 +855,12 @@ key kernel
|
||||
---------------------------
|
||||
CPU fn_CPU [kernel]
|
||||
XLA fn_XLA [kernel]
|
||||
Lazy fn_Lazy [kernel]
|
||||
QuantizedCPU fn_CompositeExplicitAutograd [default backend kernel]
|
||||
AutogradOther fallthrough [backend fallback]
|
||||
AutogradCPU fn_AutogradCPU [kernel]
|
||||
AutogradXLA fallthrough [backend fallback]
|
||||
AutogradLazy fallthrough [backend fallback]
|
||||
'''
|
||||
)
|
||||
|
||||
@ -866,6 +873,7 @@ key kernel
|
||||
---------------------------
|
||||
CPU fn_CPU
|
||||
XLA fn_XLA
|
||||
Lazy fn_Lazy
|
||||
AutogradCPU fn_AutogradCPU
|
||||
CompositeExplicitAutograd[alias] fn_CompositeExplicitAutograd
|
||||
'''
|
||||
@ -883,10 +891,12 @@ key kernel
|
||||
---------------------------
|
||||
CPU fn_CPU [kernel]
|
||||
XLA fn_CompositeImplicitAutograd [math kernel]
|
||||
Lazy fn_CompositeImplicitAutograd [math kernel]
|
||||
QuantizedCPU fn_QuantizedCPU [kernel]
|
||||
AutogradOther ambiguous_autogradother [ambiguous autogradother]
|
||||
AutogradCPU fallthrough [backend fallback]
|
||||
AutogradXLA fn_CompositeImplicitAutograd [math kernel]
|
||||
AutogradLazy fn_CompositeImplicitAutograd [math kernel]
|
||||
'''
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user