コード例 #1
0
ファイル: test_dispatch.py プロジェクト: zwh840282584/pytorch
    def test_autogradother(self):
        dispatcher = PythonDispatcher()
        dispatcher.register(
            ["CPU", "QuantizedCPU", "CompositeImplicitAutograd"])
        self.assertExpectedInline(
            dispatcher.dispatchTable(), '''\

Computed Dispatch Table
key             kernel
---------------------------
CPU             fn_CPU [kernel]
XLA             fn_CompositeImplicitAutograd [math kernel]
QuantizedCPU    fn_QuantizedCPU [kernel]
AutogradOther   ambiguous_autogradother [ambiguous autogradother]
AutogradCPU     fallthrough [backend fallback]
AutogradXLA     fn_CompositeImplicitAutograd [math kernel]
''')

        self.assertExpectedInline(
            dispatcher.registrations(), '''\

Registered Kernels
key             kernel
---------------------------
CPU             fn_CPU
QuantizedCPU    fn_QuantizedCPU
CompositeImplicitAutograd[alias] fn_CompositeImplicitAutograd
''')
コード例 #2
0
ファイル: test_dispatch.py プロジェクト: xkszltl/pytorch
    def test_math_autogradcpu(self):
        dispatcher = PythonDispatcher()
        dispatcher.register(
            ["CPU", "XLA", "Lazy", "CompositeImplicitAutograd", "AutogradCPU"])
        self.assertExpectedInline(
            dispatcher.dispatchTable(), '''\

Computed Dispatch Table
key             kernel
---------------------------
CPU             fn_CPU [kernel]
XLA             fn_XLA [kernel]
Lazy            fn_Lazy [kernel]
FPGA            fn_CompositeImplicitAutograd [math kernel]
AutogradOther   fn_CompositeImplicitAutograd [math kernel]
AutogradCPU     fn_AutogradCPU [kernel]
AutogradXLA     fallthrough [backend fallback]
AutogradLazy    fallthrough [backend fallback]
''')
        self.assertExpectedInline(
            dispatcher.registrations(), '''\

Registered Kernels
key             kernel
---------------------------
CPU             fn_CPU
XLA             fn_XLA
Lazy            fn_Lazy
AutogradCPU     fn_AutogradCPU
CompositeImplicitAutograd[alias] fn_CompositeImplicitAutograd
''')
コード例 #3
0
ファイル: test_dispatch.py プロジェクト: zwh840282584/pytorch
    def test_defaultbackend_autogradcpu(self):
        dispatcher = PythonDispatcher()
        dispatcher.register(
            ["CPU", "XLA", "CompositeExplicitAutograd", "AutogradCPU"])
        self.assertExpectedInline(
            dispatcher.dispatchTable(), '''\

Computed Dispatch Table
key             kernel
---------------------------
CPU             fn_CPU [kernel]
XLA             fn_XLA [kernel]
QuantizedCPU    fn_CompositeExplicitAutograd [default backend kernel]
AutogradOther   fallthrough [backend fallback]
AutogradCPU     fn_AutogradCPU [kernel]
AutogradXLA     fallthrough [backend fallback]
''')

        self.assertExpectedInline(
            dispatcher.registrations(), '''\

Registered Kernels
key             kernel
---------------------------
CPU             fn_CPU
XLA             fn_XLA
AutogradCPU     fn_AutogradCPU
CompositeExplicitAutograd[alias] fn_CompositeExplicitAutograd
''')
コード例 #4
0
ファイル: test_dispatch.py プロジェクト: jingruhou/hjrPyTorch
    def test_math_autogradcpu(self):
        dispatcher = PythonDispatcher()
        dispatcher.register(["CPU", "XLA", "Math", "AutogradCPU"])
        self.assertExpectedInline(
            dispatcher.dispatchTable(), '''\

Computed Dispatch Table
key             kernel
---------------------------
CPU             fn_CPU [kernel]
XLA             fn_XLA [kernel]
QuantizedCPU    fn_Math [math kernel]
AutogradOther   fn_Math [math kernel]
AutogradCPU     fn_AutogradCPU [kernel]
AutogradXLA     fallthrough [backend fallback]
''')
        self.assertExpectedInline(
            dispatcher.registrations(), '''\

Registered Kernels
key             kernel
---------------------------
CPU             fn_CPU
XLA             fn_XLA
AutogradCPU     fn_AutogradCPU
Math[alias]     fn_Math
''')