Closed dcrc2 closed 3 years ago
An additional complication: we have some tests (test/python/test_tracing_core.py
) which use ksc-generated code without PyTorch. In order to support this, I've moved the torch-specific code to a separate header (knossos-entry-points-torch.h
), so that we include either knossos-entry-points.h
or knossos-entry-points-torch.h
as appropriate. In non-PyTorch mode it is an error to define an entry point which uses a tensor.
At the moment this is all done by adding a new boolean parameter use_torch
to the C++-generating functions. In future there might be more than two choices here (supporting bindings to various languages/libraries), so we might want to upgrade this parameter to an abstract base class.
AB#19887
~Draft PR: the current version breaks some of the python tests.~ fixed
Move the conversions between torch types and ks types into C++ code (generated by
python/ksc/cgen.py
). Example code generated for relu3: