Fixed optimization in tensor and get_c_declare