TensorFlow,该矢量操作如何区分?

时间:2019-04-29 03:18:14

标签: tensorflow

我在下面定义了以下代码,

    var input = document.getElementById('pac-input');
    var searchBox = new google.maps.places.SearchBox(input);
    this.placeData = new google.maps.places.PlacesService(map);


    map.addListener('bounds_changed', function () {
        searchBox.setBounds(map.getBounds());
    });

    var markers = [];
    this.markersList = []
    this.fullPlaceData = []
    let t = this;

    searchBox.addListener('places_changed', function () {
        this.serverBusy = true

        var places = searchBox.getPlaces();
        console.log(places)
        if (places.length == 0) {
            return;
        }

        markers.forEach(function (marker) {
            marker.setMap(null);
        });

        markers = [];
      //  t.markersList = places
        t.fullPlaceData = []
  var bounds = new google.maps.LatLngBounds();
  var infowindow = new google.maps.InfoWindow();
  let i = 0
  places.forEach(function (place) {
    if (!place.geometry) {
      console.log("Returned place contains no geometry");
      return;
    }

    t.placeData.getDetails({ placeId: place.place_id },
      function (data, status) {
        if (status !== google.maps.places.PlacesServiceStatus.OK) {
          return;
        } else {
          t.fullPlaceData.push(data)
    var icon = {
      url: place.icon,
      size: new google.maps.Size(71, 71),
      origin: new google.maps.Point(0, 0),
      anchor: new google.maps.Point(17, 34),
      scaledSize: new google.maps.Size(25, 25)
    };

    let markerVal = new google.maps.Marker({
      map: map,
      icon: icon,
      title: place.name,
      position: place.geometry.location,
      animation: google.maps.Animation.DROP,
      place_id: place.place_id
    })

    var content = "<div class='map_info_wrapper'><a href=" + place. icon + "><div class='img_wrapper'><img src=" + place. icon + "></div>" +
    "<div class='property_content_wrap'>" +
    "<div class='property_title'>" +
    "<span>" + place.name + "</span>" +
    "</div>" +

    "<div class='property_bed_type'>" +
    "<span>" + place.formatted_address + "</span>" +
    "</div>"

    google.maps.event.addListener(markerVal, 'click', (function (marker, content, i) {
      return function () {
        infowindow.setContent(content);
        infowindow.open(map, marker);
      }
    })(markerVal, content, i));

    i = i + 1

    markers.push(markerVal);
    t.markers = markers

    if (place.geometry.viewport) {
      bounds.union(place.geometry.viewport);
    } else {
      bounds.extend(place.geometry.location);
    }

          map.fitBounds(bounds);

        }
      });
  });
        this.serverBusy = false
    });
}

为什么create or replace PROCEDURE SP_Materials( ITEM_ID IN VARCHAR2, ITEM_DESC OUT VARCHAR2 )AS BEGIN IF (ITEM_ID = '01') THEN ITEM_DESC := 'Hammer'; END IF; IF(ITEM_ID = '02') THEN ITEM_DESC := 'Nail'; END IF; END SP_Materials; 输出一个 try { CallableStatement callableStatementReturn = null; String callableStatement = "{call SP_Materials(?,?)}"; Connection dbConn = DriverManager.getConnection("jdbc:oracle:thin:@10.20.30.40:1111:SID1", "user", "pass"); callableStatementReturn = dbConn.prepareCall(callableStatement); callableStatementReturn.setString(1, "01"); callableStatementReturn.registerOutParameter(2, java.sql.Types.VARCHAR,1000); callableStatementReturn.executeQuery(); System.out.println( callableStatementReturn.getCharacterStream(2).read()); } catch (Exception e) { e.printStackTrace(); } 矩阵? In [1]: import tensorflow as tf In [2]: tf.enable_eager_execution() In [3]: v = tf.range(1, 5+1, dtype=tf.float32) In [4]: v.numpy() Out[4]: array([1., 2., 3., 4., 5.], dtype=float32) In [5]: v[:, None] - v[None, :] Out[5]: <tf.Tensor: id=13, shape=(5, 5), dtype=float32, numpy= array([[ 0., -1., -2., -3., -4.], [ 1., 0., -1., -2., -3.], [ 2., 1., 0., -1., -2.], [ 3., 2., 1., 0., -1.], [ 4., 3., 2., 1., 0.]], dtype=float32)> In [6]: v[None, :] - v[:, None] Out[6]: <tf.Tensor: id=23, shape=(5, 5), dtype=float32, numpy= array([[ 0., 1., 2., 3., 4.], [-1., 0., 1., 2., 3.], [-2., -1., 0., 1., 2.], [-3., -2., -1., 0., 1.], [-4., -3., -2., -1., 0.]], dtype=float32)> In [7]: v[:, None].get_shape() Out[7]: TensorShape([Dimension(5), Dimension(1)]) In [8]: v[None, :].get_shape() Out[8]: TensorShape([Dimension(1), Dimension(5)]) v[:, None] - v[None, :]不同,如何找出它们的差异?这确实让我感到困惑,并且我不确定给出这两个表达式的结果。

0 个答案:

没有答案