It’s possible to use the C++ API from Java using the JavaCPP Presets for PyTorch:
  
      
      github.com
  
  
    

bytedeco/javacpp-presets 2

master/pytorch

  The missing Java distribution of native C++ libraries

  
  
    
    
  
  


It’s not a high-level Java API, yet anyway, so a lot of it isn’t actually nice to use from Java, but it’s usable, and doesn’t require Python, so it’s appropriate for applications in Spring and what not.