Skip to content

geospaitial-lab/torch2moderngl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

torch2moderngl

This is a small utility for transferring data between ModernGL and PyTorch

requirements

Install moderngl and pytorch (with cuda support)

usage

import moderngl
import torch
from torch2moderngl import texture2tensor, tensor2texture

ctx = moderngl.create_context(standalone=True)
texture = ctx.texture((200, 200), 4)  # must have 1, 2, or 4 components

tensor = texture2tensor(texture)  # create tensor from texture

tensor2texture(tensor, texture)  # transfer contents of tensor to existing texture

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published