Step 2 - Creating MXNet context

Then we create an MXNet context for CPU-based computation. Since I am doing it by CPU, I instantiated for the CPU. Feel free to use the GPU if you have already configured it by providing the device ID:

// Retrieves the name of this Context object val ctx = Context.cpu() 

Get Scala Machine Learning Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.