Số tự nhiên javascript

Xem các phiên từ Hội nghị chuyên đề WiML về các mô hình khuếch tán với KerasCV, ML trên thiết bị, v.v. Xem theo yêu cầu

  • TenorFlow
  • Học
  • Lõi TensorFlow
  • hướng dẫn

Sắp xếp ngăn nắp với các bộ sưu tập Lưu và phân loại nội dung dựa trên sở thích của bạn

Các hướng dẫn của TensorFlow được viết dưới dạng sổ ghi chép Jupyter và chạy trực tiếp trong Google Colab—một môi trường sổ ghi chép được lưu trữ không yêu cầu thiết lập. Nhấp vào nút Chạy trong Google Colab

Cho những người mới bắt đầu

Nơi tốt nhất để bắt đầu là với API tuần tự Keras thân thiện với người dùng. Xây dựng mô hình bằng cách ghép nối các khối xây dựng với nhau. Sau những hướng dẫn này, hãy đọc hướng dẫn Keras

khởi động nhanh cho người mới bắt đầu

Đây là "Xin chào, Thế giới. " notebook hiển thị Keras Sequential API và
var citiesRef = db.collection["cities"];

citiesRef.doc["SF"].set[{
    name: "San Francisco", state: "CA", country: "USA",
    capital: false, population: 860000,
    regions: ["west_coast", "norcal"] }];
citiesRef.doc["LA"].set[{
    name: "Los Angeles", state: "CA", country: "USA",
    capital: false, population: 3900000,
    regions: ["west_coast", "socal"] }];
citiesRef.doc["DC"].set[{
    name: "Washington, D.C.", state: null, country: "USA",
    capital: true, population: 680000,
    regions: ["east_coast"] }];
citiesRef.doc["TOK"].set[{
    name: "Tokyo", state: null, country: "Japan",
    capital: true, population: 9000000,
    regions: ["kanto", "honshu"] }];
citiesRef.doc["BJ"].set[{
    name: "Beijing", state: null, country: "China",
    capital: true, population: 21500000,
    regions: ["jingjinji", "hebei"] }];

test.firestore.js

4

Khái niệm cơ bản về máy ảnh

Bộ sưu tập sổ ghi chép này thể hiện các tác vụ máy học cơ bản bằng Keras

Tải dữ liệu

Các hướng dẫn này sử dụng
var citiesRef = db.collection["cities"];

citiesRef.doc["SF"].set[{
    name: "San Francisco", state: "CA", country: "USA",
    capital: false, population: 860000,
    regions: ["west_coast", "norcal"] }];
citiesRef.doc["LA"].set[{
    name: "Los Angeles", state: "CA", country: "USA",
    capital: false, population: 3900000,
    regions: ["west_coast", "socal"] }];
citiesRef.doc["DC"].set[{
    name: "Washington, D.C.", state: null, country: "USA",
    capital: true, population: 680000,
    regions: ["east_coast"] }];
citiesRef.doc["TOK"].set[{
    name: "Tokyo", state: null, country: "Japan",
    capital: true, population: 9000000,
    regions: ["kanto", "honshu"] }];
citiesRef.doc["BJ"].set[{
    name: "Beijing", state: null, country: "China",
    capital: true, population: 21500000,
    regions: ["jingjinji", "hebei"] }];

test.firestore.js

5 để tải các định dạng dữ liệu khác nhau và xây dựng các đường dẫn đầu vào

Dành cho chuyên gia

API phân lớp và chức năng của Keras cung cấp giao diện xác định theo lần chạy để tùy chỉnh và nghiên cứu nâng cao. Xây dựng mô hình của bạn, sau đó viết tiến và lùi. Tạo các lớp tùy chỉnh, kích hoạt và vòng đào tạo

Khởi động nhanh nâng cao

Đây là "Xin chào, Thế giới. " notebook sử dụng API phân lớp Keras và vòng lặp đào tạo tùy chỉnh

tùy biến

Bộ sưu tập sổ ghi chép này cho biết cách xây dựng các lớp tùy chỉnh và các vòng đào tạo trong TensorFlow

đào tạo phân tán

Phân phối đào tạo mô hình của bạn trên nhiều GPU, nhiều máy hoặc TPU

Phần Nâng cao có nhiều ví dụ về sổ ghi chép hướng dẫn, bao gồm Dịch máy thần kinh, Máy biến áp và CycleGAN

