GraphView.clone does not clone tensor
import aidge_core
import aidge_backend_cpu
def initFiller(model, array_value):
# Initialize parameters (weights and biases)
for node in model.get_nodes():
if node.type() == "Producer":
prod_op = node.get_operator()
value = prod_op.get_output(0)
value.set_backend("cpu")
tuple_out = node.output(0)[0]
if tuple_out[0].type() == "FC" and tuple_out[1] == 1:
# FC weight
aidge_core.constant_filler(value, array_value)
elif tuple_out[0].type() == "FC" and tuple_out[1] == 2:
# FC bias
aidge_core.constant_filler(value, array_value)
else:
pass
fc = aidge_core.FC(in_channels=6, out_channels=6, name="InputNode")
model = aidge_core.sequential([fc])
initFiller(model, 0.0)
model.compile("cpu", aidge_core.dtype.float32, dims=[[1, 6, 1, 1]])
clone_model=model.clone()
initFiller(clone_model, 1.0)
for node in model.get_nodes():
if node.type() == "Producer":
prod_op = node.get_operator()
value = prod_op.get_output(0)
value.set_backend("cpu")
tuple_out = node.output(0)[0]
# No conv in current network
if tuple_out[0].type() == "FC" and tuple_out[1] == 1:
# FC weight
print(value)
Output:
{
{ 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000},
{ 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000},
{ 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000},
{ 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000},
{ 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000},
{ 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000}
}
Expected output was 0.0 ...