vba数组dim
介绍 (Introduction)
Within many development languages, there is a popular paradigm of using N-Dimensional arrays. They allow you to write numerical code that would otherwise require many levels of nested loops in only a few simple operations. Because of the ability to parallelize, it often runs even faster than the standard looping as well. This is now standard practice in many fields such as data science, graphics, and deep learning, but can be used in applications far beyond this. In Python, the standard library for NDArrays is called NumPy. However, there is no equivalent standard library in Java. One offering for Java developers interested in working with NDArrays is AWS’s Deep Java Library (DJL). Although it also contains Deep Learning, the core is a powerful NDArray system that can be used on its own to bring this paradigm into Java. With support for several Deep Learning Frameworks (PyTorch, TensorFlow, MXNet), DJL can allow the NDArray operations to run at a large-scale and across multiple platforms. No matter whether you are running on CPU or GPU, PC or Android, it simply works. In this tutorial, we will walk through how you can leverage the NDArray from DJL to write your NumPy code in Java and apply NDArray into a real-world application.
在许多开发语言中,存在使用N维数组的流行范例。 它们使您能够编写数字代码,而这些数字代码仅需执行几个简单的操作就需要多层嵌套循环。 由于具有并行化的能力,它通常也比标准循环运行得更快。 现在,这是许多领域(例如数据科学,图形和深度学习)的标准做法,但可以用于远远超出此范围的应用程序中。 在Python中,NDArrays的标准库称为NumPy。 但是,Java中没有等效的标准库。 AWS的Deep Java Library(DJL)是对有兴趣使用NDArrays的Java开发人员提供的一种服务。 尽管它还包含深度学习,但其核心是功能强大的NDArray系统,可以单独使用以将该范例引入Java。 借助对几种深度学习框架(PyTorch,TensorFlow,MXNet)的支持,DJL可以使NDArray操作在多个平台上大规模运行。 无论您是在CPU还是GPU,PC或Android上运行,它都可以正常工作。 在本教程中,我们将逐步介绍如何利用DJL中的NDArray来用Java编写NumPy代码并将NDArray应用到实际应用程序中。
建立 (Setup)
You can use the following configuration in a gradle project. Or, you can skip the setup and try it directly in our interactive online console.
您可以在gradle项目中使用以下配置。 或者,您可以跳过设置并直接在我们的网站中尝试 交互式在线控制台 。
plugins {
id 'java'
}
repositories {
jcenter()
}
dependencies {
implementation "ai.djl:api:0.6.0"
// PyTorch
runtimeOnly "ai.djl.pytorch:pytorch-engine:0.6.0"
runtimeOnly "ai.djl.pytorch:pytorch-native-auto:1.5.0"
}
That’s it, now we can start our implementation.
就是这样,现在我们可以开始实施了。
基本操作 (Basic operation)
Let’s first create a try block to create a scope for our code (If you are u