> For the complete documentation index, see [llms.txt](https://deeplearning4j.konduit.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://deeplearning4j.konduit.ai/en-1.0.0-m1.1/nd4j/how-to-guides/other-framework-interop/tvm.md).

# TVM

Nd4j allows execution of models via javacpp's tvm bindings using nd4j's INDArray as a data structure. Leveraging the nd4j-tvm interop is fairly simple.

A TVM model can be loaded and executed as follows:

```java
        File f = new File ("path/to/your/model.pb");
        INDArray x = Nd4j.scalar(1.0f).reshape(1,1);
        TvmRunner tvmRunner = TvmRunner.builder()
                .modelUri(f.getAbsolutePath())
                .build();
        Map<String,INDArray> inputs = new LinkedHashMap<>();
        inputs.put("x",x);
        Map<String, INDArray> exec = tvmRunner.exec(inputs);
        INDArray z = exec.get("0");
```

This outputs a result with a map of output names to the ndarray result from tvm.

In maven, add the following dependency:

```markup
<dependency>
   <groupId>org.nd4j</groupId>
   <artifactId>nd4j-tvm</groupId>
   <version>${nd4j.version}</version>
</dependency>
```

Note, this depends on javacpp's tvm bindings. This means tvm's native binaries are managed by javacpp. Javacpp will bundle all native binaries for all platforms by default unless you specify a platform. You can do this by specifying a -Dplatform=your-platform-of-choice. You may find more [here](https://github.com/bytedeco/javacpp-presets/wiki/Reducing-the-Number-of-Dependencies) in the javacpp docs.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://deeplearning4j.konduit.ai/en-1.0.0-m1.1/nd4j/how-to-guides/other-framework-interop/tvm.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
