Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import numpy as np
from redisai import Client, DType, Device, Backend
import ml2rt
client = Client()
client.tensorset('x', [2, 3], dtype=DType.float)
t = client.tensorget('x')
print(t.value)
model = ml2rt.load_model('test/testdata/graph.pb')
tensor1 = np.array([2, 3], dtype=np.float)
client.tensorset('a', tensor1)
client.tensorset('b', (12, 10), dtype=np.float)
client.modelset('m', Backend.tf,
Device.cpu,
inputs=['a', 'b'],
outputs='mul',
data=model)
client.modelrun('m', ['a', 'b'], ['mul'])
print(client.tensorget('mul'))
# Try with a script
script = ml2rt.load_script('test/testdata/script.txt')
client.scriptset('ket', Device.cpu, script)
client.scriptrun('ket', 'bar', inputs=['a', 'b'], outputs='c')
import redisai as rai
con = rai.Client(host='159.65.150.75', port=6379, db=0)
pt_model_path = '../models/imagenet/pytorch/resnet50.pt'
script_path = '../models/imagenet/pytorch/data_processing_script.txt'
pt_model = rai.load_model(pt_model_path)
script = rai.load_script(script_path)
out1 = con.modelset('imagenet_model', rai.Backend.torch, rai.Device.cpu, pt_model)
out2 = con.scriptset('imagenet_script', rai.Device.cpu, script)
model = ml2rt.load_model('test/testdata/graph.pb')
tensor1 = np.array([2, 3], dtype=np.float)
client.tensorset('a', tensor1)
client.tensorset('b', (12, 10), dtype=np.float)
client.modelset('m', Backend.tf,
Device.cpu,
inputs=['a', 'b'],
outputs='mul',
data=model)
client.modelrun('m', ['a', 'b'], ['mul'])
print(client.tensorget('mul'))
# Try with a script
script = ml2rt.load_script('test/testdata/script.txt')
client.scriptset('ket', Device.cpu, script)
client.scriptrun('ket', 'bar', inputs=['a', 'b'], outputs='c')