Cập nhật mọi thông tin được công bố tại Hội nghị thượng đỉnh Firebase và tìm hiểu cách Firebase có thể giúp bạn đẩy nhanh quá trình phát triển ứng dụng cũng như tự tin chạy ứng dụng của mình. Tìm hiểu thêm

  • căn cứ hỏa lực
  • Tài liệu
  • lò sưởi
  • Xây dựng

Gửi phản hồiNhận dữ liệu với Cloud Firestore Sắp xếp ngăn nắp với các bộ sưu tập Lưu và phân loại nội dung dựa trên sở thích của bạn.

Có ba cách để lấy dữ liệu được lưu trữ trong Cloud Firestore. Bất kỳ phương pháp nào trong số này đều có thể được sử dụng với tài liệu, bộ sưu tập tài liệu hoặc kết quả của truy vấn

  • Gọi một phương thức để lấy dữ liệu một lần
  • Đặt trình nghe để nhận các sự kiện thay đổi dữ liệu
  • Tải hàng loạt dữ liệu chụp nhanh Firestore từ nguồn bên ngoài thông qua gói dữ liệu. Xem tài liệu gói để biết thêm chi tiết

Khi bạn đặt một trình lắng nghe, Cloud Firestore sẽ gửi cho trình nghe của bạn một ảnh chụp nhanh dữ liệu ban đầu và sau đó là một ảnh chụp nhanh khác mỗi khi tài liệu thay đổi

Ghi chú. Mặc dù các mẫu mã bao gồm nhiều ngôn ngữ, văn bản giải thích các mẫu đề cập đến tên phương thức Web.

Dữ liệu mẫu

Để bắt đầu, hãy viết một số dữ liệu về các thành phố để chúng tôi có thể xem xét các cách khác nhau để đọc lại

Phiên bản web 9

giới thiệu về SDK mô-đun Web v9 có thể rung cây và nâng cấp từ phiên bản 8.
import { collection, doc, setDoc } from "firebase/firestore"; 

const citiesRef = collection[db, "cities"];

await setDoc[doc[citiesRef, "SF"], {
    name: "San Francisco", state: "CA", country: "USA",
    capital: false, population: 860000,
    regions: ["west_coast", "norcal"] }];
await setDoc[doc[citiesRef, "LA"], {
    name: "Los Angeles", state: "CA", country: "USA",
    capital: false, population: 3900000,
    regions: ["west_coast", "socal"] }];
await setDoc[doc[citiesRef, "DC"], {
    name: "Washington, D.C.", state: null, country: "USA",
    capital: true, population: 680000,
    regions: ["east_coast"] }];
await setDoc[doc[citiesRef, "TOK"], {
    name: "Tokyo", state: null, country: "Japan",
    capital: true, population: 9000000,
    regions: ["kanto", "honshu"] }];
await setDoc[doc[citiesRef, "BJ"], {
    name: "Beijing", state: null, country: "China",
    capital: true, population: 21500000,
    regions: ["jingjinji", "hebei"] }];

example_data.js

Phiên bản web 8

giới thiệu về SDK mô-đun Web v9 có thể rung cây và nâng cấp từ phiên bản 8.
var citiesRef = db.collection["cities"];

citiesRef.doc["SF"].set[{
    name: "San Francisco", state: "CA", country: "USA",
    capital: false, population: 860000,
    regions: ["west_coast", "norcal"] }];
citiesRef.doc["LA"].set[{
    name: "Los Angeles", state: "CA", country: "USA",
    capital: false, population: 3900000,
    regions: ["west_coast", "socal"] }];
citiesRef.doc["DC"].set[{
    name: "Washington, D.C.", state: null, country: "USA",
    capital: true, population: 680000,
    regions: ["east_coast"] }];
citiesRef.doc["TOK"].set[{
    name: "Tokyo", state: null, country: "Japan",
    capital: true, population: 9000000,
    regions: ["kanto", "honshu"] }];
citiesRef.doc["BJ"].set[{
    name: "Beijing", state: null, country: "China",
    capital: true, population: 21500000,
    regions: ["jingjinji", "hebei"] }];

test.firestore.js

Nhanh

Ghi chú. Sản phẩm này không khả dụng trên các mục tiêu watchOS và App Clip

let citiesRef = db.collection["cities"]

citiesRef.document["SF"].setData[[
    "name": "San Francisco",
    "state": "CA",
    "country": "USA",
    "capital": false,
    "population": 860000,
    "regions": ["west_coast", "norcal"]
    ]]
