Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
dòng chảy căng:: ôi:: thưa thớt chéo
#include <sparse_ops.h>
Tạo ra giao thoa thưa thớt từ danh sách các tensor thưa thớt và dày đặc.
Bản tóm tắt
Op có hai danh sách, một trong 2D SparseTensor
và một trong 2D Tensor
, mỗi danh sách đại diện cho các tính năng của một cột tính năng. Nó tạo ra một SparseTensor
2D với sự kết hợp hàng loạt các tính năng này.
Ví dụ: nếu đầu vào là
inputs[0]: SparseTensor with shape = [2, 2]
[0, 0]: "a"
[1, 0]: "b"
[1, 1]: "c"
inputs[1]: SparseTensor with shape = [2, 1]
[0, 0]: "d"
[1, 0]: "e"
inputs[2]: Tensor [["f"], ["g"]]
thì đầu ra sẽ là
shape = [2, 2]
[0, 0]: "a_X_d_X_f"
[1, 0]: "b_X_e_X_g"
[1, 1]: "c_X_e_X_g"
nếu hashed_output=true thì đầu ra sẽ là
shape = [2, 2]
[0, 0]: FingerprintCat64(
Fingerprint64("f"), FingerprintCat64(
Fingerprint64("d"), Fingerprint64("a")))
[1, 0]: FingerprintCat64(
Fingerprint64("g"), FingerprintCat64(
Fingerprint64("e"), Fingerprint64("b")))
[1, 1]: FingerprintCat64(
Fingerprint64("g"), FingerprintCat64(
Fingerprint64("e"), Fingerprint64("c")))
Lập luận:
- phạm vi: Một đối tượng Phạm vi
- chỉ số: 2-D. Các chỉ số của mỗi đầu vào
SparseTensor
. - giá trị: 1-D. giá trị của mỗi
SparseTensor
. - hình dạng: 1-D. Hình dạng của mỗi
SparseTensor
. - dày đặc_inputs: 2-D. Các cột được biểu diễn bằng
Tensor
dày đặc. - hashed_output: Nếu đúng, trả về hàm băm của chữ thập thay vì chuỗi. Điều này sẽ cho phép chúng ta tránh được các thao tác trên chuỗi.
- num_buckets: Nó được sử dụng nếu hashed_output là đúng. đầu ra = hashed_valuenum_buckets nếu num_buckets > 0 nếu không hashed_value.
- hash_key: Chỉ định hash_key sẽ được hàm
FingerprintCat64
sử dụng để kết hợp các dấu vân tay chéo.
Trả về:
-
Output
ra_chỉ số đầu ra: 2-D. Các chỉ số của SparseTensor
được nối. -
Output
trị đầu ra đầu ra: 1-D. Các giá trị không trống của SparseTensor
được nối hoặc băm. -
Output
đầu ra_shape: 1-D. Hình dạng của SparseTensor
được nối.
Thuộc tính công khai
Chức năng công cộng
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-25 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-25 UTC."],[],[],null,["# tensorflow::ops::SparseCross Class Reference\n\ntensorflow::ops::SparseCross\n============================\n\n`#include \u003csparse_ops.h\u003e`\n\nGenerates sparse cross from a list of sparse and dense tensors.\n\nSummary\n-------\n\nThe op takes two lists, one of 2D `SparseTensor` and one of 2D [Tensor](/versions/r1.15/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor), each representing features of one feature column. It outputs a 2D `SparseTensor` with the batchwise crosses of these features.\n\nFor example, if the inputs are \n\n```text\ninputs[0]: SparseTensor with shape = [2, 2]\n[0, 0]: \"a\"\n[1, 0]: \"b\"\n[1, 1]: \"c\"\n\ninputs[1]: SparseTensor with shape = [2, 1]\n[0, 0]: \"d\"\n[1, 0]: \"e\"\n\ninputs[2]: Tensor [[\"f\"], [\"g\"]]\n```\n\n\u003cbr /\u003e\n\nthen the output will be \n\n```scdoc\nshape = [2, 2]\n[0, 0]: \"a_X_d_X_f\"\n[1, 0]: \"b_X_e_X_g\"\n[1, 1]: \"c_X_e_X_g\"\n```\n\n\u003cbr /\u003e\n\nif hashed_output=true then the output will be \n\n```text\nshape = [2, 2]\n[0, 0]: FingerprintCat64(\n Fingerprint64(\"f\"), FingerprintCat64(\n Fingerprint64(\"d\"), Fingerprint64(\"a\")))\n[1, 0]: FingerprintCat64(\n Fingerprint64(\"g\"), FingerprintCat64(\n Fingerprint64(\"e\"), Fingerprint64(\"b\")))\n[1, 1]: FingerprintCat64(\n Fingerprint64(\"g\"), FingerprintCat64(\n Fingerprint64(\"e\"), Fingerprint64(\"c\")))\n```\n\n\u003cbr /\u003e\n\nArguments:\n\n- scope: A [Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- indices: 2-D. Indices of each input `SparseTensor`.\n- values: 1-D. values of each `SparseTensor`.\n- shapes: 1-D. Shapes of each `SparseTensor`.\n- dense_inputs: 2-D. Columns represented by dense [Tensor](/versions/r1.15/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor).\n- hashed_output: If true, returns the hash of the cross instead of the string. This will allow us avoiding string manipulations.\n- num_buckets: It is used if hashed_output is true. output = hashed_valuenum_buckets if num_buckets \\\u003e 0 else hashed_value.\n- hash_key: Specify the hash_key that will be used by the `FingerprintCat64` function to combine the crosses fingerprints.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) output_indices: 2-D. Indices of the concatenated `SparseTensor`.\n- [Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) output_values: 1-D. Non-empty values of the concatenated or hashed `SparseTensor`.\n- [Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) output_shape: 1-D. Shape of the concatenated `SparseTensor`.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [SparseCross](#classtensorflow_1_1ops_1_1_sparse_cross_1aed8888154d0f2d69bb849055ef8805ae)`(const ::`[tensorflow::Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::InputList](/versions/r1.15/api_docs/cc/class/tensorflow/input-list#classtensorflow_1_1_input_list)` indices, ::`[tensorflow::InputList](/versions/r1.15/api_docs/cc/class/tensorflow/input-list#classtensorflow_1_1_input_list)` values, ::`[tensorflow::InputList](/versions/r1.15/api_docs/cc/class/tensorflow/input-list#classtensorflow_1_1_input_list)` shapes, ::`[tensorflow::InputList](/versions/r1.15/api_docs/cc/class/tensorflow/input-list#classtensorflow_1_1_input_list)` dense_inputs, bool hashed_output, int64 num_buckets, int64 hash_key, DataType out_type, DataType internal_type)` ||\n\n| ### Public attributes ||\n|-----------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_sparse_cross_1aa80e22c2b5a8b8c00fdfbed5f6da6e03) | [Operation](/versions/r1.15/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output_indices](#classtensorflow_1_1ops_1_1_sparse_cross_1aff3e5729686b249a84f3047cd2c7b2fa) | `::`[tensorflow::Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [output_shape](#classtensorflow_1_1ops_1_1_sparse_cross_1a168d4af0a9f32f170b7fd033550d0d24) | `::`[tensorflow::Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [output_values](#classtensorflow_1_1ops_1_1_sparse_cross_1a811794f95c743d1e8f345356e773447a) | `::`[tensorflow::Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### output_indices\n\n```scdoc\n::tensorflow::Output output_indices\n``` \n\n### output_shape\n\n```scdoc\n::tensorflow::Output output_shape\n``` \n\n### output_values\n\n```scdoc\n::tensorflow::Output output_values\n``` \n\nPublic functions\n----------------\n\n### SparseCross\n\n```gdscript\n SparseCross(\n const ::tensorflow::Scope & scope,\n ::tensorflow::InputList indices,\n ::tensorflow::InputList values,\n ::tensorflow::InputList shapes,\n ::tensorflow::InputList dense_inputs,\n bool hashed_output,\n int64 num_buckets,\n int64 hash_key,\n DataType out_type,\n DataType internal_type\n)\n```"]]