OpenMined / syft.js

The official Syft worker for Web and Node, built in Javascript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deserialize JSON string into new tensor class

iamtrask opened this issue · comments

if you have a javascript variable

message = {"torch_type": "torch.FloatTensor", "data": [1.0, 2.0, 3.0, 4.0, 5.0], "id": 1476041248, "owners": [0], "is_pointer": false}

We want a new javascript function called "receive_tensor" which will convert that JSON message into this object with all the attributes contained in the dictionary.

This object should have exactly 1 method "add" which can add two of these objects together. For example...

var x = receive_obj(message)
var y = x.add(x)

Looking into it :-D

Closed with #15