Search Unity

  1. Dismiss Notice
  2. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice

Help Wanted Tensor operations with Barracuda ?

Discussion in 'Barracuda' started by albanmdb, Aug 7, 2020.

  1. albanmdb


    Jul 10, 2020

    I come from a Python background and am very new to Unity/barracuda/c#. I would like to use a custom model inside Unity with Barracuda. The import goes well but I have to do some post-processing on the output tensors of the model. Is it possible to call some ONNX operators (eg. flatten, concat, max, etc.) after doing the inference with the model? If not, how would I go about implementing vectorized operations to still benefit from the GPU? Or am I forced to use the CPU to do the post-processing ?

  2. amirebrahimi_unity


    Unity Technologies

    Aug 12, 2015
    It is possible to create a model programmatically by adding to Layers:

    However, I think this will be cumbersome and error prone. My suggestion would be to create the other half of your post-processing network in one of the frameworks that supports exporting to ONNX and then import that as a separate network. You can feed the output of one to the input of the other. You are free to specify CPU/GPU when you create your IWorker.