pytorch / pytorch/executorch

How to run add operator in executorch ?

Open
#16,010 3 comments 0 reactions 1 assignee View on GitHub

@JacobSzwejbka is already working on this.

Since Dec 1, 2025.

module: runtime
Dominant language
Python
Stars
5k
Forks
1.2k
Avg merge
2d 10h
Merged PRs (30d)
581

Description

The result of the following code is "Segmentation fault: 11" ...

using executorch::aten::ScalarType;
using executorch::aten::Tensor;
using executorch::aten::TensorImpl;

int main() {
	executorch::runtime::runtime_init();
	// Create our input tensor.
	float data[14465 * 3] = { 1 };
	TensorImpl::SizesType sizes[] = { 14465, 3 };
	TensorImpl impl(
	    ScalarType::Float, // dtype
	    2, // number of dimensions
	    sizes,
	    data);
	Tensor input_tensor(&impl);
	Tensor output_tensor(&impl);
	torch::executor::KernelRuntimeContext context_;
	torch::executor::native::add_out(context_, input_tensor, input_tensor, 1.0, output_tensor);
	
	return 0;
}

cc @larryliu0820 @JacobSzwejbka @lucylq

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.