def zeros(g, sizes, dtype, layout, device):
# NOTE: no way to set device and layout in ONNX, so we ignore it
return g.op("ConstantOfShape", sizes,
- value_t=torch.tensor(0, dtype=scalar_type_to_pytorch_type[dtype]))
+ value_t=torch.tensor([0], dtype=scalar_type_to_pytorch_type[dtype]))
@parse_args('v', 'i', 'v', 'v')
def zeros_like(g, input, dtype, layout, device):
shape = g.op("Shape", input)
return g.op("ConstantOfShape", shape,
- value_t=torch.tensor(0, dtype=scalar_type_to_pytorch_type[dtype]))
+ value_t=torch.tensor([0], dtype=scalar_type_to_pytorch_type[dtype]))
@parse_args('v', 'i', 'v', 'v')
def ones(g, sizes, dtype, layout, device):
return g.op("ConstantOfShape", sizes,
- value_t=torch.tensor(1, dtype=scalar_type_to_pytorch_type[dtype]))
+ value_t=torch.tensor([1], dtype=scalar_type_to_pytorch_type[dtype]))
@parse_args('v', 'i', 'v', 'v')
def ones_like(g, input, dtype, layout, device):
shape = g.op("Shape", input)
return g.op("ConstantOfShape", shape,
- value_t=torch.tensor(1, dtype=scalar_type_to_pytorch_type[dtype]))
+ value_t=torch.tensor([1], dtype=scalar_type_to_pytorch_type[dtype]))
def full(g, sizes, value, dtype, layout, device):
else:
dtype = _get_const(dtype, 'i', 'dtype')
return g.op("ConstantOfShape", sizes,
- value_t=torch.tensor(const_value, dtype=scalar_type_to_pytorch_type[dtype]))
+ value_t=torch.tensor([const_value], dtype=scalar_type_to_pytorch_type[dtype]))
@parse_args('v', 'f', 'i', 'v', 'v')
def full_like(g, input, fill_value, dtype, layout, device):
shape = g.op("Shape", input)
return g.op("ConstantOfShape", shape,
- value_t=torch.tensor(fill_value, dtype=scalar_type_to_pytorch_type[dtype]))
+ value_t=torch.tensor([fill_value], dtype=scalar_type_to_pytorch_type[dtype]))
@parse_args('v', 'v', 'v', 'v', 'i')