Error Using Torch in PyCodelet

Hi All,

This might be just me being stupid and not realizing something but I would appreciate some opinions and advice if anyone has any.

I am trying to use a model created in pytorch to detect objects within Isaac, taking inputs from the video stream and outputting detections, using existing carter_sim functionality to handle robot navigation and movement.

However, I seem to be stumbling at an early hurdle … the “import torch” command.

I stripped my pycodelet down to its most basic elements as shown below to try and get something to run.

from engine.pyalice import *
import pycodelets.probabilistic_detector
import torch

class ProbabilisticDetector(Codelet):
    def start(self):
        # Receive from the colour camera
        self.rgb_rx = self.isaac_proto_rx("ColorCameraProto", "rgbCapture")
        self.count = 0
        print("Completed Initialization")

    def tick(self):
        print("TICK {:08d}".format(self.count))
        self.count += 1

def main():
    app = Application(app_filename = "pycodelets/probabilistic_detector/")
    app.register({"probabilistic_detector": ProbabilisticDetector})

if __name__ == '__main__':

Now running my app with “import torch” commented out works just fine and the functionality follows carter_sim and nothing happens except robot movement and a lot of print commands.

If I keep the “import torch” command in the code, the code crashes with the following error output

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
|                            Isaac application terminated unexpectedly                             |

I cannot explain this functionality. Moreso, I can add the “import torch” line into either of the pycodelet tutorials (ping_python and proportional_control_python) and they are unaffected.

I know this is weird and probably not completely Isaac related but it has me confused that it happens for some apps and not for others. Does anyone have any ideas as to what I have set up incorrectly to cause such an issue?

Other parts of the bazel workspace code are attached to help. (1.43 KB)