## PyTorch Tensor to NumPy Array and Back

2021-03-22You can easily convert a NumPy array to a PyTorch tensor and a PyTorch tensor to a NumPy array. This post explains how it works.

Skip to content## PyTorch Tensor to NumPy Array and Back

2021-03-22## TorchVision Transforms: Image Preprocessing in PyTorch

2021-03-19## NumPy Where: Understanding np.where()

2021-03-03## Finding the Mode of an Empirical Continuous Distribution

2021-03-02## NumPy All: Understanding np.all()

2021-02-25## Binary Cross Entropy Explained

Posted 2021-02-22 • Updated 2021-03-01## Filtering DataFrames with the .query() Method in Pandas

2021-02-19## Linear Interpolation in Python: An np.interp() Example

2021-02-15## NumPy Meshgrid: Understanding np.meshgrid()

2021-02-09## SageMaker Studio Quick Start

2021-02-08

You can easily convert a NumPy array to a PyTorch tensor and a PyTorch tensor to a NumPy array. This post explains how it works.

TorchVision, a PyTorch computer vision package, has a great API for image pre-processing in its torchvision.transforms module. This post gives some basic usage examples, describes the API and shows you how to create and use custom image transforms.

The NumPy where function is like a vectorized switch that you can use to combine two arrays.

You can find the mode of an empirical continuous distribution by plotting the histogram and looking for the maximum bin.

The np.all() function tests whether all elements in a NumPy array evaluate to true.

A simple NumPy implementation of the binary cross entropy loss function and some intuition about why it works.

Pandas provides a .query() method on DataFrame’s with a convenient string syntax for filtering DataFrames. This post describes the method and gives simple usage examples.

It’s easy to linearly interpolate a 1-dimensional set of points in Python using the np.interp() function from NumPy.

You can create multi-dimensional coordinate arrays using the np.meshgrid() function, which is also available in PyTorch and TensorFlow. But watch out! PyTorch uses different indexing by default so the results might not be the same.

A step-by-step quick start guide for SageMaker Studio. Start a Studio session, launch a notebook on a GPU instance and run object detection inference with a detectron2 pre-trained model.