citiesRef.document["LA"].setData[[
    "name": "Los Angeles",
    "state": "CA",
    "country": "USA",
    "capital": false,
    "population": 3900000,
    "regions": ["west_coast", "socal"]
    ]]
citiesRef.document["DC"].setData[[
    "name": "Washington D.C.",
    "country": "USA",
    "capital": true,
    "population": 680000,
    "regions": ["east_coast"]
    ]]
citiesRef.document["TOK"].setData[[
    "name": "Tokyo",
    "country": "Japan",
    "capital": true,
    "population": 9000000,
    "regions": ["kanto", "honshu"]
    ]]
citiesRef.document["BJ"].setData[[
    "name": "Beijing",
    "country": "China",
    "capital": true,
    "population": 21500000,
    "regions": ["jingjinji", "hebei"]
    ]]

ViewController.swift

Mục tiêu-C

Ghi chú. Sản phẩm này không khả dụng trên các mục tiêu watchOS và App Clip

FIRCollectionReference *citiesRef = [self.db collectionWithPath:@"cities"];
[[citiesRef documentWithPath:@"SF"] setData:@{
  @"name": @"San Francisco",
  @"state": @"CA",
  @"country": @"USA",
  @"capital": @[NO],
  @"population": @860000,
  @"regions": @[@"west_coast", @"norcal"]
}];
[[citiesRef documentWithPath:@"LA"] setData:@{
  @"name": @"Los Angeles",
  @"state": @"CA",
  @"country": @"USA",
  @"capital": @[NO],
  @"population": @3900000,
  @"regions": @[@"west_coast", @"socal"]
}];
[[citiesRef documentWithPath:@"DC"] setData:@{
  @"name": @"Washington D.C.",
  @"country": @"USA",
  @"capital": @[YES],
  @"population": @680000,
  @"regions": @[@"east_coast"]
}];
[[citiesRef documentWithPath:@"TOK"] setData:@{
  @"name": @"Tokyo",
  @"country": @"Japan",
  @"capital": @[YES],
  @"population": @9000000,
  @"regions": @[@"kanto", @"honshu"]
}];
[[citiesRef documentWithPath:@"BJ"] setData:@{
  @"name": @"Beijing",
  @"country": @"China",
  @"capital": @[YES],
  @"population": @21500000,
  @"regions": @[@"jingjinji", @"hebei"]
}];

ViewController.m

Java

CollectionReference cities = db.collection["cities"];

Map data1 = new HashMap[];
data1.put["name", "San Francisco"];
data1.put["state", "CA"];
data1.put["country", "USA"];
data1.put["capital", false];
data1.put["population", 860000];
data1.put["regions", Arrays.asList["west_coast", "norcal"]];
cities.document["SF"].set[data1];

Map data2 = new HashMap[];
data2.put["name", "Los Angeles"];
data2.put["state", "CA"];
data2.put["country", "USA"];
data2.put["capital", false];
data2.put["population", 3900000];
data2.put["regions", Arrays.asList["west_coast", "socal"]];
cities.document["LA"].set[data2];

Map data3 = new HashMap[];
data3.put["name", "Washington D.C."];
data3.put["state", null];
data3.put["country", "USA"];
data3.put["capital", true];
data3.put["population", 680000];
data3.put["regions", Arrays.asList["east_coast"]];
cities.document["DC"].set[data3];

Map data4 = new HashMap[];
data4.put["name", "Tokyo"];
data4.put["state", null];
data4.put["country", "Japan"];
data4.put["capital", true];
data4.put["population", 9000000];
data4.put["regions", Arrays.asList["kanto", "honshu"]];
cities.document["TOK"].set[data4];

Map data5 = new HashMap[];
data5.put["name", "Beijing"];
data5.put["state", null];
data5.put["country", "China"];
data5.put["capital", true];
data5.put["population", 21500000];
data5.put["regions", Arrays.asList["jingjinji", "hebei"]];
cities.document["BJ"].set[data5];

DocSnippets.java

Kotlin+KTX

val cities = db.collection["cities"]

val data1 = hashMapOf[
        "name" to "San Francisco",
        "state" to "CA",
        "country" to "USA",
        "capital" to false,
        "population" to 860000,
        "regions" to listOf["west_coast", "norcal"]
]
cities.document["SF"].set[data1]

val data2 = hashMapOf[
        "name" to "Los Angeles",
        "state" to "CA",
        "country" to "USA",
        "capital" to false,
        "population" to 3900000,
        "regions" to listOf["west_coast", "socal"]
]
cities.document["LA"].set[data2]

