Contents

Customizing a TensorFlow operation

Implement a custom operation that uses Metal kernels to accelerate neural-network training performance.

Overview

Configure the sample code

  1. Follow the instructions in Getting started with tensorflow-metal.

  2. Install ffmpeg using brew.

brew install ffmpeg
  1. Install the required Python packages.

pip install -r requirements.txt
  1. Use make to build the custom operation with Xcode.

cd hash_encoder
make
cd ..
  1. Run the sample.

python tiny_nerf_hash.py
  1. View the resutls in the result_nerf_hash folder.

  • To compare the performance benefits provided by this sample, you can run the original NeRF sample code included with the project. View the resutls in the result_nerf_mlp folder.

python tiny_nerf_mlp.py

See Also

Compute workflows