mardi 16 avril 2019

Creating random Tensors in Swift for Tensorflow

I'm trying to use Swift for Tensorflow API, and I'm not able to find a way to create Tensors with random normal initialization.

Currently I'm getting an array from numpy to construct a Tensor struct:

let np = Python.import("numpy")

let w_np = np.random.randn(10, 10).astype(np.float32)
let w = Tensor<Float32>(numpy: w_np)!

Is there Swift for Tensorflow pure way to get random arrays?




Aucun commentaire:

Enregistrer un commentaire