我想知道是否有可能提高 X.T X.其中X的形状为(N,M),即
class registerHelper extends dbHelper {
// properties
private $contentTypeForResponse;
private $connection;
private $tableMapper;
// constructor
public function __construct($contentTypeForResponse) {
$this->contentTypeForResponse = $contentTypeForResponse;
$this->connection = $this->getConnection($contentTypeForResponse);
$this->tableMapper = array(
"id" => REG_ID,
"firstName" => REG_FNAME,
"lastName" => REG_LNAME,
"email" => REG_EMAIL,
"password" => REG_PSW,
"gender" => REG_GENDER,
"mobileNumber" => REG_MOBILE_NUM,
"avatar" => REG_AVATAR_URL,
"createdAt" => REG_CREATED_AT,
"updatedAt" => REG_UPDATED_AT,
"mobileVerified" => REG_IS_MOB_VERIFY,
"emailVerified" => REG_IS_EMAIL_VERIFY,
"dob" => REG_DOB
);
}
public function updateReg($requestMethod) {
if ($requestMethod !== "POST") {
$this->showError($this->contentTypeForResponse, "Request method should be POST.");
}
$postArray = $_POST; // in case for form data or url encoded data
// $postArray = $this->jsonValidate($this->contentTypeForResponse, file_get_contents('php://input'));
if (empty($postArray)) {
$this->showError($this->contentTypeForResponse, "Parameters are missing.");
}
$queryParam = array();
$queryParam["id"] = isset($postArray["id"]) ? $postArray["id"] : $this->showError($this->contentTypeForResponse, "key 'id' missing.");
// check here whether user already exists or not
$this->isIdExists($queryParam["id"]);
$queryParam["avatar"] = isset($_FILES["avatar"]) ? $this->uploadImage($this->contentTypeForResponse, $_FILES["avatar"]) : null;
$queryParam["password"] = isset($postArray["password"]) ? $postArray["password"] : null;
$queryParam["firstName"] = isset($postArray["firstName"]) ? $postArray["firstName"] : null;
$queryParam["lastName"] = isset($postArray["lastName"]) ? $postArray["lastName"] : null;
$queryParam["gender"] = isset($postArray["gender"]) ? $postArray["gender"] : null;
$queryParam["mobileNumber"] = isset($postArray["mobileNumber"]) ? $postArray["mobileNumber"] : null;
$queryParam["dob"] = isset($postArray["dob"]) ? $postArray["dob"] : null;
$queryParam["updatedAt"] = $this->getDateTime("UTC", "UTC", DateTime::ATOM, $this->contentTypeForResponse);
$queryParam["emailVerified"] = isset($postArray["emailVerified"]) ? $postArray["emailVerified"] : null;
$queryParam["mobileVerified"] = isset($postArray["mobileVerified"]) ? $postArray["mobileVerified"] : null;
$query = "UPDATE " . TABLE_REG . " SET ";
foreach ($queryParam as $key => $value) {
if ($key === "id" || is_null($value)) {
continue;
}
$query .= $this->tableMapper[$key] . " = :" . $key . ", ";
}
$query = rtrim($query, ", ") . " WHERE "
. REG_ID . " = :id"; // . " AND " // uncomment for more filters
$stmt = $this->connection->prepare($query);
foreach ($queryParam as $key => $value) {
if (is_null($value)) {
continue;
}
$stmt->bindParam(":" . $key, $queryParam[$key]);
}
$success = $stmt->execute();
if ($success === FALSE) {
$this->connection = null;
$this->showError($this->contentTypeForResponse, "Profile updation failed. Please try again.");
}
$this->connection = null;
$result = array(
"title" => "Success!",
"message" => "Profile updated successfully."
);
$this->showSuccess($this->contentTypeForResponse, "EDIT PROFILE", $result);
}
private function isIdExists($id) {
$stmt = $this->connection->prepare("SELECT " . REG_EMAIL . " FROM " . TABLE_REG . " WHERE "
. REG_ID . " = :id");
$stmt->bindParam(":id", $id);
$success = $stmt->execute();
if ($success === FALSE) {
$this->connection = null;
$this->showError($this->contentTypeForResponse, "Failed at User ID exists check. Please try again.");
}
// $this->connection = null;
// set the resulting array to associative
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if (empty($result) === TRUE) {
$this->connection = null;
$this->showError($this->contentTypeForResponse, "Specified 'id' not found in users table. Please provide correct ID.");
}
}
}
使用https://www.tensorflow.org/api_docs/python/tf/linalg/LinearOperatorLowerTriangular
但是我不确定如何将其应用于此问题
形状为(M,M)的结果显然是对称的,上三角部分只是下三角的转置。
使用tensorflow是否有可能以任何直接的方式实现?
欢呼!