Metadata-Version: 2.4
Name: texor
Version: 0.1.0
Summary: A ai library combining the best of TensorFlow and PyTorch
Home-page: https://github.com/letho1608/texor
Author: letho1608
Author-email: letho16082003@gmail.com
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.19.0
Requires-Dist: torch>=1.9.0
Requires-Dist: tensorflow>=2.6.0
Requires-Dist: matplotlib>=3.3.0
Requires-Dist: tqdm>=4.62.0
Requires-Dist: rich>=10.0.0
Requires-Dist: click>=8.0.0
Provides-Extra: dev
Requires-Dist: pytest>=6.0; extra == "dev"
Requires-Dist: pytest-cov>=2.0; extra == "dev"
Requires-Dist: flake8>=3.9.0; extra == "dev"
Requires-Dist: black>=21.5b2; extra == "dev"
Requires-Dist: isort>=5.8.0; extra == "dev"
Requires-Dist: mypy>=0.900; extra == "dev"
Provides-Extra: docs
Requires-Dist: sphinx>=4.0; extra == "docs"
Requires-Dist: sphinx-rtd-theme>=0.5.0; extra == "docs"
Requires-Dist: sphinx-autodoc-typehints>=1.12.0; extra == "docs"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# Texor - Comprehensive AI Framework

Texor is a comprehensive AI framework that combines the best features of TensorFlow and PyTorch. It provides a high-level API while maintaining flexibility and performance through a hybrid backend system.

## Key Features

### 1. Hybrid Backend
- Leverage the power of both TensorFlow and PyTorch
- Seamlessly switch between backends
- Automatic optimization based on use case

### 2. Core API
```python
from texor.core import Tensor

# Create tensors from various sources
x = Tensor([[1, 2], [3, 4]])  # From Python list
x = Tensor(numpy_array)        # From NumPy array
x = Tensor(tf_tensor)         # From TensorFlow tensor
x = Tensor(torch_tensor)      # From PyTorch tensor

# Access data in multiple formats
numpy_data = x.numpy()
tf_data = x.tensorflow()
torch_data = x.pytorch()
```

### 3. Neural Network Layers
```python
from texor.nn import Sequential, Linear, Conv2D, MaxPool2D, ReLU, Dropout

model = Sequential([
    Conv2D(in_channels=1, out_channels=32, kernel_size=3),
    ReLU(),
    MaxPool2D(kernel_size=2),
    Conv2D(in_channels=32, out_channels=64, kernel_size=3),
    ReLU(),
    MaxPool2D(kernel_size=2),
    Linear(in_features=1600, out_features=10)
])
```

### 4. Optimizers
```python
from texor.optim import SGD, Adam, RMSprop

# Create optimizer
optimizer = Adam(model.parameters(), lr=0.001)
optimizer = SGD(model.parameters(), lr=0.01, momentum=0.9)
```

### 5. Loss Functions
```python
from texor.nn import MSELoss, CrossEntropyLoss, BCELoss

# Use loss functions
criterion = CrossEntropyLoss()
loss = criterion(predictions, targets)
```

## Installation

```bash
pip install texor
```

## Command Line Interface (CLI)

Texor provides a powerful CLI with intuitive features:

```bash
# View environment and setup information
texor info

# List available modules
texor list

# Search for specific modules
texor list resnet

# Check environment and dependencies
texor check
```

### CLI Features:
- **Color Output**: Messages, warnings, and errors with clear color coding
- **Progress Bars**: Visual progress for long-running tasks
- **Interactive Interface**: User-friendly command line operations
- **System Information**: Detailed environment and configuration details

## Basic Example

```python
from texor.nn import Sequential, Linear, ReLU
from texor.core import Tensor
import numpy as np

# Create model
model = Sequential([
    Linear(input_size=784, output_size=256),
    ReLU(),
    Linear(input_size=256, output_size=10)
])

# Compile model
model.compile(
    optimizer='adam',
    loss='categorical_crossentropy'
)

# Create sample data
x = np.random.randn(100, 784)
y = np.random.randint(0, 10, size=(100,))
y = np.eye(10)[y]  # One-hot encode

# Train model
model.fit(
    x=Tensor(x),
    y=Tensor(y),
    epochs=10,
    batch_size=32
)
```

## MNIST Example
See `examples/mnist_example.py` for a complete example of training a CNN on the MNIST dataset.

## API Documentation

### Core Module
- `Tensor`: Basic class for tensor operations
- `zeros`, `ones`, `randn`: Tensor creation functions
- `from_numpy`, `from_tensorflow`, `from_pytorch`: Conversions from other formats

### Neural Network (nn) Module
- Layers: `Linear`, `Conv2D`, `MaxPool2D`, `Dropout`
- Activations: `ReLU`, `Sigmoid`, `Tanh`
- Loss Functions: `MSELoss`, `CrossEntropyLoss`, `BCELoss`
- Model: `Sequential` - Easy-to-use API for model building

### Optimizers Module
- `SGD`: Stochastic Gradient Descent with momentum
- `Adam`: Adam optimizer
- `RMSprop`: RMSprop optimizer

## Contributing

Contributions are welcome! Please see `CONTRIBUTING.md` for more details.

## License

MIT License - see the `LICENSE` file for details.

## Language Support

For Vietnamese documentation, please see [README_VN.md](docs/README_VN.md).
