id
stringlengths
15
25
source
stringclasses
1 value
chunk_index
int64
0
393k
token_count
int32
449
512
text
stringlengths
203
7.95k
combine_chunk_392500
combine.txt
392,500
512
does not exists. ValueError: When the extension is not json or bin. Returns: A dictionary representing the read tflite model. """ raw_binary = ["--raw-binary"] if raw_binary else [] with TemporaryDirectoryResource() as tempdir: basename = os.path.basename(input_file) basename_n...
combine_chunk_392501
combine.txt
392,501
512
binary.") shutil.copy(os.path.join(tempdir, "temp.tflite"), output_file) else: raise ValueError("Invalid extension on output file %r" % output_file) def _Upgrade0To1(self, data): """Upgrade data from Version 0 to Version 1. Changes: Added subgraphs (which contains a subset of formall...
combine_chunk_392502
combine.txt
392,502
512
ValueError: When the model has consistency problems. Returns: Upgraded builtin operator data type as a string. """ old_to_new = { "PoolOptions": "Pool2DOptions", "DepthwiseConvolutionOptions": "DepthwiseConv2DOptions", "ConvolutionOptions": "Conv2DOptions", ...
combine_chunk_392503
combine.txt
392,503
512
upgrade from version to version within data. Args: data: Dictionary representing the TensorFlow data. This will be upgraded in place. """ while data["version"] < self._new_version: self._upgrade_dispatch[data["version"]](data) data["version"] += 1 def Convert(self, input_file,...
combine_chunk_392504
combine.txt
392,504
512
# # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing ...
combine_chunk_392505
combine.txt
392,505
512
.compat.v2 # pylint: disable=pointless-statement # Load tensorflow-io-gcs-filesystem if enabled if (_os.getenv("TF_USE_MODULAR_FILESYSTEM", "0") == "true" or _os.getenv("TF_USE_MODULAR_FILESYSTEM", "0") == "1"): import tensorflow_io_gcs_filesystem as _tensorflow_io_gcs_filesystem # Lazy-load Keras v1. _tf_uses...
combine_chunk_392506
combine.txt
392,506
512
eras. _current_module.layers = _KerasLazyLoader( globals(), submodule="__internal__.legacy.layers", name="layers", mode="v1") if _tf_uses_legacy_keras: _module_dir = _module_util.get_parent_dir_for_name( "tf_keras.api._v1.keras.__internal__.legacy.layers") else: _module_dir = _module_util.get_...
combine_chunk_392507
combine.txt
392,507
512
_pip_package(): # TODO(gunan): Add sanity checks to loaded modules here. # Load first party dynamic kernels. _tf_dir = _os.path.dirname(_current_file_location) _kernel_dir = _os.path.join(_tf_dir, "core", "kernels") if _os.path.exists(_kernel_dir): _ll.load_library(_kernel_dir) # Load third party dyna...
combine_chunk_392508
combine.txt
392,508
512
_pb2 from tensorflow.core.function.runtime_client import runtime_client_pybind GlobalEagerContext = runtime_client_pybind.GlobalEagerContext GlobalPythonEagerContext = runtime_client_pybind.GlobalPythonEagerContext # TODO(mdan): Map without adapters once pybind11_protobuf available class Runtime(runtime_client_pybin...
combine_chunk_392509
combine.txt
392,509
512
... def GetFunctionProtoString(self, arg0: str) -> bytes: ... def TransformFunction(self, name: str, pipeline_name: str, dialect: Runtime.Dialect = ...) -> Status: ... class Status: def __init__(self, *args, **kwargs) -> None: ... def GlobalEagerContext() -> EagerContext: ... def GlobalPythonEagerContext...
combine_chunk_392510
combine.txt
392,510
512
context = context or FunctionContext() if context in self._dispatch_dict: dispatch_type = self._dispatch_dict[context].dispatch(function_type) if dispatch_type: key = (context, dispatch_type) fn = self._primary.get(key) if fn is not None: if self._max_capacity is no...
combine_chunk_392511
combine.txt
392,511
512
a FunctionType within a FunctionContext.""" if context in self._dispatch_dict: return self._dispatch_dict[context].try_generalizing_function_type( function_type) else: return function_type # TODO(b/205971333): Remove this function. def clear(self): """Removes all functions from t...
combine_chunk_392512
combine.txt
392,512
512
self._dispatch_table = collections.OrderedDict() # LRU cache for dispatch results. # Maps request types to target types (see class description). # Does not contain exact matches, i.e, if cache[a] is b then a is not b. self._dispatch_cache = collections.OrderedDict() def add_target(self, target: fun...
combine_chunk_392513
combine.txt
392,513
512
aches the dispatch lookup result for a target.""" if target is not None: # LRU Cache removes oldest item if len(self._dispatch_cache) > _MAX_DISPATCH_CACHE: self._dispatch_cache.popitem(last=False) self._dispatch_cache[request] = target def try_generalizing_function_type( self, ta...
combine_chunk_392514
combine.txt
392,514
512
repr__(self): return "<captured_default_value>" def __str__(self): return "<captured_default_value>" CAPTURED_DEFAULT_VALUE = CapturedDefaultValue() PROTO_TO_PY_ENUM = { function_type_pb2.Parameter.Kind.POSITIONAL_ONLY: inspect.Parameter.POSITIONAL_ONLY, function_type_pb2.Parameter.Kind.POS...
combine_chunk_392515
combine.txt
392,515
512
serialized_type_constraint = serialization.serialize( self.type_constraint) if self.type_constraint else None return function_type_pb2.Parameter( name=self.name, kind=PY_TO_PROTO_ENUM[self.kind], is_optional=self.optional, type_constraint=serialized_type_constraint) @p...
combine_chunk_392516
combine.txt
392,516
512
", type_constraint=" + repr(self.type_constraint) + ")") def __reduce__(self): return (self.__class__, (self.name, self.kind, self.optional, self.type_constraint)) class FunctionType(core.FunctionType): """Represents the type of a TensorFlow function. FunctionType...
combine_chunk_392517
combine.txt
392,517
512
Inspects and returns a dictionary of default values.""" signature = super().from_callable(obj, follow_wrapped=follow_wrapped) default_values = {} for p in signature.parameters.values(): if p.default is not p.empty: default_values[p.name] = p.default return default_values @classmethod ...
combine_chunk_392518
combine.txt
392,518
512
return False # Functions are contravariant upon the capture types. return all(capture_type.is_subtype_of(other.captures[name]) for name, capture_type in self.captures.items()) def most_specific_common_subtype( self, others: Sequence["FunctionType"]) -> Optional["FunctionType"]: """...
combine_chunk_392519
combine.txt
392,519
512
(self, arguments) @property def _sorted_parameters(self) -> List[trace.TraceType]: if not hasattr(self, "_cached_sorted_parameters"): # Sort keyword-only parameters by name. sorted_parameters = [] kwonly_parameters = [] for p in self.parameters.values(): if p.kind is Parameter.K...
combine_chunk_392520
combine.txt
392,520
512
.captures.values()): flat.extend(t.to_tensors(v)) if len(flat) != len(self.flat_captures): raise TypeError( f"Flattening captures {captures} with type {self!r} produced" f" {len(flat)} tensors instead of {len(self.flat_captures)}" ) return flat @property def flat_outpu...
combine_chunk_392521
combine.txt
392,521
512
Python symbol naming rules. Without sanitization, names that are not legal Python parameter names can be set which makes it challenging to represent callables supporting the named calling capability. Args: name: The name to sanitize. Returns: A string that meets Python parameter conventions. """...
combine_chunk_392522
combine.txt
392,522
512
AL for p in polymorphic_type.parameters.values()) for name, arg in poly_bound_arguments.arguments.items(): poly_parameter = polymorphic_type.parameters[name] if (has_var_positional and poly_parameter.kind is Parameter.POSITIONAL_OR_KEYWORD): # If there is a VAR_POSITI...
combine_chunk_392523
combine.txt
392,523
512
elif param.kind is param.VAR_KEYWORD: # Disabled when input_signature is specified. continue elif param.kind is param.VAR_POSITIONAL: # Convert into Positional Only args based on length of constraints. for i in range(len(constraints)): parameters.append( Parameter(param...
combine_chunk_392524
combine.txt
392,524
512
.InternalTracingContext(is_legacy_signature=True), ) return FunctionType( parameters, capture_types or {}, return_annotation=return_type # pyrefly: ignore[bad-argument-type] ) def to_structured_signature(function_type: FunctionType) -> Tuple[Any, Any]: """Returns structured input and output signatures...
combine_chunk_392525
combine.txt
392,525
512
at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language govern...
combine_chunk_392526
combine.txt
392,526
512
]]] = None, nested_fn_transforms: Optional[ dict[ str, Optional[ Union[ _FunctionDefTransformerType, list[_FunctionDefTransformerType], ] ], ] ] = None, nested_mlir_transforms: Optiona...
combine_chunk_392527
combine.txt
392,527
512
transform_fn: A single transformation function or a list of transformation functions to apply on the `FunctionDef`. mlir_pipeline: A single MLIR pass or a list of MLIR passes to transform the `FunctionDef`. nested_fn_transforms: A dict of Python function based transformations to apply on f...
combine_chunk_392528
combine.txt
392,528
512
ir_pipelines: rt.TransformFunction(cf.function_def.signature.name, mlir_pipeline) # Get the most up-to-date FunctionDef for the tf.function. This should only # be read after applying any specified mlir_pipelines as they directly # transform the FunctionDef in the runtime. fndef = rt.GetFunctionProto(cf.fun...
combine_chunk_392529
combine.txt
392,529
512
= cf.structured_input_signature structured_outputs_signature = ( func_graph_module.convert_structure_to_signature(cf.structured_outputs) ) with graph.as_default(): func_graph = function_def_lib.function_def_to_graph( fndef, structured_input_signature=structured_input_signature, ...
combine_chunk_392530
combine.txt
392,530
512
= ( transform_fn if isinstance(transform_fn, list) else [transform_fn] ) mlir_pipelines = ( mlir_pipeline if isinstance(mlir_pipeline, list) else [mlir_pipeline] ) # First apply the MLIR based transformation. for mlir_pipeline in mlir_pipelines: rt.TransformFunction(f.cached_definition.signat...
combine_chunk_392531
combine.txt
392,531
512
None, *op.inputs ) except Exception: # pylint: disable=broad-except # TODO(xjun): Figure out why tracing of custom_gradient will fail. tf_logging.exception( f"Error when tracing gradients for {replicated_graph}." ) continue # Re-bind all captures to values within the r...
combine_chunk_392532
combine.txt
392,532
512
= outer_graph.internal_captures.index(capture) except ValueError: # Capture is a tensor inside the function and is not captured from # another external function break capture = outer_graph.external_captures[capture_index] outer_graph = outer_graph.outer_graph return outer_g...
combine_chunk_392533
combine.txt
392,533
512
, namer, None) node = activity.resolve(node, ctx) return node def _handle_wrap_partial_func(obj): """Processes wrapped function and partial functions recursively.""" modified = True while modified: modified = False while hasattr(obj, "__wrapped__"): obj = obj.__wrapped__ modified = True ...
combine_chunk_392534
combine.txt
392,534
512
except NotImplementedError: # Autograph cannot handle multiple lambda functions with same line number # and args name. return [] scope = anno.getanno(node, anno.Static.SCOPE) free_vars_all = list(scope.free_vars) namespace = inspect_utils.getnamespace(fn) filtered = [] for var in free_vars_all...
combine_chunk_392535
combine.txt
392,535
512
filtered.append(FreeVar(str(var), False, None)) filtered = sorted(filtered, key=lambda x: x.name) return filtered def _make_lambda_name(obj): source = inspect.getsource(obj) name = source.split("=")[0].strip() return name def _make_callable_signature(obj): """Generate signature for function/method."""...
combine_chunk_392536
combine.txt
392,536
512
: return None fn_key = (fn.__module__, fn.__qualname__) # To prevent log spam, only generate logging once for each tf.function if fn_key in _fn_log_cache: return None try: fn_vars_map = _detect_function_free_vars(fn) except Exception: # pylint: disable=broad-except # Only for logging purpose...
combine_chunk_392537
combine.txt
392,537
512
in" "https://www.tensorflow.org/guide/function#limitations.\n" "Free variable names inside each function/method are shown below:") logging_txt = [explanation_line, tf_fn_line] + outside_fn_lines if ellipsis_line: logging_txt.append(ellipsis_line) logging_txt = "\n".join(logging_txt) _fn_log_c...
combine_chunk_392538
combine.txt
392,538
512
return node elif getattr(node, "is_sharded_variable", False): return node elif resource_variable_ops.is_resource_variable(node): return node.handle elif isinstance(node, asset.Asset): return node.asset_path elif tensor_util.is_tf_type(node): return node elif isinstance(...
combine_chunk_392539
combine.txt
392,539
512
variables we'll copy handle data for components # as they get captured. pass else: handle_data_util.copy_handle_data(handle, internal_capture) else: # TODO(b/213451747): Remove need to call copy_handle_data handle_data_util.copy_ha...
combine_chunk_392540
combine.txt
392,540
512
.""" def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._mutated = True def pop(self, key, default=None): self._mutated = True return super().pop(key, default) def __setitem__(self, key, value): self._mutated = True return super().__setitem__(key, value) def ...
combine_chunk_392541
combine.txt
392,541
512
: The FuncGraph that captures this tensor. tensor: Tensor. May be from this FuncGraph or a different graph. name: Optional name if a placeholder is created. Returns: Tensor from this FuncGraph. Raises: InaccessibleTensorError: if any tensors are accessed in a manner that bypasses...
combine_chunk_392542
combine.txt
392,542
512
_by_ref: bool = False, ) -> None: """Replace a already exsiting capture, otherwise add it.""" if is_by_ref: self._by_ref_external[key] = external self._by_ref_internal[key] = internal self._by_ref_tracetype[key] = tracetype else: self._by_val_internal[key] = internal self._by...
combine_chunk_392543
combine.txt
392,543
512
able identifier. Returns: Tensor from this FuncGraph. """ # Check if the capture exists in self._by_ref if key is not None and key in self._by_ref_internal: return self._by_ref_internal[key] if key is None: key = len(self._by_ref_internal) while key in self._by_ref_internal:...
combine_chunk_392544
combine.txt
392,544
512
.from_value(tensor, tracing_ctx) spec._name = name # pylint: disable=protected-access if isinstance(tensor, core.Value) and tensor.is_packed: composite_device_name = tensor.device else: composite_device_name = None placeholder_ctx = trace_type.InternalPlaceholderContext( ...
combine_chunk_392545
combine.txt
392,545
512
def by_val_tracetype(self): return self._by_val_tracetype <|file|>tensorflow/tensorflow/core/function/trace_type/serialization.py # Copyright 2022 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance wit...
combine_chunk_392546
combine.txt
392,546
512
Serializable) -> SerializedTraceType: """Converts Serializable to a proto SerializedTraceType.""" if not isinstance(to_serialize, Serializable): raise ValueError("Can not serialize " + type(to_serialize).__name__ + " since it is not Serializable. For object " + str(to...
combine_chunk_392547
combine.txt
392,547
512
aka TensorSpec) to avoid cyclic dependency. TENSOR = None def register_tensor_type(tensor_type): global TENSOR if not TENSOR: TENSOR = tensor_type else: raise AssertionError("Tensor type is already registered.") NanMarker = object() NoneType = type(None) def is_nan(x: Any) -> bool: """Checks if gi...
combine_chunk_392548
combine.txt
392,548
512
init__(self, value: Any): # Values that compare equal can still trace differently: 1, 1.0 and True # give tensors of different dtypes, and math.copysign or a division tells # 0.0 and -0.0 apart. So a Literal only matches values of the same type # and sign. The type is taken before a NaN is replaced belo...
combine_chunk_392549
combine.txt
392,549
512
str): return default_types_pb2.SerializedLiteral(str_value=self.value) if self.value is None: return default_types_pb2.SerializedLiteral( none_value=default_types_pb2.SerializedLiteral.NoneValue()) raise ValueError("Can not serialize Literal of type " + type(self.va...
combine_chunk_392550
combine.txt
392,550
512
(ref) def is_subtype_of(self, other: trace.TraceType) -> bool: return self == other def most_specific_common_supertype( self, types: Sequence[trace.TraceType]) -> Optional["Weakref"]: return self if all(self == other for other in types) else None def placeholder_value(self, placeholder_context) -...
combine_chunk_392551
combine.txt
392,551
512
if supertyped_component is None: return None supertyped_components.append(supertyped_component) return Tuple(*supertyped_components) @classmethod def experimental_type_proto(cls) -> Type[default_types_pb2.SerializedTuple]: return default_types_pb2.SerializedTuple @classmethod def ...
combine_chunk_392552
combine.txt
392,552
512
, serialization.Serializable): """Represents a list of TraceType objects.""" def __init__(self, *components: trace.TraceType): self.components_tuple = Tuple(*components) def is_subtype_of(self, other: trace.TraceType) -> bool: if not isinstance(other, List): return False return self.component...
combine_chunk_392553
combine.txt
392,553
512
, other: Any) -> bool: if not isinstance(other, trace.TraceType): return NotImplemented if not isinstance(other, List): return False return self.components_tuple == other.components_tuple def __hash__(self) -> int: return hash(self.components_tuple) def __repr__(self) -> str: ret...
combine_chunk_392554
combine.txt
392,554
512
, tuple(proto.attribute_names), # pyrefly: ignore[bad-argument-type] Tuple.experimental_from_proto(proto.attributes).components) def experimental_as_proto(self) -> default_types_pb2.SerializedNamedTuple: return default_types_pb2.SerializedNamedTuple( type_name=self.type_name, attribute_n...
combine_chunk_392555
combine.txt
392,555
512
was_casted: return self._placeholder_type(*casted_values) # pyrefly: ignore[not-callable] else: return value def __hash__(self) -> int: return hash((self.type_name, self.attribute_names, self.attributes)) def __eq__(self, other: Any) -> bool: if not isinstance(other, trace.TraceType): ...
combine_chunk_392556
combine.txt
392,556
512
_proto(cls) -> Type[default_types_pb2.SerializedAttrs]: return default_types_pb2.SerializedAttrs @classmethod def experimental_from_proto( cls, proto: default_types_pb2.SerializedAttrs) -> "Attrs": return Attrs( proto.named_attributes.type_name, tuple(proto.named_attributes.attribute_...
combine_chunk_392557
combine.txt
392,557
512
return self._placeholder_type(*casted_values) # pyrefly: ignore[not-callable] else: return value def __hash__(self) -> int: return hash(self.named_attributes) def __eq__(self, other: Any) -> bool: if not isinstance(other, trace.TraceType): return NotImplemented if not isinstanc...
combine_chunk_392558
combine.txt
392,558
512
None else: new_mapping[key] = common return Dict(new_mapping, self._placeholder_type) @classmethod def experimental_type_proto(cls) -> Type[default_types_pb2.SerializedDict]: return default_types_pb2.SerializedDict @classmethod def experimental_from_proto( cls, proto: default_typ...
combine_chunk_392559
combine.txt
392,559
512
[bad-specialization] flattened_types.extend(self.mapping[key].flatten()) return flattened_types def cast(self, value: Any, casting_context) -> Any: # Value must have same keys with the TraceType assert isinstance( value, collections.abc.Mapping ), f"Can not cast {value!r} to a Dict typ...
combine_chunk_392560
combine.txt
392,560
512
the specific language governing permissions and # limitations under the License. # ============================================================================== """TraceType implementations for classes thatimplement the CustomNestProtocol.""" from typing import Any, Iterator, List as PythonList, Optional, Sequence, ...
combine_chunk_392561
combine.txt
392,561
512
differentiate between # two objects with the same components but different metadata. return hash((self.value_type, self.components)) def __repr__(self) -> str: return ( f"{self.__class__.__name__} [metadata={self.metadata!r}, " f"components={self.components!r}]" ) def placeholder_...
combine_chunk_392562
combine.txt
392,562
512
.TraceType) -> bool: return ( isinstance(other, CustomNestTraceType) and self.value_type == other.value_type and self.metadata == other.metadata and len(self.components) == len(other.components) ) <|file|>tensorflow/tensorflow/core/function/trace_type/trace_type_builder.py # Cop...
combine_chunk_392563
combine.txt
392,563
512
ConcreteFunction.structured_input_signature. """ return self._is_legacy_signature class InternalPlaceholderContext(trace.PlaceholderContext): """Container with mappings shared across TraceTypes for placeholder values.""" def __init__(self, context_graph=None, placeholder_ma...
combine_chunk_392564
combine.txt
392,564
512
pass in specs # instead which need to pass through input binding etc. return self._allow_specs def from_value(value: Any, context: trace.TracingContext = None) -> trace.TraceType: """Returns a TraceType corresponding to the value based on the context. Args: value: The value to generat...
combine_chunk_392565
combine.txt
392,565
512
value.__tf_flatten__() return custom_nest_trace_type.CustomNestTraceType( type(value), metadata, tuple(from_value(c, context) for c in components) ) try: ref = weakref.ref(value) if ref is None: raise TypeError( f"Deleted objects are not valid tf.function arguments, Got {valu...
combine_chunk_392566
combine.txt
392,566
512
type)) def cast_and_return_whether_casted( trace_types, values, context ) -> Tuple[List[Any], bool]: did_cast = False casted_values = [] for t, v in zip(trace_types, values): casted_v = t.cast(v, context) casted_values.append(casted_v) if casted_v is not v: did_cast = True return casted...
combine_chunk_392567
combine.txt
392,567
512
"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRAN...
combine_chunk_392568
combine.txt
392,568
512
limitations under the License. # ============================================================================== class GraphExecutionRunOptions: def __init__(self) -> None: ... class SavedModel: def __init__(self, *args, **kwargs) -> None: ... class Tensor: def __init__(self) -> None: ... def LoadSavedM...
combine_chunk_392569
combine.txt
392,569
512
.Variable(constant_op.constant([7, 8, 9]), name='w2') self.w3 = variables.Variable(constant_op.constant([10, 11, 12]), name='w3') @polymorphic_function.function( input_signature=[tensor.TensorSpec([None, 3], dtypes.int32, name='input')] ) def serving_default(self, x): dummy = x + self.w dummy =...
combine_chunk_392570
combine.txt
392,570
512
need to # import tensorflow. Hence, we define it inline. class _LazyLoader(_types.ModuleType): """Lazily import a module so that we can forward it.""" # The lint error here is incorrect. def __init__(self, local_name, parent_module_globals, name): self._local_name = local_name self._parent_module_global...
combine_chunk_392571
combine.txt
392,571
512
], "") # These should not be visible in the main tf module. try: del core except NameError: pass try: del python except NameError: pass try: del compiler except NameError: pass try: del tools except NameError: pass try: del examples except NameError: pass # LINT.ThenChange(//tensorflow/virtual...
combine_chunk_392572
combine.txt
392,572
512
an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """Extracts ResultStore links from a log ...
combine_chunk_392573
combine.txt
392,573
512
, verbose: bool = False) -> ResultDictType: """Finds ResultStore links, and tries to determine their status.""" with open(file_path, 'r', encoding='utf-8', errors='ignore') as f: log_lines = f.read().splitlines() result_store_links: ResultDictType = {} current_url = None for i in range(len(...
combine_chunk_392574
combine.txt
392,574
512
{"=" * 140}') break k -= 1 # A low-effort attempt to find the bazel command that triggered the # invocation. bazel_comm_min_line_i = (previous_end_line if previous_end_line is not None else 0) while k > bazel_comm_min_line_i: backtrack_line = log_lines[k...
combine_chunk_392575
combine.txt
392,575
512
: print(f'Creating testcase for invocation {invocation_id}') status = invocation_results['status'] command = invocation_results.get('command') command_type = invocation_results.get('command_type') case_attrib = attrib.copy() if command_type: command_type = command_type.title() cas...
combine_chunk_392576
combine.txt
392,576
512
testsuites.attrib = suite_attrib testsuite.attrib = suite_attrib indent_xml(testsuites) tree = ElemTree.ElementTree(testsuites) file_path = os.path.join(output_path) with open(file_path, 'wb') as f: f.write(b'<?xml version="1.0"?>\n') tree.write(f) if verbose: print(f'\nWrote XML with ...
combine_chunk_392577
combine.txt
392,577
512
in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either...
combine_chunk_392578
combine.txt
392,578
512
Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the...
combine_chunk_392579
combine.txt
392,579
512
_input(question) except NameError: answer = input(question) # pylint: disable=bad-builtin except EOFError: answer = '' return answer def symlink_force(target, link_name): """Force symlink, equivalent of 'ln -sf'. Args: target: items to link to. link_name: name of the link. """ try:...
combine_chunk_392580
combine.txt
392,580
512
_paths = set(python_paths + library_paths) # Sort set so order is deterministic all_paths = sorted(all_paths) paths = [] for path in all_paths: if os.path.isdir(path): paths.append(path) return paths def get_python_major_version(python_bin_path): """Get the python major version.""" return run...
combine_chunk_392581
combine.txt
392,581
512
= python_lib_path python_major_version = get_python_major_version(python_bin_path) if python_major_version == '2': write_to_bazelrc('build --host_force_python=PY2') # Convert python path to Windows style before writing into bazel.rc if is_windows() or is_cygwin(): python_lib_path = cygpath(python_lib...
combine_chunk_392582
combine.txt
392,582
512
default. Args: environ_cp: copy of the os.environ. var_name: string for name of environment variable, e.g. "TF_NEED_CUDA". query_item: string for feature related to the variable, e.g. "CUDA for Nvidia GPUs". enabled_by_default: boolean for default behavior. question: optional string for ho...
combine_chunk_392583
combine.txt
392,583
512
False elif not user_input: if enabled_by_default: print(yes_reply) var = True else: print(no_reply) var = False else: print('Invalid selection: {}'.format(user_input_origin)) return var def set_action_env_var(environ_cp, var_name, ...
combine_chunk_392584
combine.txt
392,584
512
(['%03d' % int(seg) for seg in version_segments]) return int(version_str) def retrieve_bazel_version(): """Retrieve installed bazel version (or bazelisk). Returns: The bazel version detected. """ bazel_executable = shutil.which('bazel') if bazel_executable is None: bazel_executable = shutil.which...
combine_chunk_392585
combine.txt
392,585
512
_cc_opt_flags) for opt in cc_opt_flags.split(): write_to_bazelrc('build:opt --copt=%s' % opt) def set_tf_cuda_clang(environ_cp): """set TF_CUDA_CLANG action_env. Args: environ_cp: copy of the os.environ. """ question = 'Do you want to use clang as CUDA compiler?' yes_reply = 'Clang will be used a...
combine_chunk_392586
combine.txt
392,586
512
, suppress_default_error=False, resolve_symlinks=False, n_ask_attempts=_DEFAULT_PROMPT_ASK_ATTEMPTS): """Loop over user prompts for an ENV param until receiving a valid response. For the env param var_name, read from...
combine_chunk_392587
combine.txt
392,587
512
mistake.' % (var_name, n_ask_attempts)) if resolve_symlinks: val = os.path.realpath(val) environ_cp[var_name] = val return val def set_clang_cuda_compiler_path(environ_cp): """Set CLANG_CUDA_COMPILER_PATH.""" # Upon clang 19 drop the check for 16 default_clang_path = '/usr/l...
combine_chunk_392588
combine.txt
392,588
512
to use.', check_success=valid_ndk_path, error_msg=('The path %s or its child file "source.properties" ' 'does not exist.')) write_action_env_to_bazelrc('ANDROID_NDK_HOME', android_ndk_home_path) write_action_env_to_bazelrc( 'ANDROID_NDK_API_LEVEL', get_ndk_api_level(environ...
combine_chunk_392589
combine.txt
392,589
512
)) def valid_build_tools(version): return os.path.exists( os.path.join(android_sdk_home_path, 'build-tools', version)) android_build_tools_version = prompt_loop_or_load_from_env( environ_cp, var_name='ANDROID_BUILD_TOOLS_VERSION', var_default=versions[-1], ask_for_var=('Please ...
combine_chunk_392590
combine.txt
392,590
512
/platforms.json')) platforms = json.load(meta) meta.close() aliases = platforms['aliases'] api_levels = sorted(list(set([aliases[i] for i in aliases]))) android_ndk_api_level = prompt_loop_or_load_from_env( environ_cp, var_name='ANDROID_NDK_API_LEVEL', var_default='21', # 21 is required fo...
combine_chunk_392591
combine.txt
392,591
512
clang path until receiving a valid response. Default is used if no input is given. Set CLANG_COMPILER_PATH and write environment variables CC and BAZEL_COMPILER to .bazelrc. Args: environ_cp: (Dict) copy of the os.environ. Returns: string value for clang_compiler_path. """ # Default path if clang...
combine_chunk_392592
combine.txt
392,592
512
(default_clang_path): default_clang_path = shutil.which('clang') or '' clang_compiler_path = prompt_loop_or_load_from_env( environ_cp, var_name='CLANG_COMPILER_PATH', var_default=default_clang_path, ask_for_var='Please specify the path to clang executable.', check_success=os.path.ex...
combine_chunk_392593
combine.txt
392,593
512
is updated, since a type definition is used within # offset of in the current version of ubp. See # https://github.com/protocolbuffers/upb/blob/9effcbcb27f0a665f9f345030188c0b291e32482/upb/upb.c#L183. def disable_clang_offsetof_extension(clang_version): if not clang_version: return try: clang_major_version...
combine_chunk_392594
combine.txt
392,594
512
You can find the compute capability of your ' 'device at: https://developer.nvidia.com/cuda-gpus. Each capability ' 'can be specified as "x.y" or "compute_xy" to include both virtual and' ' binary GPU code, or as "sm_xy" to only include the binary ' 'code.\nPlease note that each addition...
combine_chunk_392595
combine.txt
392,595
512
than sm_35. Disable XLA when running on older GPUs.') else: ver = float(m.group(0)) if ver < 3.0: print('ERROR: TensorFlow only supports CUDA compute capabilities 3.0 ' 'and higher. Please re-specify the list of compute ' 'capabilities excluding version %...
combine_chunk_392596
combine.txt
392,596
512
--test_tag_filters and --build_tag_filters test_and_build_filters = ['-benchmark-test', '-no_oss', '-oss_excluded'] # Additional filters for --test_tag_filters beyond those in # test_and_build_filters test_only_filters = ['-oss_serial'] if is_windows(): test_and_build_filters += ['-no_windows', '-windows...
combine_chunk_392597
combine.txt
392,597
512
libs.split())) write_action_env_to_bazelrc('TF_SYSTEM_LIBS', syslibs) for varname in ('PREFIX', 'PROTOBUF_INCLUDE_PATH'): if varname in environ_cp: write_to_bazelrc('build --define=%s=%s' % (varname, environ_cp[varname])) def set_windows_build_flags(environ_cp): """Set Windows specific build option...
combine_chunk_392598
combine.txt
392,598
512
filepath in IOS_FILES: filename = os.path.basename(filepath) new_filepath = os.path.join(_TF_WORKSPACE_ROOT, filename) symlink_force(filepath, new_filepath) def get_gcc_compiler(environ_cp): gcc_env = environ_cp.get('CXX') or environ_cp.get('CC') or shutil.which('gcc') if gcc_env is not None: gcc...
combine_chunk_392599
combine.txt
392,599
512
') # Get the linker version ld_version = run_shell([gcc_env, '-Wl,-version']).split() ld_version_int = 0 for i in range(len(ld_version)): ld_version_int = convert_version_to_int(ld_version[i]) if ld_version_int is not None: break if ld_version_int is None: ...