## PyTorch Tensor to NumPy Array and Back

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.

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.

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

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

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.

The np.pad() function has a complex, powerful API. But basic usage is very simple and complex usage is achievable! This post shows you how to use NumPy pad and gives a couple examples.

This post explains how the NumPy reshape operation works, how to use it and gotchas to watch out for.

You can calculate the L1 and L2 norms of a vector or the Frobenius norm of a matrix in NumPy with np.linalg.norm(). This post explains the API and gives a few concrete usage examples.

Using and suppressing scientific notation in Python and NumPy.

The unofficial guide to np.tile() with examples.

**Contact **

**Connect**

**Free Guide**

Download my free guide: **8 Best Practices for Building Machine Learning Pipelines**