val data3 = hashMapOf[
        "name" to "Washington D.C.",
        "state" to null,
        "country" to "USA",
        "capital" to true,
        "population" to 680000,
        "regions" to listOf["east_coast"]
]
cities.document["DC"].set[data3]

val data4 = hashMapOf[
        "name" to "Tokyo",
        "state" to null,
        "country" to "Japan",
        "capital" to true,
        "population" to 9000000,
        "regions" to listOf["kanto", "honshu"]
]
cities.document["TOK"].set[data4]

val data5 = hashMapOf[
        "name" to "Beijing",
        "state" to null,
        "country" to "China",
        "capital" to true,
        "population" to 21500000,
        "regions" to listOf["jingjinji", "hebei"]
]
cities.document["BJ"].set[data5]

DocSnippets.kt

phi tiêu

final cities = db.collection["cities"];
final data1 = {
  "name": "San Francisco",
  "state": "CA",
  "country": "USA",
  "capital": false,
  "population": 860000,
  "regions": ["west_coast", "norcal"]
};
cities.doc["SF"].set[data1];

final data2 = {
  "name": "Los Angeles",
  "state": "CA",
  "country": "USA",
  "capital": false,
  "population": 3900000,
  "regions": ["west_coast", "socal"],
};
cities.doc["LA"].set[data2];

final data3 = {
  "name": "Washington D.C.",
  "state": null,
  "country": "USA",
  "capital": true,
  "population": 680000,
  "regions": ["east_coast"]
};
cities.doc["DC"].set[data3];

final data4 = {
  "name": "Tokyo",
  "state": null,
  "country": "Japan",
  "capital": true,
  "population": 9000000,
  "regions": ["kanto", "honshu"]
};
cities.doc["TOK"].set[data4];

final data5 = {
  "name": "Beijing",
  "state": null,
  "country": "China",
  "capital": true,
  "population": 21500000,
  "regions": ["jingjinji", "hebei"],
};
cities.doc["BJ"].set[data5];

firestore.dart

Java

CollectionReference cities = db.collection["cities"];
List futures = new ArrayList[];
futures.add[
    cities
        .document["SF"]
        .set[
            new City[
                "San Francisco",
                "CA",
                "USA",
                false,
                860000L,
                Arrays.asList["west_coast", "norcal"]]]];
futures.add[
    cities
        .document["LA"]
        .set[
            new City[
                "Los Angeles",
                "CA",
                "USA",
                false,
                3900000L,
                Arrays.asList["west_coast", "socal"]]]];
futures.add[
    cities
        .document["DC"]
        .set[
            new City[
                "Washington D.C.", null, "USA", true, 680000L, Arrays.asList["east_coast"]]]];
futures.add[
    cities
        .document["TOK"]
        .set[
            new City[
                "Tokyo", null, "Japan", true, 9000000L, Arrays.asList["kanto", "honshu"]]]];
futures.add[
    cities
        .document["BJ"]
        .set[
            new City[
                "Beijing",
                null,
                "China",
                true,
                21500000L,
                Arrays.asList["jingjinji", "hebei"]]]];
// [optional] block on operation
ApiFutures.allAsList[futures].get[];

RetrieveDataSnippets.java

con trăn
class City[object]:
    def __init__[self, name, state, country, capital=False, population=0,
                 regions=[]]:
        self.name = name
        self.state = state
        self.country = country
        self.capital = capital
        self.population = population
        self.regions = regions

    @staticmethod
    def from_dict[source]:
        # ...

    def to_dict[self]:
        # ...

    def __repr__[self]:
        return [
            f'City[\
                name={self.name}, \
                country={self.country}, \
                population={self.population}, \
                capital={self.capital}, \
                regions={self.regions}\
            ]'
        ]
cities_ref = db.collection[u'cities']
cities_ref.document[u'BJ'].set[
    City[u'Beijing', None, u'China', True, 21500000, [u'hebei']].to_dict[]]
cities_ref.document[u'SF'].set[
    City[u'San Francisco', u'CA', u'USA', False, 860000,
         [u'west_coast', u'norcal']].to_dict[]]
cities_ref.document[u'LA'].set[
    City[u'Los Angeles', u'CA', u'USA', False, 3900000,
         [u'west_coast', u'socal']].to_dict[]]
