A modern web application for testing and visualizing ttnn operations in real-time.
- 🎯 150+ Operations: Support for Pointwise Unary, Binary, and Ternary operations
- 🔧 Flexible Inputs: Choose between tensor or scalar inputs with custom values
- 📊 Data Type Support: bfloat16, float32, int32, uint32, and more
- 📈 Result Visualization: View shape, dtype, and output values
- 🎨 Modern UI: Beautiful, responsive interface with real-time feedback
- 🔐 Secure Access: Password-protected with SHA-256 hashing
- ⚡ Optional Parameters: Support for 8 operations with configurable parameters
- 🔄 PyTorch Comparison: Real-time comparison with PyTorch results
- 🌐 Cloudflare Ready: Works seamlessly with Cloudflare Tunnel
- Navigate to the project directory:
cd /home/aswin/ttnn-web-calculator- Activate the tt-metal Python environment:
cd /home/aswin/tt-metal
source python_env/bin/activate
cd /home/aswin/ttnn-web-calculator- Install Flask (if not already installed):
pip install Flask==3.0.0The application is password-protected for secure access:
Password: mcw.pass
- Uses SHA-256 password hashing
- Session-based authentication
- All routes protected (including API endpoints)
- Password is NOT stored in plain text
See SECURITY.md for detailed security information.
- Start the web server:
python app.py- Open your browser and navigate to:
http://localhost:5000
- Select an operation from the dropdown menu
- Configure your inputs:
- Choose between Tensor or Scalar
- Set the value
- Select the data type
- Click "Calculate Result" to execute the operation
- View the results:
- TTNN operation result value
- PyTorch equivalent result (for comparison)
- Match indicator showing if results agree
- Sample values from the output tensor
- Trigonometric: sin, cos, tan, asin, acos, atan, sinh, cosh, tanh
- Exponential: exp, exp2, expm1, log, log2, log10, log1p
- Activation: relu, sigmoid, gelu, silu, swish, tanh, softplus
- Other: abs, sqrt, square, rsqrt, reciprocal, neg, sign, floor, ceil, round
- Arithmetic: add, subtract, multiply, div, pow, remainder
- Comparison: gt, lt, ge, le, eq, ne, maximum, minimum
- Logical: logical_and, logical_or, logical_xor
- Bitwise: bitwise_and, bitwise_or, bitwise_xor
- addcdiv, addcmul, mac, where, lerp
- Backend: Flask with ttnn integration
- Frontend: HTML/CSS/JavaScript with modern responsive design
- Device Management: Automatic initialization and cleanup of ttnn device
To test ttnn.add:
- Select "ttnn.add" from the dropdown
- Set Input 1: Type=Tensor, Value=5.0, dtype=bfloat16
- Set Input 2: Type=Tensor, Value=3.0, dtype=bfloat16
- Click "Calculate Result"
- View the result: All values should be 8.0
- All tensor operations use a default shape of (2, 2, 32, 32) for compatibility
- Tensors are automatically moved to the device with TILE_LAYOUT
- The device is initialized on first use and persists between requests
- Results show the first 10 elements as samples