我正在尝试使用不同(但固定)长度的切片迭代张量。以下示例代码显示了我的实际操作:
Tomcat tomcat = new Tomcat();
tomcat.setBaseDir("temp");
tomcat.setPort(8080);
tomcat.enableNaming();
tomcat.getConnector(); // Tomcat 9 we need to get the connector. it not by default.
String contextPath = "/Test";
String warFilePath = "D:\\Test\\embedded\\Test.war";
tomcat.getHost().setAppBase(".");
StandardContext ctx = (StandardContext) tomcat.addWebapp(contextPath, warFilePath);
((StandardJarScanner) ctx.getJarScanner()).setScanAllDirectories(true);
((StandardJarScanner) ctx.getJarScanner()).setScanAllFiles(true);
((StandardJarScanner) ctx.getJarScanner()).setScanClassPath(true);
tomcat.start();
tomcat.getServer().await();
有人能想到一种最佳方法来实现无for循环吗?它在计算图中创建了很多不必要的操作