This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source /home/ec2-user/anaconda3/bin/activate /home/ec2-user/anaconda3/envs/JupyterSystemEnv | |
jupyter labextension install jupyterlab_vim | |
pip install jupyter_contrib_nbextensions | |
sudo -H -u ec2-user bash -c "source /home/ec2-user/anaconda3/bin/activate /home/ec2-user/anaconda3/envs/JupyterSystemEnv && jupyter-contrib nbextension install --user && jupyter-nbextension enable select_keymap/main" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Python is a dynamic language, and it is relatively easy to dynamically create | |
and modify things such as classes and objects. Functions, however, are quite | |
challenging to create dynamically. | |
One area where we might want to do this is in an RPC library, where a function | |
defined on a server needs to be available remotely on a client. | |
The naive solution is to simply pass arguments to a generic function that | |
accepts `*args` and `**kwargs`. A lot of information is lost with this approach, | |
however, in particular the number of arguments taken. Used in an RPC | |
implementation, this also delays any error feedback until after the arguments |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import torch | |
from torch import nn | |
import onnx_tensorrt.backend as backend | |
import onnx | |
class Model(nn.Module): | |
def forward(self, x): | |
y = (2 * x)[0:1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
from torch import nn | |
import tensorrt as trt | |
TRT_LOGGER = trt.Logger(trt.Logger.INFO) | |
class Model(nn.Module): | |
def forward(self, x): | |
y = (2 * x)[0:1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include "xtensor/xio.hpp" | |
#include "xtensor/xrandom.hpp" | |
#include "xtensor/xtensor.hpp" | |
#include "xtensor/xview.hpp" | |
template <class E> | |
auto transform(E& x) { | |
x *= 2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include "xtensor/xio.hpp" | |
#include "xtensor/xnpy.hpp" | |
#include "xtensor/xrandom.hpp" | |
#include "xtensor/xtensor.hpp" | |
#include "xtensor/xview.hpp" | |
using farray = xt::xtensor<float, 2, xt::layout_type::row_major>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM frolvlad/alpine-miniconda3 | |
RUN conda install -y -c conda-forge bash jupyter jupyter_contrib_nbextensions | |
RUN conda install -y -c conda-forge xeus-cling xtensor | |
RUN mkdir /notebooks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:18.04 | |
RUN apt-get update && \ | |
apt-get install -y software-properties-common meson libgst-dev \ | |
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libglib2.0-dev \ | |
libcairo2-dev locales gstreamer1.0-tools gstreamer1.0-plugins-good \ | |
gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly git | |
RUN add-apt-repository ppa:nnstreamer/ppa && \ | |
apt-get update && \ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class VideoWriter: | |
def __init__(self, output_path, overwrite_output=False): | |
self.output_path = output_path | |
self.active = False | |
self._stream = None | |
self._shape = None | |
self.overwrite_output = overwrite_output | |
def __enter__(self): |
NewerOlder