Skip to main content

KrikNN is a library that includes various components for neural network operations and tensor manipulations. This README provides an overview of the `Tensor` class and its functionality, as well as instructions for running the tests.

Project description

KrikNN

KrikNN is a library that includes various components for neural network operations and tensor manipulations. This README provides an overview of the Tensor class and its functionality, as well as instructions for running the tests.

Tensor Class

The Tensor class is a fundamental component of the KrikNN library, allowing you to perform various operations on multidimensional arrays.

Features

  • Initialization: Create tensors from data with support for different data types.
  • Matrix Multiplication: Use the @ operator to perform matrix multiplication.
  • Addition: Use the + operator to perform element-wise addition.
  • Shape: Retrieve the shape of the tensor.

Usage

Here’s a brief guide on how to use the Tensor class:

import numpy as np
from kriknn.engine.tensor import Tensor

# Create tensors
tensor1 = Tensor([[1.0, 2.0], [3.0, 4.0]])
tensor2 = Tensor([[2.0, 0.0], [1.0, 2.0]])

# Matrix multiplication
result = tensor1 @ tensor2
print(result.data)  # Output: [[4.0, 4.0], [10.0, 8.0]]

# Addition
tensor3 = Tensor([[5.0, 6.0], [7.0, 8.0]])
result_add = tensor1 + tensor3
print(result_add.data)  # Output: [[6.0, 8.0], [10.0, 12.0]]

Running Tests

The KrikNN library includes tests for the Tensor class to ensure its functionality. The tests are written using unittest and can be run using the following command:

python -m tests/run.py

Test Cases

  1. Initialization Tests: Verify that tensors are initialized correctly with various data types.
  2. Shape Tests: Ensure that the shape property returns the correct dimensions.
  3. Matrix Multiplication Tests: Check that matrix multiplication is performed correctly.
  4. Addition Tests: Validate that tensor addition is working as expected.
  5. Error Handling Tests: Ensure that appropriate errors are raised for invalid operations.

Examples

The KrikNN library provides several examples to help you get started with tensor operations:

python examples/basic_tensor_operations.py

Contribution

Contributions to the KrikNN library are welcome. Please fork the repository, make your changes, and submit a pull request. Ensure that your changes are covered by tests and adhere to the existing code style.

License

This project is licensed under the MIT License. See the LICENSE file for details.


Feel free to adjust the README based on the specific details of your project or additional features you might want to include.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kriknn-0.1.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

kriknn-0.1.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file kriknn-0.1.1.tar.gz.

File metadata

  • Download URL: kriknn-0.1.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for kriknn-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d4e849c2a7ddb7ed06dc31a443f453e39cfcfc7da6827bde6cf63347352437f7
MD5 0992a11d33c9dde425d9aadab4776e3c
BLAKE2b-256 d9897ac54f6a964922e81f2af026c029485698644bb91651a86bfd4eef2a8e4a

See more details on using hashes here.

File details

Details for the file kriknn-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: kriknn-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for kriknn-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 54aa398d6a1b7273ee9473adf8c447f8e0f6fcdcece5ffcd47b4ebfec88784af
MD5 49cd2409bcd3573c2cf444fd3ef35145
BLAKE2b-256 850970eb51dfb2174ff9fcd1c918cb499b88964875a34a2a2b9c1993e3276d24

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page