ifnode.inputs[0].ownerandnode.inputs[0].owner.op==host_from_gpu:#if the input was on the gpu
new_node=host_from_gpu(gpu_alloc(*node.inputs))
return[new_node]
replace=True
ifall([c!='output'andc.op==gpu_from_hostforc,idxinnode.outputs[0].clients]):#if all clients are on gpu
new_node=host_from_gpu(gpu_alloc(*node.inputs))
return[new_node]
replace=True
ifall([c!='output'andc.op==tensor.joinandall([i.ownerandi.owner.opin[host_from_gpu,tensor.alloc]foriinc.inputs[1:]])forc,idxinnode.outputs[0].clients]):#if the client is a subtensor with input on gpu or alloc