cities_ref.document[u'DC'].set[
    City[u'Washington D.C.', None, u'USA', True, 680000,
         [u'east_coast']].to_dict[]]
cities_ref.document[u'TOK'].set[
    City[u'Tokyo', None, u'Japan', True, 9000000,
         [u'kanto', u'honshu']].to_dict[]]

snippets.py

con trăn

var citiesRef = db.collection["cities"];

citiesRef.doc["SF"].set[{
    name: "San Francisco", state: "CA", country: "USA",
    capital: false, population: 860000,
    regions: ["west_coast", "norcal"] }];
citiesRef.doc["LA"].set[{
    name: "Los Angeles", state: "CA", country: "USA",
    capital: false, population: 3900000,
    regions: ["west_coast", "socal"] }];
citiesRef.doc["DC"].set[{
    name: "Washington, D.C.", state: null, country: "USA",
    capital: true, population: 680000,
    regions: ["east_coast"] }];
citiesRef.doc["TOK"].set[{
    name: "Tokyo", state: null, country: "Japan",
    capital: true, population: 9000000,
    regions: ["kanto", "honshu"] }];
citiesRef.doc["BJ"].set[{
    name: "Beijing", state: null, country: "China",
    capital: true, population: 21500000,
    regions: ["jingjinji", "hebei"] }];

test.firestore.js

0

C++
var citiesRef = db.collection["cities"];

citiesRef.doc["SF"].set[{
    name: "San Francisco", state: "CA", country: "USA",
    capital: false, population: 860000,
    regions: ["west_coast", "norcal"] }];
citiesRef.doc["LA"].set[{
    name: "Los Angeles", state: "CA", country: "USA",
    capital: false, population: 3900000,
    regions: ["west_coast", "socal"] }];
citiesRef.doc["DC"].set[{
    name: "Washington, D.C.", state: null, country: "USA",
    capital: true, population: 680000,
    regions: ["east_coast"] }];
citiesRef.doc["TOK"].set[{
    name: "Tokyo", state: null, country: "Japan",
    capital: true, population: 9000000,
    regions: ["kanto", "honshu"] }];
citiesRef.doc["BJ"].set[{
    name: "Beijing", state: null, country: "China",
    capital: true, population: 21500000,
    regions: ["jingjinji", "hebei"] }];

test.firestore.js

1
Nút. js

var citiesRef = db.collection["cities"];

citiesRef.doc["SF"].set[{
    name: "San Francisco", state: "CA", country: "USA",
    capital: false, population: 860000,
    regions: ["west_coast", "norcal"] }];
citiesRef.doc["LA"].set[{
    name: "Los Angeles", state: "CA", country: "USA",
    capital: false, population: 3900000,
    regions: ["west_coast", "socal"] }];
citiesRef.doc["DC"].set[{
    name: "Washington, D.C.", state: null, country: "USA",
    capital: true, population: 680000,
    regions: ["east_coast"] }];
citiesRef.doc["TOK"].set[{
    name: "Tokyo", state: null, country: "Japan",
    capital: true, population: 9000000,
    regions: ["kanto", "honshu"] }];
citiesRef.doc["BJ"].set[{
    name: "Beijing", state: null, country: "China",
    capital: true, population: 21500000,
    regions: ["jingjinji", "hebei"] }];

test.firestore.js

2

Đi

var citiesRef = db.collection["cities"];

citiesRef.doc["SF"].set[{
    name: "San Francisco", state: "CA", country: "USA",
    capital: false, population: 860000,
    regions: ["west_coast", "norcal"] }];
citiesRef.doc["LA"].set[{
    name: "Los Angeles", state: "CA", country: "USA",
    capital: false, population: 3900000,
    regions: ["west_coast", "socal"] }];
citiesRef.doc["DC"].set[{
    name: "Washington, D.C.", state: null, country: "USA",
    capital: true, population: 680000,
    regions: ["east_coast"] }];
citiesRef.doc["TOK"].set[{
    name: "Tokyo", state: null, country: "Japan",
    capital: true, population: 9000000,
    regions: ["kanto", "honshu"] }];
citiesRef.doc["BJ"].set[{
    name: "Beijing", state: null, country: "China",
    capital: true, population: 21500000,
    regions: ["jingjinji", "hebei"] }];

test.firestore.js

3

PHP

PHP

Để biết thêm về cách cài đặt và tạo ứng dụng khách Cloud Firestore, hãy tham khảo Thư viện ứng dụng khách Cloud Firestore

Chủ Đề