Web 3.0 has changed the end-user experience by shifting information interaction from the screen to physical space, which is also known as "Spatial Web". The "spatial network" includes a spatial interaction layer (using intelligent glasses or voice to achieve real-time information interaction), a digital information layer (using sensing and digital mapping to create digital twins for each object), and a physical layer (understanding and experiencing the world through perception).
VR/AR is the main gateway of the space network, AI/ML promotes interaction with machines or devices, 5G/6G and other new generation network communication technologies and edge computing are enabling technologies to optimize interactive experience, and blockchain promotes the realization of a truly open and democratic ecosystem.
try:
onnx.checker.check_model(model)
except onnx.checker.ValidationError as e:
print("the model is invalid:%s"%e)
exit(1)
else:
print("the model is valid")
def export_model_from_pytorch_to_onnx(pytorch_model,onnx_model_name):
batch_size=1
#input to the model
x=torch.randn(batch_size,1,32,32)
out=pytorch_model(x)
#print("out:",out)
#export the model
torch.onnx.export(pytorch_model,#model being run
x,#model input(or a tuple for multiple inputs)
onnx_model_name,#where to save the model(can be a file or file-like object)
export_params=True,#store the trained parameter weights inside the model file
opset_version=9,#the ONNX version to export the model to
do_constant_folding=True,#whether to execute constant folding for optimization
input_names=['input'],#the model's input names
output_names=['output'],#the model's output names
dynamic_axes={'input':{0:'batch_size'},#variable length axes
'output':{0:'batch_size'}})
def verify_onnx_model(onnx_model_name):
#model is an in-memory ModelProto
model=onnx.load(onnx_model_name)
#print("the model is:n{}".format(model))
#check the model